fix: user and status view histogram selection

- correctly loads selection for selected cluster
- applies availablility for selected cluster
This commit is contained in:
Christoph Kluge 2025-02-28 13:06:40 +01:00
parent 6268dffff8
commit 1031b3eb79
3 changed files with 19 additions and 11 deletions

View File

@ -76,8 +76,8 @@
let isHistogramSelectionOpen = false; let isHistogramSelectionOpen = false;
$: metricsInHistograms = cluster $: metricsInHistograms = cluster
? ccconfig[`user_view_histogramMetrics:${cluster}`] || [] ? ccconfig[`user_view_histogramMetrics:${cluster}`] || ( ccconfig['user_view_histogramMetrics'] || [] )
: ccconfig.user_view_histogramMetrics || []; : ccconfig['user_view_histogramMetrics'] || [];
const client = getContextClient(); const client = getContextClient();
// Note: nodeMetrics are requested on configured $timestep resolution // Note: nodeMetrics are requested on configured $timestep resolution

View File

@ -69,8 +69,8 @@
let metricBinOptions = [10, 20, 50, 100]; let metricBinOptions = [10, 20, 50, 100];
$: metricsInHistograms = selectedCluster $: metricsInHistograms = selectedCluster
? ccconfig[`user_view_histogramMetrics:${selectedCluster}`] || [] ? ccconfig[`user_view_histogramMetrics:${selectedCluster}`] || ( ccconfig['user_view_histogramMetrics'] || [] )
: ccconfig.user_view_histogramMetrics || []; : ccconfig['user_view_histogramMetrics'] || [];
const client = getContextClient(); const client = getContextClient();
$: stats = queryStore({ $: stats = queryStore({

View File

@ -27,15 +27,23 @@
const client = getContextClient(); const client = getContextClient();
const initialized = getContext("initialized"); const initialized = getContext("initialized");
let availableMetrics = []
function loadHistoMetrics(isInitialized) { function loadHistoMetrics(isInitialized, thisCluster) {
if (!isInitialized) return; if (!isInitialized) return [];
const rawAvailableMetrics = getContext("globalMetrics").filter((gm) => gm?.footprint).map((fgm) => { return fgm.name })
availableMetrics = [...rawAvailableMetrics] if (!thisCluster) {
return getContext("globalMetrics")
.filter((gm) => gm?.footprint)
.map((fgm) => { return fgm.name })
} else {
return getContext("globalMetrics")
.filter((gm) => gm?.availability.find((av) => av.cluster == thisCluster))
.filter((agm) => agm?.footprint)
.map((afgm) => { return afgm.name })
}
} }
let pendingMetrics = [...metricsInHistograms]; // Copy $: pendingMetrics = [...metricsInHistograms]; // Copy on change from above
const updateConfigurationMutation = ({ name, value }) => { const updateConfigurationMutation = ({ name, value }) => {
return mutationStore({ return mutationStore({
@ -71,7 +79,7 @@
}); });
} }
$: loadHistoMetrics($initialized); $: availableMetrics = loadHistoMetrics($initialized, cluster);
</script> </script>