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 c6505bd..8d30383 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -238,7 +238,7 @@ function renderActiveIndicator(indicator) { - @@ -320,31 +320,6 @@ function renderIndicatorConfig(indicator, meta) { `).join('')} ` : ''} - - - ${meta?.inputs && meta.inputs.length > 0 ? ` -
-
Parameters
- ${meta.inputs.map(input => ` -${console.log("[DEBUG] Input:", input.name, "value:", indicator.params[input.name])}` - - ${input.type === 'select' ? - `` : - `` - } -
- `).join('')} - - ` : ''}
@@ -369,13 +344,13 @@ function renderIndicatorPresets(indicator, meta) {
${presets.map(p => { const isApplied = meta.inputs.every(input => - (indicator.params[input.name] === (preset.values?.[input.name] ?? input.default)) + (indicator.params[input.name] === (p.values?.[input.name] ?? input.default)) ); return ` -
- ${preset.name} - +
+ ${p.name} +
`; }).join('')} @@ -851,11 +826,36 @@ export function drawIndicatorsOnChart() { }); } +function resetIndicator(id) { + const indicator = activeIndicators.find(a => a.id === id); + if (!indicator) return; + + const IndicatorClass = IR[indicator.type]; + if (!IndicatorClass) return; + + const instance = new IndicatorClass({ type: indicator.type, params: {}, name: '' }); + const meta = instance.getMetadata(); + if (!meta || !meta.inputs) return; + + meta.inputs.forEach(input => { + indicator.params[input.name] = input.default; + }); + + renderIndicatorPanel(); + drawIndicatorsOnChart(); +} + +function removeIndicator(id) { + removeIndicatorById(id); +} + // Export functions for module access export { addIndicator, removeIndicatorById }; // Legacy compatibility functions window.renderIndicatorList = renderIndicatorPanel; +window.resetIndicator = resetIndicator; +window.removeIndicator = removeIndicator; window.toggleIndicator = addIndicator; window.showIndicatorConfig = function(id) { const ind = activeIndicators.find(a => a.id === id);