From 3dfeabcec65cd1fa20a1ac5c1fe12c29e0dd8903 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Wed, 16 Oct 2024 12:41:15 +0200 Subject: [PATCH] simplify plotGrid, add cancel to metricSelect, improve metricPlot render logic --- web/frontend/src/Analysis.root.svelte | 2 - web/frontend/src/Job.root.svelte | 1 - web/frontend/src/Node.root.svelte | 1 - web/frontend/src/Status.root.svelte | 1 - web/frontend/src/Systems.root.svelte | 9 ++- web/frontend/src/User.root.svelte | 1 - web/frontend/src/generic/PlotGrid.svelte | 45 ++--------- .../src/generic/plots/MetricPlot.svelte | 44 +++++------ .../src/generic/select/MetricSelection.svelte | 1 + web/frontend/src/systems/NodeList.svelte | 4 +- web/frontend/src/systems/NodeOverview.svelte | 75 ++++++++----------- .../src/systems/nodelist/NodeInfo.svelte | 20 ++--- .../src/systems/nodelist/NodeListRow.svelte | 40 ++++------ 13 files changed, 90 insertions(+), 154 deletions(-) diff --git a/web/frontend/src/Analysis.root.svelte b/web/frontend/src/Analysis.root.svelte index d287cf3..c6dc424 100644 --- a/web/frontend/src/Analysis.root.svelte +++ b/web/frontend/src/Analysis.root.svelte @@ -519,7 +519,6 @@ ({ metric, ...binsFromFootprint( @@ -563,7 +562,6 @@ ({ m1, f1: $footprintsQuery.data.footprints.metrics.find( diff --git a/web/frontend/src/Job.root.svelte b/web/frontend/src/Job.root.svelte index bb48479..04e9cf9 100644 --- a/web/frontend/src/Job.root.svelte +++ b/web/frontend/src/Job.root.svelte @@ -351,7 +351,6 @@ {:else if $initq?.data && $jobMetrics?.data?.jobMetrics} ({ diff --git a/web/frontend/src/Status.root.svelte b/web/frontend/src/Status.root.svelte index e49d11a..65d3091 100644 --- a/web/frontend/src/Status.root.svelte +++ b/web/frontend/src/Status.root.svelte @@ -645,7 +645,6 @@ {#key $mainQuery.data.stats[0].histMetrics} diff --git a/web/frontend/src/Systems.root.svelte b/web/frontend/src/Systems.root.svelte index f2ef4ea..e1da89f 100644 --- a/web/frontend/src/Systems.root.svelte +++ b/web/frontend/src/Systems.root.svelte @@ -45,7 +45,7 @@ if (from == null || to == null) { to = new Date(Date.now()); from = new Date(to.getTime()); - from.setHours(from.getHours() - 4); + from.setHours(from.getHours() - 2); } const initialized = getContext("initialized"); @@ -61,6 +61,7 @@ // Todo: Add Idle State Filter (== No allocated Jobs) // Todo: NodeList: Mindestens Accelerator Scope ... "Show Detail" Switch? // Todo: Review performance // observed high client-side load frequency + // Is Svelte {#each} -> -> onMount() related : Cannot be skipped ... const client = getContextClient(); const nodeQuery = gql` @@ -245,13 +246,13 @@ -{:else if $initialized && $nodesQuery?.data} +{:else if filteredData?.length > 0} {#if displayNodeOverview} - + {:else} - + {/if} {/if} diff --git a/web/frontend/src/User.root.svelte b/web/frontend/src/User.root.svelte index 57f2f28..1d911ba 100644 --- a/web/frontend/src/User.root.svelte +++ b/web/frontend/src/User.root.svelte @@ -267,7 +267,6 @@ {#key $stats.data.jobsStatistics[0].histMetrics} diff --git a/web/frontend/src/generic/PlotGrid.svelte b/web/frontend/src/generic/PlotGrid.svelte index a56ffef..5152e0d 100644 --- a/web/frontend/src/generic/PlotGrid.svelte +++ b/web/frontend/src/generic/PlotGrid.svelte @@ -4,7 +4,6 @@ Properties: - `itemsPerRow Number`: Elements to render per row - `items [Any]`: List of plot components to render - - `renderFor String`: If 'job', filter disabled metrics --> -{#each rows as row} - - {#each row as item (item)} - - {#if !isPlaceholder(item)} - - {/if} - - {/each} - -{/each} + + {#each items as item} + + + + {/each} + diff --git a/web/frontend/src/generic/plots/MetricPlot.svelte b/web/frontend/src/generic/plots/MetricPlot.svelte index bf3dd45..d3af6f9 100644 --- a/web/frontend/src/generic/plots/MetricPlot.svelte +++ b/web/frontend/src/generic/plots/MetricPlot.svelte @@ -11,7 +11,7 @@ - `series [GraphQL.Series]`: The metric data object - `useStatsSeries Bool?`: If this plot uses the statistics Min/Max/Median representation; automatically set to according bool [Default: null] - `statisticsSeries [GraphQL.StatisticsSeries]?`: Min/Max/Median representation of metric data [Default: null] - - `cluster GraphQL.Cluster`: Cluster Object of the parent job + - `cluster String`: Cluster name of the parent job / data - `subCluster String`: Name of the subCluster of the parent job - `isShared Bool?`: If this job used shared resources; will adapt threshold indicators accordingly [Default: false] - `forNode Bool?`: If this plot is used for node data display; will ren[data, err := metricdata.LoadNodeData(cluster, metrics, nodes, scopes, from, to, ctx)](https://github.com/ClusterCockpit/cc-backend/blob/9fe7cdca9215220a19930779a60c8afc910276a3/internal/graph/schema.resolvers.go#L391-L392)der x-axis as negative time with $now as maximum [Default: false] @@ -117,13 +117,13 @@ export let metric; export let scope = "node"; - export let width = null; + export let width = 0; export let height = 300; export let timestep; export let series; export let useStatsSeries = null; export let statisticsSeries = null; - export let cluster; + export let cluster = ""; export let subCluster; export let isShared = false; export let forNode = false; @@ -522,17 +522,9 @@ } onMount(() => { - // Setup Wrapper - if (series[0].data.length > 0) { - if (forNode) { - plotWrapper.style.paddingTop = "0.5rem" - plotWrapper.style.paddingBottom = "0.5rem" - } - plotWrapper.style.backgroundColor = backgroundColor(); - plotWrapper.style.borderRadius = "5px"; + if (plotWrapper) { + render(width, height); } - // Init Plot - render(width, height); }); onDestroy(() => { @@ -540,22 +532,20 @@ if (uplot) uplot.destroy(); }); - // This updates it on all size changes - // Condition for reactive triggering (eg scope change) - $: if (series[0].data.length > 0) { + // This updates plot on all size changes if wrapper (== data) exists + $: if (plotWrapper) { onSizeChange(width, height); } - -
- {#if series[0].data.length > 0} -
- {:else} - Cannot render plot: No series data returned for {metric} - {/if} -
- + +{#if series[0].data.length > 0} +
+{:else} + Cannot render plot: No series data returned for {metric} +{/if} diff --git a/web/frontend/src/generic/select/MetricSelection.svelte b/web/frontend/src/generic/select/MetricSelection.svelte index b65b407..71b42b8 100644 --- a/web/frontend/src/generic/select/MetricSelection.svelte +++ b/web/frontend/src/generic/select/MetricSelection.svelte @@ -178,6 +178,7 @@ + diff --git a/web/frontend/src/systems/NodeList.svelte b/web/frontend/src/systems/NodeList.svelte index 54f7530..b8eacdf 100644 --- a/web/frontend/src/systems/NodeList.svelte +++ b/web/frontend/src/systems/NodeList.svelte @@ -36,7 +36,7 @@ {cluster} Node Info @@ -53,7 +53,7 @@ - {#each data as nodeData (nodeData)} + {#each data as nodeData (nodeData.host)} {:else} diff --git a/web/frontend/src/systems/NodeOverview.svelte b/web/frontend/src/systems/NodeOverview.svelte index 7ad711d..9e02f10 100644 --- a/web/frontend/src/systems/NodeOverview.svelte +++ b/web/frontend/src/systems/NodeOverview.svelte @@ -9,9 +9,7 @@ --> - -

- {item.host} ({item.subCluster}) -

- {#if item?.data[0]} - {#if item?.disabled[selectedMetric]} - Metric disabled for subcluster {selectedMetric}:{item.subCluster} - {:else} - c.name == cluster)} - subCluster={item.subCluster} - forNode={true} - /> - {/if} - {:else} - No dataset returned for {selectedMetric} - {/if} -
+ + + {#each data as item (item.host)} + +

+ {item.host} ({item.subCluster}) +

+ {#if item?.disabled[selectedMetric]} + Metric disabled for subcluster {selectedMetric}:{item.subCluster} + {:else} + + + {/if} + + {/each} +
\ No newline at end of file diff --git a/web/frontend/src/systems/nodelist/NodeInfo.svelte b/web/frontend/src/systems/nodelist/NodeInfo.svelte index 2a40c7a..d0ea2b9 100644 --- a/web/frontend/src/systems/nodelist/NodeInfo.svelte +++ b/web/frontend/src/systems/nodelist/NodeInfo.svelte @@ -56,7 +56,7 @@ - +
@@ -106,7 +106,7 @@

{#if $nodeJobsData.data.jobs.count > 0} - + @@ -116,11 +116,11 @@ - Show List + List {:else} - + @@ -132,30 +132,30 @@ {/if}

- + - Users on Node + Show Users on Node - Show List + List

- + - Projects on Node + Show Projects on Node - Show List + List

diff --git a/web/frontend/src/systems/nodelist/NodeListRow.svelte b/web/frontend/src/systems/nodelist/NodeListRow.svelte index 5e9a31b..a510b0e 100644 --- a/web/frontend/src/systems/nodelist/NodeListRow.svelte +++ b/web/frontend/src/systems/nodelist/NodeListRow.svelte @@ -24,32 +24,24 @@ - {#each sortOrder(nodeData?.data) as metricData} + {#each sortOrder(nodeData?.data) as metricData (metricData.name)} - {#if metricData} - {#if nodeData?.disabled[metricData.name]} - Metric disabled for subcluster {metricData.name}:{nodeData.subCluster} - {:else} - - {/if} - {:else} - No dataset returned for {metricData.name}Metric disabled for subcluster {metricData.name}:{nodeData.subCluster} + {:else} + + {/if} {/each}