wip wip wip

This commit is contained in:
Dobromir Popov
2025-10-23 18:57:07 +03:00
parent b0771ff34e
commit 0225f4df58
17 changed files with 2739 additions and 756 deletions

View File

@@ -165,7 +165,15 @@
item.querySelector('.delete-annotation-btn').addEventListener('click', function(e) {
e.stopPropagation();
deleteAnnotation(annotation.annotation_id);
console.log('Delete button clicked for:', annotation.annotation_id);
// Use window.deleteAnnotation to ensure we get the global function
if (typeof window.deleteAnnotation === 'function') {
window.deleteAnnotation(annotation.annotation_id);
} else {
console.error('window.deleteAnnotation is not a function:', typeof window.deleteAnnotation);
alert('Delete function not available. Please refresh the page.');
}
});
listContainer.appendChild(item);
@@ -204,32 +212,5 @@
});
}
function deleteAnnotation(annotationId) {
if (!confirm('Are you sure you want to delete this annotation?')) {
return;
}
fetch('/api/delete-annotation', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({annotation_id: annotationId})
})
.then(response => response.json())
.then(data => {
if (data.success) {
// Remove from UI
appState.annotations = appState.annotations.filter(a => a.annotation_id !== annotationId);
renderAnnotationsList(appState.annotations);
if (appState.chartManager) {
appState.chartManager.removeAnnotation(annotationId);
}
showSuccess('Annotation deleted');
} else {
showError('Failed to delete annotation: ' + data.error.message);
}
})
.catch(error => {
showError('Network error: ' + error.message);
});
}
// Note: deleteAnnotation is defined in annotation_dashboard.html to avoid duplication
</script>