diff --git a/src/api/dashboard/static/js/ui/indicators-panel-new.js b/src/api/dashboard/static/js/ui/indicators-panel-new.js index 9fd1c8a..37fdb18 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -357,11 +357,11 @@ function renderIndicatorPresets(indicator, meta) { function setupEventListeners() { const container = document.getElementById('indicatorPanel'); if (!container) return; - - console.log('[IndicatorPanel] Setting up event listeners...'); - - // Single event delegation handler for add button + container.addEventListener('click', (e) => { + e.stopPropagation(); + + // Add button const addBtn = e.target.closest('.indicator-btn.add'); if (addBtn) { e.stopPropagation(); @@ -372,6 +372,28 @@ function setupEventListeners() { return; } + // Remove button + const removeBtn = e.target.closest('.indicator-btn.remove'); + if (removeBtn) { + e.stopPropagation(); + const id = removeBtn.dataset.id; + if (id && window.removeIndicatorById) { + window.removeIndicatorById(id); + } + return; + } + + // Clear all button + const clearAllBtn = e.target.closest('.clear-all'); + if (clearAllBtn) { + if (window.clearAllIndicators) { + window.clearAllIndicators(); + } + return; + } + return; + } + // Expand/collapse button const expandBtn = e.target.closest('.indicator-btn.expand'); if (expandBtn) { @@ -431,16 +453,6 @@ function setupEventListeners() { renderIndicatorPanel(); }); }); - - // Clear all button - const clearAllBtn = container.querySelector('.clear-all'); - if (clearAllBtn) { - clearAllBtn.addEventListener('click', () => { - window.clearAllIndicators(); - }); - } - - console.log('[IndicatorPanel] Event listeners setup complete'); } // Actions @@ -471,8 +483,6 @@ window.updateIndicatorSetting = function(id, key, value) { }; window.clearAllIndicators = function() { - console.warn('clearAllIndicators() called - clearing all indicators!'); - console.trace('Call stack:'); activeIndicators.forEach(ind => { ind.series?.forEach(s => { try { window.dashboard?.chart?.removeSeries(s); } catch(e) {} diff --git a/src/api/dashboard/static/js/ui/indicators-panel.js b/src/api/dashboard/static/js/ui/indicators-panel.js index da39715..9880884 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel.js +++ b/src/api/dashboard/static/js/ui/indicators-panel.js @@ -1,8 +1,5 @@ import { getAvailableIndicators, IndicatorRegistry as IR } from '../indicators/index.js'; -console.warn('⚠️ [indicators-panel.js] OLD MODULE DETECTED! This will conflict with indicators-panel-new.js!'); -console.trace('[indicators-panel.js] Loading call stack:'); - let activeIndicators = []; let configuringId = null; let previewingType = null; // type being previewed (not yet added)