Skip to content

Commit

Permalink
fix: fix plot labeling if specific host selected, hide loadall if onl…
Browse files Browse the repository at this point in the history
…y node returned
  • Loading branch information
spacehamster87 committed Aug 23, 2024
1 parent adc3502 commit 9fe7cdc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions web/frontend/src/job/Metric.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
let pendingResolution = 600;
let selectedScopeIndex = scopes.findIndex((s) => s == minScope(scopes));
let patternMatches = false;
let nodeOnly = false; // If, after load-all, still only node scope returned
let statsSeries = rawData.map((data) => data?.statisticsSeries ? data.statisticsSeries : null);
const dispatch = createEventDispatcher();
Expand Down Expand Up @@ -126,6 +127,7 @@
// Set selected scope to min of returned scopes
if (selectedScope == "load-all") {
selectedScope = minScope(scopes)
nodeOnly = (selectedScope == "node") // "node" still only scope after load-all
}
const statsTableData = $metricData.data.singleUpdate.filter((x) => x.scope !== "node")
Expand All @@ -146,9 +148,14 @@
$: data = rawData[selectedScopeIndex];
$: series = data?.series.filter(
$: series = data?.series?.filter(
(series) => selectedHost == null || series.hostname == selectedHost,
);
$: resources = job?.resources?.filter(
(resource) => selectedHost == null || resource.hostname == selectedHost,
);
</script>
<InputGroup>
Expand All @@ -162,7 +169,7 @@
<option value={scope + '-stat'}>stats series ({scope})</option>
{/if}
{/each}
{#if scopes.length == 1 && nativeScope != "node"}
{#if scopes.length == 1 && nativeScope != "node" && !nodeOnly}
<option value={"load-all"}>Load all...</option>
{/if}
</select>
Expand Down Expand Up @@ -197,7 +204,7 @@
metric={metricName}
{series}
{isShared}
resources={job.resources}
{resources}
/>
{:else if statsSeries[selectedScopeIndex] != null && patternMatches}
<Timeseries
Expand All @@ -211,7 +218,6 @@
metric={metricName}
{series}
{isShared}
resources={job.resources}
statisticsSeries={statsSeries[selectedScopeIndex]}
useStatsSeries={!!statsSeries[selectedScopeIndex]}
/>
Expand Down

0 comments on commit 9fe7cdc

Please sign in to comment.