apply updated rangefilter logic to energy and stats

This commit is contained in:
Christoph Kluge
2026-03-04 14:18:30 +01:00
parent 87425c0b09
commit db625239ea
8 changed files with 171 additions and 55 deletions

View File

@@ -341,26 +341,28 @@ export function getStatsItems(presetStats = []) {
if (gm?.footprint) {
const mc = getMetricConfigDeep(gm.name, null, null)
if (mc) {
const presetEntry = presetStats.find((s) => s?.field === (gm.name + '_' + gm.footprint))
const presetEntry = presetStats.find((s) => s.field == `${gm.name}_${gm.footprint}`)
if (presetEntry) {
return {
field: gm.name + '_' + gm.footprint,
text: gm.name + ' (' + gm.footprint + ')',
field: presetEntry.field,
text: `${gm.name} (${gm.footprint})`,
metric: gm.name,
from: presetEntry.from,
to: presetEntry.to,
to: (presetEntry.to == 0) ? mc.peak : presetEntry.to,
peak: mc.peak,
enabled: true
enabled: true,
unit: `${gm?.unit?.prefix ? gm.unit.prefix : ''}${gm.unit.base}`
}
} else {
return {
field: gm.name + '_' + gm.footprint,
text: gm.name + ' (' + gm.footprint + ')',
field: `${gm.name}_${gm.footprint}`,
text: `${gm.name} (${gm.footprint})`,
metric: gm.name,
from: 0,
from: 1,
to: mc.peak,
peak: mc.peak,
enabled: false
enabled: false,
unit: `${gm?.unit?.prefix ? gm.unit.prefix : ''}${gm.unit.base}`
}
}
}