Fix unit load blocking systems and node views

This commit is contained in:
Christoph Kluge 2023-06-14 15:32:35 +02:00
parent 5e8b687992
commit 16d5fa182c
2 changed files with 17 additions and 11 deletions

View File

@ -55,7 +55,9 @@
let metricUnits = {}
$: if ($nodesQuery.data) {
for (let metric of clusters.find(c => c.name == cluster).metricConfig) {
let thisCluster = clusters.find(c => c.name == cluster)
if (thisCluster) {
for (let metric of thisCluster.metricConfig) {
if (metric.unit.prefix || metric.unit.base) {
metricUnits[metric.name] = '(' + (metric.unit.prefix ? metric.unit.prefix : '') + (metric.unit.base ? metric.unit.base : '') + ')'
} else { // If no unit defined: Omit Unit Display
@ -63,6 +65,8 @@
}
}
}
}
// $: console.log($nodesQuery?.data?.nodeMetrics[0].metrics)
</script>
@ -98,7 +102,7 @@
let:width
itemsPerRow={ccconfig.plot_view_plotsPerRow}
items={$nodesQuery.data.nodeMetrics[0].metrics.sort((a, b) => a.name.localeCompare(b.name))}>
<h4 style="text-align: center;">{item.name} {metricUnits[item.name]}</h4>
<h4 style="text-align: center; padding-top:15px;">{item.name} {metricUnits[item.name]}</h4>
<MetricPlot
width={width} height={300} metric={item.name} timestep={item.metric.timestep}
cluster={clusters.find(c => c.name == cluster)} subCluster={$nodesQuery.data.nodeMetrics[0].subCluster}

View File

@ -59,6 +59,7 @@
let metricUnits = {}
$: if ($nodesQuery.data) {
let thisCluster = clusters.find(c => c.name == cluster)
if (thisCluster) {
for (let metric of thisCluster.metricConfig) {
if (metric.unit.prefix || metric.unit.base) {
metricUnits[metric.name] = '(' + (metric.unit.prefix ? metric.unit.prefix : '') + (metric.unit.base ? metric.unit.base : '') + ')'
@ -67,6 +68,7 @@
}
}
}
}
</script>