From 16d5fa182ce108d9b9279d7f79d2692653dcaf1d Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Wed, 14 Jun 2023 15:32:35 +0200 Subject: [PATCH] Fix unit load blocking systems and node views --- web/frontend/src/Node.root.svelte | 16 ++++++++++------ web/frontend/src/Systems.root.svelte | 12 +++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/web/frontend/src/Node.root.svelte b/web/frontend/src/Node.root.svelte index 25e3b77..a805e67 100644 --- a/web/frontend/src/Node.root.svelte +++ b/web/frontend/src/Node.root.svelte @@ -55,14 +55,18 @@ let metricUnits = {} $: if ($nodesQuery.data) { - for (let metric of clusters.find(c => c.name == cluster).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 - metricUnits[metric.name] = '' + 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 + metricUnits[metric.name] = '' + } } } } + // $: console.log($nodesQuery?.data?.nodeMetrics[0].metrics) @@ -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))}> -

{item.name} {metricUnits[item.name]}

+

{item.name} {metricUnits[item.name]}

c.name == cluster)} subCluster={$nodesQuery.data.nodeMetrics[0].subCluster} diff --git a/web/frontend/src/Systems.root.svelte b/web/frontend/src/Systems.root.svelte index f5c5c09..56620a1 100644 --- a/web/frontend/src/Systems.root.svelte +++ b/web/frontend/src/Systems.root.svelte @@ -59,11 +59,13 @@ let metricUnits = {} $: if ($nodesQuery.data) { let thisCluster = clusters.find(c => c.name == cluster) - 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 - metricUnits[metric.name] = '' + 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 + metricUnits[metric.name] = '' + } } } }