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,14 +55,18 @@
let metricUnits = {} let metricUnits = {}
$: if ($nodesQuery.data) { $: if ($nodesQuery.data) {
for (let metric of clusters.find(c => c.name == cluster).metricConfig) { let thisCluster = clusters.find(c => c.name == cluster)
if (metric.unit.prefix || metric.unit.base) { if (thisCluster) {
metricUnits[metric.name] = '(' + (metric.unit.prefix ? metric.unit.prefix : '') + (metric.unit.base ? metric.unit.base : '') + ')' for (let metric of thisCluster.metricConfig) {
} else { // If no unit defined: Omit Unit Display if (metric.unit.prefix || metric.unit.base) {
metricUnits[metric.name] = '' metricUnits[metric.name] = '(' + (metric.unit.prefix ? metric.unit.prefix : '') + (metric.unit.base ? metric.unit.base : '') + ')'
} else { // If no unit defined: Omit Unit Display
metricUnits[metric.name] = ''
}
} }
} }
} }
// $: console.log($nodesQuery?.data?.nodeMetrics[0].metrics) // $: console.log($nodesQuery?.data?.nodeMetrics[0].metrics)
</script> </script>
@ -98,7 +102,7 @@
let:width let:width
itemsPerRow={ccconfig.plot_view_plotsPerRow} itemsPerRow={ccconfig.plot_view_plotsPerRow}
items={$nodesQuery.data.nodeMetrics[0].metrics.sort((a, b) => a.name.localeCompare(b.name))}> 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 <MetricPlot
width={width} height={300} metric={item.name} timestep={item.metric.timestep} width={width} height={300} metric={item.name} timestep={item.metric.timestep}
cluster={clusters.find(c => c.name == cluster)} subCluster={$nodesQuery.data.nodeMetrics[0].subCluster} cluster={clusters.find(c => c.name == cluster)} subCluster={$nodesQuery.data.nodeMetrics[0].subCluster}

View File

@ -59,11 +59,13 @@
let metricUnits = {} let metricUnits = {}
$: if ($nodesQuery.data) { $: if ($nodesQuery.data) {
let thisCluster = clusters.find(c => c.name == cluster) let thisCluster = clusters.find(c => c.name == cluster)
for (let metric of thisCluster.metricConfig) { if (thisCluster) {
if (metric.unit.prefix || metric.unit.base) { for (let metric of thisCluster.metricConfig) {
metricUnits[metric.name] = '(' + (metric.unit.prefix ? metric.unit.prefix : '') + (metric.unit.base ? metric.unit.base : '') + ')' if (metric.unit.prefix || metric.unit.base) {
} else { // If no unit defined: Omit Unit Display metricUnits[metric.name] = '(' + (metric.unit.prefix ? metric.unit.prefix : '') + (metric.unit.base ? metric.unit.base : '') + ')'
metricUnits[metric.name] = '' } else { // If no unit defined: Omit Unit Display
metricUnits[metric.name] = ''
}
} }
} }
} }