From d0fbe8cfe5b795e5b0794e546b0c2417147250f3 Mon Sep 17 00:00:00 2001 From: DiTus Date: Wed, 25 Feb 2026 22:43:05 +0100 Subject: [PATCH] Fix export syntax using standalone function declarations - Converted window.addIndicator to standalone function 'addIndicator' - Converted window.removeIndicatorById to standalone function 'removeIndicatorById' - Added standalone function removeIndicatorByIndex - Export all three functions directly - Assign to window for backward compatibility - Fixes 'Unexpected token' error in export statements --- .../static/js/ui/indicators-panel-new.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) 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 0d0a489..dc27f5d 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -382,10 +382,10 @@ window.clearAllIndicators = function() { activeIndicators = []; configuringId = null; renderIndicatorPanel(); - drawIndicatorsOnChart(); +drawIndicatorsOnChart(); }; -window.addIndicator = function(type) { +function addIndicator(type) { const IndicatorClass = IR?.[type]; if (!IndicatorClass) return; @@ -500,7 +500,7 @@ window.resetIndicator = function(id) { drawIndicatorsOnChart(); }; -window.removeIndicatorById = function(id) { +function removeIndicatorById(id) { const idx = activeIndicators.findIndex(a => a.id === id); if (idx < 0) return; @@ -516,7 +516,12 @@ window.removeIndicatorById = function(id) { renderIndicatorPanel(); drawIndicatorsOnChart(); -}; +} + +function removeIndicatorByIndex(index) { + if (index < 0 || index >= activeIndicators.length) return; + removeIndicatorById(activeIndicators[index].id); +} // Presets function getPresetsForIndicator(indicatorName) { @@ -707,7 +712,9 @@ window.removeIndicator = function() { }; // Assign to window for backward compatibility -window.toggleIndicator = window.addIndicator; +window.toggleIndicator = addIndicator; +window.addIndicator = addIndicator; +window.removeIndicatorById = removeIndicatorById; window.removeIndicatorByIndex = function(index) { if (index < 0 || index >= activeIndicators.length) return; removeIndicatorById(activeIndicators[index].id); @@ -715,6 +722,4 @@ window.removeIndicatorByIndex = function(index) { window.drawIndicatorsOnChart = drawIndicatorsOnChart; // Export functions for module imports -export { window.addIndicator as addIndicator }; -export { window.removeIndicatorById as removeIndicatorById }; -export { window.removeIndicatorByIndex as removeIndicatorByIndex }; \ No newline at end of file +export { addIndicator, removeIndicatorById, removeIndicatorByIndex }; \ No newline at end of file