mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-03 17:15:06 +01:00 
			
		
		
		
	fix: user and status view histogram selection
- correctly loads selection for selected cluster - applies availablility for selected cluster
This commit is contained in:
		@@ -76,8 +76,8 @@
 | 
			
		||||
 | 
			
		||||
  let isHistogramSelectionOpen = false;
 | 
			
		||||
  $: metricsInHistograms = cluster
 | 
			
		||||
    ? ccconfig[`user_view_histogramMetrics:${cluster}`] || []
 | 
			
		||||
    : ccconfig.user_view_histogramMetrics || [];
 | 
			
		||||
    ? ccconfig[`user_view_histogramMetrics:${cluster}`] || ( ccconfig['user_view_histogramMetrics'] || [] )
 | 
			
		||||
    : ccconfig['user_view_histogramMetrics'] || [];
 | 
			
		||||
 | 
			
		||||
  const client = getContextClient();
 | 
			
		||||
  // Note: nodeMetrics are requested on configured $timestep resolution
 | 
			
		||||
 
 | 
			
		||||
@@ -69,8 +69,8 @@
 | 
			
		||||
  let metricBinOptions = [10, 20, 50, 100];
 | 
			
		||||
 | 
			
		||||
  $: metricsInHistograms = selectedCluster
 | 
			
		||||
    ? ccconfig[`user_view_histogramMetrics:${selectedCluster}`] || []
 | 
			
		||||
    : ccconfig.user_view_histogramMetrics || [];
 | 
			
		||||
    ? ccconfig[`user_view_histogramMetrics:${selectedCluster}`] || ( ccconfig['user_view_histogramMetrics'] || [] )
 | 
			
		||||
    : ccconfig['user_view_histogramMetrics'] || [];
 | 
			
		||||
 | 
			
		||||
  const client = getContextClient();
 | 
			
		||||
  $: stats = queryStore({
 | 
			
		||||
 
 | 
			
		||||
@@ -27,15 +27,23 @@
 | 
			
		||||
  const client = getContextClient();
 | 
			
		||||
  const initialized = getContext("initialized");
 | 
			
		||||
 | 
			
		||||
  let availableMetrics = []
 | 
			
		||||
 | 
			
		||||
  function loadHistoMetrics(isInitialized) {
 | 
			
		||||
    if (!isInitialized) return;
 | 
			
		||||
    const rawAvailableMetrics = getContext("globalMetrics").filter((gm) => gm?.footprint).map((fgm) => { return fgm.name })
 | 
			
		||||
    availableMetrics = [...rawAvailableMetrics]
 | 
			
		||||
  function loadHistoMetrics(isInitialized, thisCluster) {
 | 
			
		||||
    if (!isInitialized) return [];
 | 
			
		||||
 | 
			
		||||
    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 }) => {
 | 
			
		||||
    return mutationStore({
 | 
			
		||||
@@ -71,7 +79,7 @@
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  $: loadHistoMetrics($initialized);
 | 
			
		||||
  $: availableMetrics = loadHistoMetrics($initialized, cluster);
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user