From 4cfe52e7c9e94f03839ed849aae1231775e2599e Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Fri, 16 Jun 2023 15:09:23 +0200 Subject: [PATCH 1/2] Add warning card if no data to plot - series.data array empty, but toplevel data return itself OK --- web/frontend/src/joblist/Row.svelte | 2 +- web/frontend/src/plots/MetricPlot.svelte | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/web/frontend/src/joblist/Row.svelte b/web/frontend/src/joblist/Row.svelte index 7540fc5..b4375bc 100644 --- a/web/frontend/src/joblist/Row.svelte +++ b/web/frontend/src/joblist/Row.svelte @@ -181,7 +181,7 @@ >Metric disabled for subcluster '{job.subCluster}' {:else} - Missing Data + Missing Full Dataset {/if} {/each} diff --git a/web/frontend/src/plots/MetricPlot.svelte b/web/frontend/src/plots/MetricPlot.svelte index db0a052..f559859 100644 --- a/web/frontend/src/plots/MetricPlot.svelte +++ b/web/frontend/src/plots/MetricPlot.svelte @@ -24,6 +24,7 @@ import uPlot from 'uplot' import { formatNumber } from '../units.js' import { getContext, onMount, onDestroy } from 'svelte' + import { Card } from 'sveltestrap' export let width export let height @@ -219,11 +220,15 @@ }, resizeSleepTime) } - $: onSizeChange(width, height) + $: if (series[0].data.length > 0) { + onSizeChange(width, height) + } onMount(() => { - plotWrapper.style.backgroundColor = backgroundColor() - render() + if (series[0].data.length > 0) { + plotWrapper.style.backgroundColor = backgroundColor() + render() + } }) onDestroy(() => { @@ -312,9 +317,11 @@ - -
- +{#if series[0].data.length > 0} +
+{:else} + Cannot render plot: No series data found for {metric} +{/if}