fix: prevent addition of existing scopes to table

This commit is contained in:
Christoph Kluge 2024-09-03 14:16:16 +02:00
parent 4b1b34d8a7
commit 193bee5ac8

View File

@ -25,8 +25,8 @@
export let job; export let job;
export let jobMetrics; export let jobMetrics;
const allMetrics = [...new Set(jobMetrics.map((m) => m.name))].sort(), const allMetrics = [...new Set(jobMetrics.map((m) => m.name))].sort()
scopesForMetric = (metric) => const scopesForMetric = (metric) =>
jobMetrics.filter((jm) => jm.name == metric).map((jm) => jm.scope); jobMetrics.filter((jm) => jm.name == metric).map((jm) => jm.scope);
let hosts = job.resources.map((r) => r.hostname).sort(), let hosts = job.resources.map((r) => r.hostname).sort(),
@ -87,8 +87,12 @@
} }
export function moreLoaded(moreJobMetrics) { export function moreLoaded(moreJobMetrics) {
jobMetrics = [...jobMetrics, ...moreJobMetrics] moreJobMetrics.forEach(function (newMetric) {
if (!jobMetrics.some((m) => m.scope == newMetric.scope)) {
jobMetrics = [...jobMetrics, newMetric]
} }
});
};
</script> </script>
<Table> <Table>