load statusDetails GQL on tab change

This commit is contained in:
Christoph Kluge
2026-02-25 19:12:18 +01:00
parent 92236b1d1d
commit 0a0db36433
5 changed files with 56 additions and 49 deletions

View File

@@ -36,6 +36,9 @@
const { query: initq } = init(); const { query: initq } = init();
const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false
/* State Init */
let activeTab = $state("");
/* Derived */ /* Derived */
const subClusters = $derived($initq?.data?.clusters?.find((c) => c.name == presetCluster)?.subClusters || []); const subClusters = $derived($initq?.data?.clusters?.find((c) => c.name == presetCluster)?.subClusters || []);
</script> </script>
@@ -63,22 +66,22 @@
</Row> </Row>
{:else} {:else}
<Card class="overflow-auto" style="height: auto;"> <Card class="overflow-auto" style="height: auto;">
<TabContent> <TabContent on:tab={(e) => (activeTab = e.detail)}>
<TabPane tabId="status-dash" tab="Status" active> <TabPane tabId="status-dash" tab="Status" active>
<CardBody> <CardBody>
<StatusDash clusters={$initq.data.clusters} {presetCluster}></StatusDash> <StatusDash clusters={$initq.data.clusters} {presetCluster} loadMe={(activeTab === "status-dash")}></StatusDash>
</CardBody> </CardBody>
</TabPane> </TabPane>
<TabPane tabId="health-dash" tab="Metric Status"> <TabPane tabId="health-dash" tab="Metric Status">
<CardBody> <CardBody>
<HealthDash {presetCluster}></HealthDash> <HealthDash {presetCluster} loadMe={(activeTab === "health-dash")}></HealthDash>
</CardBody> </CardBody>
</TabPane> </TabPane>
<TabPane tabId="usage-dash" tab="Cluster Usage"> <TabPane tabId="usage-dash" tab="Cluster Usage">
<CardBody> <CardBody>
<UsageDash {presetCluster} {useCbColors}></UsageDash> <UsageDash {presetCluster} {useCbColors} loadMe={(activeTab === "usage-dash")}></UsageDash>
</CardBody> </CardBody>
</TabPane> </TabPane>
@@ -86,7 +89,7 @@
{#each subClusters.map(sc => sc.name) as scn} {#each subClusters.map(sc => sc.name) as scn}
<TabPane tabId="{scn}-usage-dash" tab="{scn.charAt(0).toUpperCase() + scn.slice(1)} Usage"> <TabPane tabId="{scn}-usage-dash" tab="{scn.charAt(0).toUpperCase() + scn.slice(1)} Usage">
<CardBody> <CardBody>
<UsageDash {presetCluster} presetSubCluster={scn} {useCbColors}></UsageDash> <UsageDash {presetCluster} presetSubCluster={scn} {useCbColors} loadMe={(activeTab === `${scn}-usage-dash`)}></UsageDash>
</CardBody> </CardBody>
</TabPane> </TabPane>
{/each} {/each}
@@ -94,7 +97,7 @@
<TabPane tabId="metric-dash" tab="Statistics"> <TabPane tabId="metric-dash" tab="Statistics">
<CardBody> <CardBody>
<StatisticsDash {presetCluster} {useCbColors}></StatisticsDash> <StatisticsDash {presetCluster} {useCbColors} loadMe={(activeTab === "metric-dash")}></StatisticsDash>
</CardBody> </CardBody>
</TabPane> </TabPane>
</TabContent> </TabContent>

View File

@@ -29,6 +29,7 @@
/* Svelte 5 Props */ /* Svelte 5 Props */
let { let {
presetCluster, presetCluster,
loadMe = false,
} = $props(); } = $props();
/* Const Init */ /* Const Init */
@@ -55,7 +56,7 @@
/* Derived */ /* Derived */
let cluster = $derived(presetCluster); let cluster = $derived(presetCluster);
const statusQuery = $derived(queryStore({ const statusQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -85,7 +86,7 @@
sorting: querySorting, sorting: querySorting,
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
let healthTableData = $derived.by(() => { let healthTableData = $derived.by(() => {
if ($statusQuery?.data) { if ($statusQuery?.data) {
@@ -161,16 +162,16 @@
<hr/> <hr/>
<!-- Node Health Pis, later Charts --> <!-- Node Health Pis, later Charts -->
{#if $statusQuery.fetching} {#if $statusQuery?.fetching}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Spinner /> <Spinner />
</Col> </Col>
</Row> </Row>
{:else if $statusQuery.error} {:else if $statusQuery?.error}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Card body color="danger">Status Query (States): {$statusQuery.error.message}</Card> <Card body color="danger">Status Query (States): {$statusQuery?.error?.message}</Card>
</Col> </Col>
</Row> </Row>
{:else if $statusQuery?.data?.nodeStates} {:else if $statusQuery?.data?.nodeStates}
@@ -264,19 +265,19 @@
<hr/> <hr/>
<!-- Tabular Info About Node States and Missing Metrics --> <!-- Tabular Info About Node States and Missing Metrics -->
{#if $statusQuery.fetching} {#if $statusQuery?.fetching}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Spinner /> <Spinner />
</Col> </Col>
</Row> </Row>
{:else if $statusQuery.error} {:else if $statusQuery?.error}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Card body color="danger">Status Query (Details): {$statusQuery.error.message}</Card> <Card body color="danger">Status Query (Details): {$statusQuery?.error?.message}</Card>
</Col> </Col>
</Row> </Row>
{:else if $statusQuery.data} {:else if $statusQuery?.data}
<Row> <Row>
<Col> <Col>
<Card> <Card>

View File

@@ -30,7 +30,8 @@
/* Svelte 5 Props */ /* Svelte 5 Props */
let { let {
presetCluster presetCluster,
loadMe = false,
} = $props(); } = $props();
/* Const Init */ /* Const Init */
@@ -49,7 +50,7 @@
: ccconfig['statusView_selectedHistograms'] || []); : ccconfig['statusView_selectedHistograms'] || []);
// Note: nodeMetrics are requested on configured $timestep resolution // Note: nodeMetrics are requested on configured $timestep resolution
const metricStatusQuery = $derived(queryStore({ const metricStatusQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -75,7 +76,7 @@
selectedHistograms: selectedHistograms selectedHistograms: selectedHistograms
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
</script> </script>
<!-- Loading indicators & Metric Sleect --> <!-- Loading indicators & Metric Sleect -->
@@ -100,18 +101,18 @@
</Row> </Row>
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
{#if $metricStatusQuery.fetching} {#if $metricStatusQuery?.fetching}
<Col> <Col>
<Spinner /> <Spinner />
</Col> </Col>
{:else if $metricStatusQuery.error} {:else if $metricStatusQuery?.error}
<Col> <Col>
<Card body color="danger">{$metricStatusQuery.error.message}</Card> <Card body color="danger">{$metricStatusQuery.error.message}</Card>
</Col> </Col>
{/if} {/if}
</Row> </Row>
{#if $metricStatusQuery.data} {#if $metricStatusQuery?.data}
<!-- Selectable Stats as Histograms : Average Values of Running Jobs --> <!-- Selectable Stats as Histograms : Average Values of Running Jobs -->
{#if selectedHistograms} {#if selectedHistograms}
<!-- Note: Ignore '#snippet' Error in IDE --> <!-- Note: Ignore '#snippet' Error in IDE -->

View File

@@ -32,6 +32,7 @@
let { let {
clusters, clusters,
presetCluster, presetCluster,
loadMe = false,
} = $props(); } = $props();
/* Const Init */ /* Const Init */
@@ -59,7 +60,7 @@
/* Derived */ /* Derived */
let cluster = $derived(presetCluster); let cluster = $derived(presetCluster);
// States for Stacked charts // States for Stacked charts
const statesTimed = $derived(queryStore({ const statesTimed = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ($filter: [NodeFilter!], $typeNode: String!, $typeHealth: String!) { query ($filter: [NodeFilter!], $typeNode: String!, $typeHealth: String!) {
@@ -81,11 +82,11 @@
typeHealth: "health" typeHealth: "health"
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
// Note: nodeMetrics are requested on configured $timestep resolution // Note: nodeMetrics are requested on configured $timestep resolution
// Result: The latest 5 minutes (datapoints) for each node independent of job // Result: The latest 5 minutes (datapoints) for each node independent of job
const statusQuery = $derived(queryStore({ const statusQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -184,11 +185,11 @@
sorting: { field: "startTime", type: "col", order: "DESC" } sorting: { field: "startTime", type: "col", order: "DESC" }
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
/* Effects */ /* Effects */
$effect(() => { $effect(() => {
if ($statusQuery.data) { if ($statusQuery?.data) {
let subClusters = clusters.find( let subClusters = clusters.find(
(c) => c.name == cluster, (c) => c.name == cluster,
).subClusters; ).subClusters;
@@ -374,19 +375,19 @@
<hr/> <hr/>
<!-- Node Stack Charts --> <!-- Node Stack Charts -->
{#if $statesTimed.fetching} {#if $statesTimed?.fetching}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Spinner /> <Spinner />
</Col> </Col>
</Row> </Row>
{:else if $statesTimed.error} {:else if $statesTimed?.error}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Card body color="danger">States Timed: {$statesTimed.error.message}</Card> <Card body color="danger">States Timed: {$statesTimed?.error?.message}</Card>
</Col> </Col>
</Row> </Row>
{:else if $statesTimed.data} {:else if $statesTimed?.data}
<Row cols={{ md: 2 , sm: 1}} class="mb-3 justify-content-center"> <Row cols={{ md: 2 , sm: 1}} class="mb-3 justify-content-center">
<Col class="px-3 mt-2 mt-lg-0"> <Col class="px-3 mt-2 mt-lg-0">
<div> <div>
@@ -427,19 +428,19 @@
<hr/> <hr/>
<!-- Gauges & Roofline per Subcluster--> <!-- Gauges & Roofline per Subcluster-->
{#if $statusQuery.fetching} {#if $statusQuery?.fetching}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Spinner /> <Spinner />
</Col> </Col>
</Row> </Row>
{:else if $statusQuery.error} {:else if $statusQuery?.error}
<Row cols={1} class="text-center mt-3"> <Row cols={1} class="text-center mt-3">
<Col> <Col>
<Card body color="danger">Status Query (Details): {$statusQuery.error.message}</Card> <Card body color="danger">Status Query (Details): {$statusQuery?.error?.message}</Card>
</Col> </Col>
</Row> </Row>
{:else if $statusQuery.data} {:else if $statusQuery?.data}
{#each clusters.find((c) => c.name == cluster).subClusters as subCluster, i} {#each clusters.find((c) => c.name == cluster).subClusters as subCluster, i}
<Row cols={{ lg: 3, md: 1 , sm: 1}} class="mb-3 justify-content-center"> <Row cols={{ lg: 3, md: 1 , sm: 1}} class="mb-3 justify-content-center">
<Col class="px-3"> <Col class="px-3">

View File

@@ -40,7 +40,8 @@
presetCluster, presetCluster,
presetSubCluster = null, presetSubCluster = null,
useCbColors = false, useCbColors = false,
useAltColors = false useAltColors = false,
loadMe = false,
} = $props(); } = $props();
/* Const Init */ /* Const Init */
@@ -62,7 +63,7 @@
? [{ state: ["running"] }, { cluster: { eq: presetCluster} }, { subCluster: { eq: presetSubCluster } }] ? [{ state: ["running"] }, { cluster: { eq: presetCluster} }, { subCluster: { eq: presetSubCluster } }]
: [{ state: ["running"] }, { cluster: { eq: presetCluster} }] : [{ state: ["running"] }, { cluster: { eq: presetCluster} }]
); );
const topJobsQuery = $derived(queryStore({ const topJobsQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -95,9 +96,9 @@
paging: pagingState // Top 10 paging: pagingState // Top 10
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
const topNodesQuery = $derived(queryStore({ const topNodesQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -130,9 +131,9 @@
paging: pagingState paging: pagingState
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
const topAccsQuery = $derived(queryStore({ const topAccsQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -165,10 +166,10 @@
paging: pagingState paging: pagingState
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }): null);
// Note: nodeMetrics are requested on configured $timestep resolution // Note: nodeMetrics are requested on configured $timestep resolution
const nodeStatusQuery = $derived(queryStore({ const nodeStatusQuery = $derived(loadMe ? queryStore({
client: client, client: client,
query: gql` query: gql`
query ( query (
@@ -198,7 +199,7 @@
numDurationBins: numDurationBins, numDurationBins: numDurationBins,
}, },
requestPolicy: "network-only" requestPolicy: "network-only"
})); }) : null);
/* Functions */ /* Functions */
function legendColors(targetIdx) { function legendColors(targetIdx) {
@@ -246,9 +247,9 @@
<hr/> <hr/>
<!-- Job Duration, Top Users and Projects--> <!-- Job Duration, Top Users and Projects-->
{#if $topJobsQuery.fetching || $nodeStatusQuery.fetching} {#if $topJobsQuery?.fetching || $nodeStatusQuery?.fetching}
<Spinner /> <Spinner />
{:else if $topJobsQuery.data && $nodeStatusQuery.data} {:else if $topJobsQuery?.data && $nodeStatusQuery?.data}
<Row> <Row>
<Col xs="12" lg="4" class="p-2"> <Col xs="12" lg="4" class="p-2">
{#key $nodeStatusQuery.data.jobsStatistics[0].histDuration} {#key $nodeStatusQuery.data.jobsStatistics[0].histDuration}
@@ -354,9 +355,9 @@
<hr/> <hr/>
<!-- Node Distribution, Top Users and Projects--> <!-- Node Distribution, Top Users and Projects-->
{#if $topNodesQuery.fetching || $nodeStatusQuery.fetching} {#if $topNodesQuery?.fetching || $nodeStatusQuery?.fetching}
<Spinner /> <Spinner />
{:else if $topNodesQuery.data && $nodeStatusQuery.data} {:else if $topNodesQuery?.data && $nodeStatusQuery?.data}
<Row> <Row>
<Col xs="12" lg="4" class="p-2"> <Col xs="12" lg="4" class="p-2">
<Histogram <Histogram
@@ -458,9 +459,9 @@
<hr/> <hr/>
<!-- Acc Distribution, Top Users and Projects--> <!-- Acc Distribution, Top Users and Projects-->
{#if $topAccsQuery.fetching || $nodeStatusQuery.fetching} {#if $topAccsQuery?.fetching || $nodeStatusQuery?.fetching}
<Spinner /> <Spinner />
{:else if $topAccsQuery.data && $nodeStatusQuery.data} {:else if $topAccsQuery?.data && $nodeStatusQuery?.data}
<Row> <Row>
<Col xs="12" lg="4" class="p-2"> <Col xs="12" lg="4" class="p-2">
<Histogram <Histogram