From 0a0db36433ea18ea0d3c4ddcf3d88fda3b566aa1 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Wed, 25 Feb 2026 19:12:18 +0100 Subject: [PATCH] load statusDetails GQL on tab change --- web/frontend/src/status/DashDetails.svelte | 15 +++++---- .../src/status/dashdetails/HealthDash.svelte | 19 ++++++------ .../status/dashdetails/StatisticsDash.svelte | 13 ++++---- .../src/status/dashdetails/StatusDash.svelte | 27 ++++++++-------- .../src/status/dashdetails/UsageDash.svelte | 31 ++++++++++--------- 5 files changed, 56 insertions(+), 49 deletions(-) diff --git a/web/frontend/src/status/DashDetails.svelte b/web/frontend/src/status/DashDetails.svelte index b46d0935..72c411b2 100644 --- a/web/frontend/src/status/DashDetails.svelte +++ b/web/frontend/src/status/DashDetails.svelte @@ -36,6 +36,9 @@ const { query: initq } = init(); const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false + /* State Init */ + let activeTab = $state(""); + /* Derived */ const subClusters = $derived($initq?.data?.clusters?.find((c) => c.name == presetCluster)?.subClusters || []); @@ -63,22 +66,22 @@ {:else} - + (activeTab = e.detail)}> - + - + - + @@ -86,7 +89,7 @@ {#each subClusters.map(sc => sc.name) as scn} - + {/each} @@ -94,7 +97,7 @@ - + diff --git a/web/frontend/src/status/dashdetails/HealthDash.svelte b/web/frontend/src/status/dashdetails/HealthDash.svelte index aa6539ae..a30552b1 100644 --- a/web/frontend/src/status/dashdetails/HealthDash.svelte +++ b/web/frontend/src/status/dashdetails/HealthDash.svelte @@ -29,6 +29,7 @@ /* Svelte 5 Props */ let { presetCluster, + loadMe = false, } = $props(); /* Const Init */ @@ -55,7 +56,7 @@ /* Derived */ let cluster = $derived(presetCluster); - const statusQuery = $derived(queryStore({ + const statusQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -85,7 +86,7 @@ sorting: querySorting, }, requestPolicy: "network-only" - })); + }) : null); let healthTableData = $derived.by(() => { if ($statusQuery?.data) { @@ -161,16 +162,16 @@
-{#if $statusQuery.fetching} +{#if $statusQuery?.fetching} -{:else if $statusQuery.error} +{:else if $statusQuery?.error} - Status Query (States): {$statusQuery.error.message} + Status Query (States): {$statusQuery?.error?.message} {:else if $statusQuery?.data?.nodeStates} @@ -264,19 +265,19 @@
-{#if $statusQuery.fetching} +{#if $statusQuery?.fetching} -{:else if $statusQuery.error} +{:else if $statusQuery?.error} - Status Query (Details): {$statusQuery.error.message} + Status Query (Details): {$statusQuery?.error?.message} -{:else if $statusQuery.data} +{:else if $statusQuery?.data} diff --git a/web/frontend/src/status/dashdetails/StatisticsDash.svelte b/web/frontend/src/status/dashdetails/StatisticsDash.svelte index 2cf8621e..d83adc15 100644 --- a/web/frontend/src/status/dashdetails/StatisticsDash.svelte +++ b/web/frontend/src/status/dashdetails/StatisticsDash.svelte @@ -30,7 +30,8 @@ /* Svelte 5 Props */ let { - presetCluster + presetCluster, + loadMe = false, } = $props(); /* Const Init */ @@ -49,7 +50,7 @@ : ccconfig['statusView_selectedHistograms'] || []); // Note: nodeMetrics are requested on configured $timestep resolution - const metricStatusQuery = $derived(queryStore({ + const metricStatusQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -75,7 +76,7 @@ selectedHistograms: selectedHistograms }, requestPolicy: "network-only" - })); + }) : null); @@ -100,18 +101,18 @@ - {#if $metricStatusQuery.fetching} + {#if $metricStatusQuery?.fetching} - {:else if $metricStatusQuery.error} + {:else if $metricStatusQuery?.error} {$metricStatusQuery.error.message} {/if} -{#if $metricStatusQuery.data} +{#if $metricStatusQuery?.data} {#if selectedHistograms} diff --git a/web/frontend/src/status/dashdetails/StatusDash.svelte b/web/frontend/src/status/dashdetails/StatusDash.svelte index 8d108964..0c2626d0 100644 --- a/web/frontend/src/status/dashdetails/StatusDash.svelte +++ b/web/frontend/src/status/dashdetails/StatusDash.svelte @@ -32,6 +32,7 @@ let { clusters, presetCluster, + loadMe = false, } = $props(); /* Const Init */ @@ -59,7 +60,7 @@ /* Derived */ let cluster = $derived(presetCluster); // States for Stacked charts - const statesTimed = $derived(queryStore({ + const statesTimed = $derived(loadMe ? queryStore({ client: client, query: gql` query ($filter: [NodeFilter!], $typeNode: String!, $typeHealth: String!) { @@ -81,11 +82,11 @@ typeHealth: "health" }, requestPolicy: "network-only" - })); + }) : null); // Note: nodeMetrics are requested on configured $timestep resolution // Result: The latest 5 minutes (datapoints) for each node independent of job - const statusQuery = $derived(queryStore({ + const statusQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -184,11 +185,11 @@ sorting: { field: "startTime", type: "col", order: "DESC" } }, requestPolicy: "network-only" - })); + }) : null); /* Effects */ $effect(() => { - if ($statusQuery.data) { + if ($statusQuery?.data) { let subClusters = clusters.find( (c) => c.name == cluster, ).subClusters; @@ -374,19 +375,19 @@
-{#if $statesTimed.fetching} +{#if $statesTimed?.fetching} -{:else if $statesTimed.error} +{:else if $statesTimed?.error} - States Timed: {$statesTimed.error.message} + States Timed: {$statesTimed?.error?.message} -{:else if $statesTimed.data} +{:else if $statesTimed?.data}
@@ -427,19 +428,19 @@
-{#if $statusQuery.fetching} +{#if $statusQuery?.fetching} -{:else if $statusQuery.error} +{:else if $statusQuery?.error} - Status Query (Details): {$statusQuery.error.message} + Status Query (Details): {$statusQuery?.error?.message} -{:else if $statusQuery.data} +{:else if $statusQuery?.data} {#each clusters.find((c) => c.name == cluster).subClusters as subCluster, i} diff --git a/web/frontend/src/status/dashdetails/UsageDash.svelte b/web/frontend/src/status/dashdetails/UsageDash.svelte index 3fa197ae..2a9b3037 100644 --- a/web/frontend/src/status/dashdetails/UsageDash.svelte +++ b/web/frontend/src/status/dashdetails/UsageDash.svelte @@ -40,7 +40,8 @@ presetCluster, presetSubCluster = null, useCbColors = false, - useAltColors = false + useAltColors = false, + loadMe = false, } = $props(); /* Const Init */ @@ -62,7 +63,7 @@ ? [{ state: ["running"] }, { cluster: { eq: presetCluster} }, { subCluster: { eq: presetSubCluster } }] : [{ state: ["running"] }, { cluster: { eq: presetCluster} }] ); - const topJobsQuery = $derived(queryStore({ + const topJobsQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -95,9 +96,9 @@ paging: pagingState // Top 10 }, requestPolicy: "network-only" - })); + }) : null); - const topNodesQuery = $derived(queryStore({ + const topNodesQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -130,9 +131,9 @@ paging: pagingState }, requestPolicy: "network-only" - })); + }) : null); - const topAccsQuery = $derived(queryStore({ + const topAccsQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -165,10 +166,10 @@ paging: pagingState }, requestPolicy: "network-only" - })); + }): null); // Note: nodeMetrics are requested on configured $timestep resolution - const nodeStatusQuery = $derived(queryStore({ + const nodeStatusQuery = $derived(loadMe ? queryStore({ client: client, query: gql` query ( @@ -198,7 +199,7 @@ numDurationBins: numDurationBins, }, requestPolicy: "network-only" - })); + }) : null); /* Functions */ function legendColors(targetIdx) { @@ -246,9 +247,9 @@
-{#if $topJobsQuery.fetching || $nodeStatusQuery.fetching} +{#if $topJobsQuery?.fetching || $nodeStatusQuery?.fetching} -{:else if $topJobsQuery.data && $nodeStatusQuery.data} +{:else if $topJobsQuery?.data && $nodeStatusQuery?.data} {#key $nodeStatusQuery.data.jobsStatistics[0].histDuration} @@ -354,9 +355,9 @@
-{#if $topNodesQuery.fetching || $nodeStatusQuery.fetching} +{#if $topNodesQuery?.fetching || $nodeStatusQuery?.fetching} -{:else if $topNodesQuery.data && $nodeStatusQuery.data} +{:else if $topNodesQuery?.data && $nodeStatusQuery?.data} -{#if $topAccsQuery.fetching || $nodeStatusQuery.fetching} +{#if $topAccsQuery?.fetching || $nodeStatusQuery?.fetching} -{:else if $topAccsQuery.data && $nodeStatusQuery.data} +{:else if $topAccsQuery?.data && $nodeStatusQuery?.data}