From 11e94124ccd54d727a1c17129f747a3315184815 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 16 Dec 2025 15:43:57 +0100 Subject: [PATCH] improve handling and layout if missing data in dashboard --- web/frontend/src/DashPublic.root.svelte | 80 ++++++++++-------- .../src/generic/plots/Roofline.svelte | 2 +- web/frontend/src/generic/plots/Stacked.svelte | 6 +- web/frontend/src/status/DashInternal.svelte | 82 ++++++++++--------- 4 files changed, 92 insertions(+), 78 deletions(-) diff --git a/web/frontend/src/DashPublic.root.svelte b/web/frontend/src/DashPublic.root.svelte index 676e496..36e6703 100644 --- a/web/frontend/src/DashPublic.root.svelte +++ b/web/frontend/src/DashPublic.root.svelte @@ -509,44 +509,52 @@ - -
+ {#if refinedStateData.length > 0} + +
+ {#key refinedStateData} + sd.count, + )} + entities={refinedStateData.map( + (sd) => sd.state, + )} + fixColors={refinedStateData.map( + (sd) => colors['nodeStates'][sd.state], + )} + /> + {/key} +
+ + {#key refinedStateData} - sd.count, - )} - entities={refinedStateData.map( - (sd) => sd.state, - )} - fixColors={refinedStateData.map( - (sd) => colors['nodeStates'][sd.state], - )} - /> - {/key} -
- - - {#key refinedStateData} - - - - - - - {#each refinedStateData as sd, i} - - - - +
StateCount
{sd.state.charAt(0).toUpperCase() + sd.state.slice(1)}{sd.count}
+ + + + - {/each} -
StateCount
- {/key} - + {#each refinedStateData as sd, i} + + + {sd.state.charAt(0).toUpperCase() + sd.state.slice(1)} + {sd.count} + + {/each} + + {/key} + + {:else} + + Cannot render state status: No state data returned for Pie Chart + + {/if}
diff --git a/web/frontend/src/generic/plots/Roofline.svelte b/web/frontend/src/generic/plots/Roofline.svelte index 53aefee..7b7df31 100644 --- a/web/frontend/src/generic/plots/Roofline.svelte +++ b/web/frontend/src/generic/plots/Roofline.svelte @@ -997,5 +997,5 @@ {#if roofData != null}
{:else} - Cannot render roofline: No data! + Cannot render roofline: No data! {/if} diff --git a/web/frontend/src/generic/plots/Stacked.svelte b/web/frontend/src/generic/plots/Stacked.svelte index c9ec1d7..d4babb1 100644 --- a/web/frontend/src/generic/plots/Stacked.svelte +++ b/web/frontend/src/generic/plots/Stacked.svelte @@ -101,10 +101,10 @@ }; // Data Prep For uPlot - const sortedData = data.sort((a, b) => a.state.localeCompare(b.state)); + const sortedData = data?.sort((a, b) => a.state.localeCompare(b.state)) || []; const collectLabel = sortedData.map(d => d.state); // Align Data to Timesteps, Introduces 'undefied' as placeholder, reiterate and set those to 0 - const collectData = uPlot.join(sortedData.map(d => [d.times, d.counts])).map(d => d.map(i => i ? i : 0)); + const collectData = (sortedData.length > 0) ? uPlot.join(sortedData.map(d => [d.times, d.counts])).map(d => d.map(i => i ? i : 0)) : []; // STACKED CHART FUNCTIONS // function stack(data, omit) { @@ -344,7 +344,7 @@ -{#if data && collectData[0].length > 0} +{#if data && collectData.length > 0}
diff --git a/web/frontend/src/status/DashInternal.svelte b/web/frontend/src/status/DashInternal.svelte index c6abf06..47a841a 100644 --- a/web/frontend/src/status/DashInternal.svelte +++ b/web/frontend/src/status/DashInternal.svelte @@ -487,45 +487,51 @@ - - -
-

- Top Projects: Jobs -

- tp['totalJobs'], - )} - entities={$topJobsQuery.data.jobsStatistics.map((tp) => scrambleNames ? scramble(tp.id) : tp.id)} - /> -
- - - - - - - - - {#each $topJobsQuery.data.jobsStatistics as tp, i} - - - - + {#if topJobsQuery?.data?.jobsStatistics?.length > 0} + + +
+

+ Top Projects: Jobs +

+ tp['totalJobs'], + )} + entities={$topJobsQuery.data.jobsStatistics.map((tp) => scrambleNames ? scramble(tp.id) : tp.id)} + /> +
+ + +
ProjectJobs
- {scrambleNames ? scramble(tp.id) : tp.id} - - {tp['totalJobs']}
+ + + + - {/each} -
ProjectJobs
- -
+ {#each $topJobsQuery.data.jobsStatistics as tp, i} + + + + {scrambleNames ? scramble(tp.id) : tp.id} + + + {tp['totalJobs']} + + {/each} + + + + {:else} + Cannot render job status: No state data returned for Pie Chart + {/if}