From cdd25eaa15fdca6009f945bd1f3db3b5168edf82 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 13 Jun 2023 16:42:32 +0200 Subject: [PATCH] Fix job view scope dropdown data load --- web/frontend/src/Metric.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/frontend/src/Metric.svelte b/web/frontend/src/Metric.svelte index ad691ca..cf82a3e 100644 --- a/web/frontend/src/Metric.svelte +++ b/web/frontend/src/Metric.svelte @@ -18,9 +18,9 @@ let selectedHost = null, plot, fetching = false, error = null let selectedScope = minScope(scopes) - let selectedScopeIndex = scopes.findIndex(s => s == selectedScope) - $: avaliableScopes = scopes + $: availableScopes = scopes + $: selectedScopeIndex = scopes.findIndex(s => s == selectedScope) $: data = rawData[selectedScopeIndex] $: series = data?.series.filter(series => selectedHost == null || series.hostname == selectedHost) @@ -43,11 +43,11 @@ for (let jm of response.data.jobMetrics) { if (jm.scope != "node") { - scopes.push(jm.metric) + scopes = [...scopes, jm.scope] + rawData.push(jm.metric) selectedScope = jm.scope + selectedScopeIndex = scopes.findIndex(s => s == jm.scope) dispatch('more-loaded', jm) - if (!avaliableScopes.includes(selectedScope)) - avaliableScopes = [...avaliableScopes, selectedScope] } } } @@ -59,11 +59,11 @@ {metricName} ({(metricConfig?.unit?.prefix ? metricConfig.unit.prefix : '') + (metricConfig?.unit?.base ? metricConfig.unit.base : '')}) - + {#each availableScopes as scope} {/each} - {#if avaliableScopes.length == 1 && metricConfig?.scope != "node"} + {#if availableScopes.length == 1 && metricConfig?.scope != "node"} {/if}