From 659571cbc5fe7eaac97f6db9f59438389aab64ec Mon Sep 17 00:00:00 2001 From: DiTus Date: Thu, 26 Feb 2026 20:38:26 +0100 Subject: [PATCH] Add Hide All / Show All button for indicators - Add visibility-toggle button next to Clear All button - Button toggles between 'Hide All' and 'Show All' text - Hides/shows all indicators with single click - Uses event delegation to handle button clicks in container --- .../static/js/ui/indicators-panel-new.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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 e7b68d0..6f0bf9f 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -119,6 +119,9 @@ export function renderIndicatorPanel() { const favoriteIds = new Set(userPresets.favorites || []); + const allVisible = activeIndicators.length > 0 ? activeIndicators.every(ind => ind.visible !== false) : false; + const visibilityBtnText = allVisible ? 'Hide All' : 'Show All'; + container.innerHTML = `
@@ -162,6 +165,7 @@ export function renderIndicatorPanel() {
${activeIndicators.length} Active + ${activeIndicators.length > 0 ? `` : ''} ${activeIndicators.length > 0 ? `` : ''}
${activeIndicators.slice().reverse().map(ind => renderActiveIndicator(ind)).join('')} @@ -392,6 +396,15 @@ function setupEventListeners() { return; } + // Visibility toggle (Hide All / Show All) button + const visibilityToggleBtn = e.target.closest('.visibility-toggle'); + if (visibilityToggleBtn) { + if (window.toggleAllIndicatorsVisibility) { + window.toggleAllIndicatorsVisibility(); + } + return; + } + // Expand/collapse button const expandBtn = e.target.closest('.indicator-btn.expand'); if (expandBtn) { @@ -481,6 +494,17 @@ window.clearAllIndicators = function() { drawIndicatorsOnChart(); } +window.toggleAllIndicatorsVisibility = function() { + const allVisible = activeIndicators.every(ind => ind.visible !== false); + + activeIndicators.forEach(ind => { + ind.visible = !allVisible; + }); + + drawIndicatorsOnChart(); + renderIndicatorPanel(); +} + function removeIndicatorById(id) { const idx = activeIndicators.findIndex(a => a.id === id); if (idx < 0) return;