fix: add additionally loaded scopes to statsTable again

This commit is contained in:
Christoph Kluge 2024-08-23 13:26:56 +02:00
parent 01845a0cb7
commit 95fe369648
3 changed files with 18 additions and 1 deletions

View File

@ -348,6 +348,7 @@
{#if item.data}
<Metric
bind:this={plots[item.metric]}
on:more-loaded={({ detail }) => statsTable.moreLoaded(detail)}
job={$initq.data.job}
metricName={item.metric}
metricUnit={$initq.data.globalMetrics.find((gm) => gm.name == item.metric)?.unit}

View File

@ -13,6 +13,9 @@
-->
<script>
import {
createEventDispatcher
} from "svelte";
import {
queryStore,
gql,
@ -46,6 +49,7 @@
let patternMatches = false;
let statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null);
const dispatch = createEventDispatcher();
const statsPattern = /(.*)-stat$/;
const unit = (metricUnit?.prefix ? metricUnit.prefix : "") + (metricUnit?.base ? metricUnit.base : "");
const resolutions = [600, 240, 60] // DEV: Make configable
@ -117,13 +121,18 @@
rawData = $metricData.data.singleUpdate.map((x) => x.metric)
scopes = $metricData.data.singleUpdate.map((x) => x.scope)
statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null)
statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null)
// Set selected scope to min of returned scopes
if (selectedScope == "load-all") {
selectedScope = minScope(scopes)
}
const statsTableData = $metricData.data.singleUpdate.filter((x) => x.scope !== "node")
if (statsTableData.length > 0) {
dispatch("more-loaded", statsTableData);
}
patternMatches = statsPattern.exec(selectedScope)
if (!patternMatches) {

View File

@ -4,6 +4,9 @@
Properties:
- `job Object`: The job object
- `jobMetrics [Object]`: The jobs metricdata
Exported:
- `moreLoaded`: Adds additional scopes requested from Metric.svelte in Job-View
-->
<script>
@ -82,6 +85,10 @@
return s.dir != "up" ? s1[stat] - s2[stat] : s2[stat] - s1[stat];
});
}
export function moreLoaded(moreJobMetrics) {
jobMetrics = [...jobMetrics, ...moreJobMetrics]
}
</script>
<Table>