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

View File

@ -13,6 +13,9 @@
--> -->
<script> <script>
import {
createEventDispatcher
} from "svelte";
import { import {
queryStore, queryStore,
gql, gql,
@ -46,6 +49,7 @@
let patternMatches = false; let patternMatches = false;
let statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null); let statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null);
const dispatch = createEventDispatcher();
const statsPattern = /(.*)-stat$/; const statsPattern = /(.*)-stat$/;
const unit = (metricUnit?.prefix ? metricUnit.prefix : "") + (metricUnit?.base ? metricUnit.base : ""); const unit = (metricUnit?.prefix ? metricUnit.prefix : "") + (metricUnit?.base ? metricUnit.base : "");
const resolutions = [600, 240, 60] // DEV: Make configable const resolutions = [600, 240, 60] // DEV: Make configable
@ -124,6 +128,11 @@
selectedScope = minScope(scopes) 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) patternMatches = statsPattern.exec(selectedScope)
if (!patternMatches) { if (!patternMatches) {

View File

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