From 193bee5ac8f4718bc42de4efe63d68a7eb5a9842 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 3 Sep 2024 14:16:16 +0200 Subject: [PATCH] fix: prevent addition of existing scopes to table --- web/frontend/src/job/StatsTable.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/frontend/src/job/StatsTable.svelte b/web/frontend/src/job/StatsTable.svelte index e6a03e3..aa5aa5f 100644 --- a/web/frontend/src/job/StatsTable.svelte +++ b/web/frontend/src/job/StatsTable.svelte @@ -25,8 +25,8 @@ export let job; export let jobMetrics; - const allMetrics = [...new Set(jobMetrics.map((m) => m.name))].sort(), - scopesForMetric = (metric) => + const allMetrics = [...new Set(jobMetrics.map((m) => m.name))].sort() + const scopesForMetric = (metric) => jobMetrics.filter((jm) => jm.name == metric).map((jm) => jm.scope); let hosts = job.resources.map((r) => r.hostname).sort(), @@ -87,8 +87,12 @@ } export function moreLoaded(moreJobMetrics) { - jobMetrics = [...jobMetrics, ...moreJobMetrics] - } + moreJobMetrics.forEach(function (newMetric) { + if (!jobMetrics.some((m) => m.scope == newMetric.scope)) { + jobMetrics = [...jobMetrics, newMetric] + } + }); + };