diff --git a/ANNOTATE/data/annotations/annotations_db.json b/ANNOTATE/data/annotations/annotations_db.json index 4a089f0..55d5bea 100644 --- a/ANNOTATE/data/annotations/annotations_db.json +++ b/ANNOTATE/data/annotations/annotations_db.json @@ -1,51 +1,5 @@ { "annotations": [ - { - "annotation_id": "2179b968-abff-40de-a8c9-369f0990fb8a", - "symbol": "ETH/USDT", - "timeframe": "1s", - "entry": { - "timestamp": "2025-10-22 21:30:07", - "price": 3721.91, - "index": 250 - }, - "exit": { - "timestamp": "2025-10-22 21:33:35", - "price": 3742.8, - "index": 458 - }, - "direction": "LONG", - "profit_loss_pct": 0.5612709603402642, - "notes": "", - "created_at": "2025-10-23T00:35:40.358277", - "market_context": { - "entry_state": {}, - "exit_state": {} - } - }, - { - "annotation_id": "d1944f94-33d8-4ebd-a690-1a8f788c7757", - "symbol": "ETH/USDT", - "timeframe": "1s", - "entry": { - "timestamp": "2025-10-22 21:33:54", - "price": 3744.1, - "index": 477 - }, - "exit": { - "timestamp": "2025-10-22 21:34:33", - "price": 3737.13, - "index": 498 - }, - "direction": "SHORT", - "profit_loss_pct": 0.1861595577041158, - "notes": "", - "created_at": "2025-10-23T16:52:17.692407", - "market_context": { - "entry_state": {}, - "exit_state": {} - } - }, { "annotation_id": "967f91f4-5f01-4608-86af-4a006d55bd3c", "symbol": "ETH/USDT", @@ -91,10 +45,33 @@ "entry_state": {}, "exit_state": {} } + }, + { + "annotation_id": "ee34388a-fcad-4c7e-8a0a-2e8d205d5357", + "symbol": "ETH/USDT", + "timeframe": "1m", + "entry": { + "timestamp": "2025-10-24 04:06", + "price": 3895.67, + "index": 18 + }, + "exit": { + "timestamp": "2025-10-24 05:24", + "price": 3965, + "index": 36 + }, + "direction": "LONG", + "profit_loss_pct": 1.7796681957147276, + "notes": "", + "created_at": "2025-10-24T13:55:31.843201", + "market_context": { + "entry_state": {}, + "exit_state": {} + } } ], "metadata": { - "total_annotations": 4, - "last_updated": "2025-10-24T12:56:59.390345" + "total_annotations": 5, + "last_updated": "2025-10-24T13:55:31.843201" } } \ No newline at end of file diff --git a/ANNOTATE/web/static/js/chart_manager.js b/ANNOTATE/web/static/js/chart_manager.js index 137bbc1..363634e 100644 --- a/ANNOTATE/web/static/js/chart_manager.js +++ b/ANNOTATE/web/static/js/chart_manager.js @@ -305,14 +305,19 @@ class ChartManager { // Add click handler for annotations plotElement.on('plotly_clickannotation', (eventData) => { - console.log('Annotation clicked:', eventData); + console.log('=== plotly_clickannotation event fired ==='); + console.log('Event data:', eventData); + console.log('Annotation:', eventData.annotation); + const annotationName = eventData.annotation.name; + console.log('Annotation name:', annotationName); + if (annotationName) { const parts = annotationName.split('_'); const action = parts[0]; // 'entry', 'exit', or 'delete' const annotationId = parts[1]; - console.log(`Annotation action: ${action}, ID: ${annotationId}`); + console.log(`Parsed - Action: ${action}, ID: ${annotationId}`); if (action === 'delete') { this.handleAnnotationClick(annotationId, 'delete'); @@ -694,15 +699,27 @@ class ChartManager { * Handle annotation click for editing/deleting */ handleAnnotationClick(annotationId, action) { - console.log(`Annotation ${action}:`, annotationId); + console.log(`=== handleAnnotationClick called ===`); + console.log(` Action: ${action}`); + console.log(` Annotation ID: ${annotationId}`); + console.log(` window.deleteAnnotation type: ${typeof window.deleteAnnotation}`); if (action === 'delete') { + console.log('Delete action confirmed, showing confirm dialog...'); if (confirm('Delete this annotation?')) { + console.log('User confirmed deletion'); if (window.deleteAnnotation) { + console.log('Calling window.deleteAnnotation...'); window.deleteAnnotation(annotationId); + } else { + console.error('window.deleteAnnotation is not available!'); + alert('Delete function not available. Please refresh the page.'); } + } else { + console.log('User cancelled deletion'); } } else if (action === 'edit') { + console.log('Edit action'); if (window.appState && window.appState.chartManager) { window.appState.chartManager.editAnnotation(annotationId); } diff --git a/ANNOTATE/web/templates/annotation_dashboard.html b/ANNOTATE/web/templates/annotation_dashboard.html index 9c36dbe..e0dd5ff 100644 --- a/ANNOTATE/web/templates/annotation_dashboard.html +++ b/ANNOTATE/web/templates/annotation_dashboard.html @@ -369,6 +369,10 @@ } function setupGlobalFunctions() { + console.log('=== setupGlobalFunctions called ==='); + console.log('deleteAnnotation function exists:', typeof deleteAnnotation); + console.log('highlightAnnotation function exists:', typeof highlightAnnotation); + // Make functions globally available window.showError = showError; window.showSuccess = showSuccess; @@ -382,6 +386,14 @@ console.log(' - window.renderAnnotationsList:', typeof window.renderAnnotationsList); console.log(' - window.showError:', typeof window.showError); console.log(' - window.showSuccess:', typeof window.showSuccess); + + // Test call + console.log('Testing window.deleteAnnotation availability...'); + if (typeof window.deleteAnnotation === 'function') { + console.log('✓ window.deleteAnnotation is ready'); + } else { + console.error('✗ window.deleteAnnotation is NOT a function!'); + } } function renderAnnotationsList(annotations) { diff --git a/ANNOTATE/web/templates/base_layout.html b/ANNOTATE/web/templates/base_layout.html index bd1d73b..99e608c 100644 --- a/ANNOTATE/web/templates/base_layout.html +++ b/ANNOTATE/web/templates/base_layout.html @@ -74,11 +74,11 @@ - - - - - + + + + + {% block extra_js %}{% endblock %}