mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-04 01:25:06 +01:00 
			
		
		
		
	fix: fix scope autoselect on jobview statstable
This commit is contained in:
		web/frontend/src
@@ -93,7 +93,9 @@
 | 
				
			|||||||
            startFetching(
 | 
					            startFetching(
 | 
				
			||||||
                job,
 | 
					                job,
 | 
				
			||||||
                [...toFetch],
 | 
					                [...toFetch],
 | 
				
			||||||
                job.numNodes > 2 ? ["node"] : ["node", "core"]
 | 
					                job.numNodes > 2
 | 
				
			||||||
 | 
					                    ? ["node"]
 | 
				
			||||||
 | 
					                    : ["node", "socket", "core"]
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            // Accels and not on node scope
 | 
					            // Accels and not on node scope
 | 
				
			||||||
@@ -102,7 +104,7 @@
 | 
				
			|||||||
                [...toFetch],
 | 
					                [...toFetch],
 | 
				
			||||||
                job.numNodes > 2
 | 
					                job.numNodes > 2
 | 
				
			||||||
                    ? ["node", "accelerator"]
 | 
					                    ? ["node", "accelerator"]
 | 
				
			||||||
                    : ["node", "accelerator", "core"]
 | 
					                    : ["node", "accelerator", "socket", "core"]
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -390,8 +392,6 @@
 | 
				
			|||||||
                                bind:this={statsTable}
 | 
					                                bind:this={statsTable}
 | 
				
			||||||
                                job={$initq.data.job}
 | 
					                                job={$initq.data.job}
 | 
				
			||||||
                                jobMetrics={$jobMetrics.data.jobMetrics}
 | 
					                                jobMetrics={$jobMetrics.data.jobMetrics}
 | 
				
			||||||
                                accMetrics={accMetrics}
 | 
					 | 
				
			||||||
                                accNodeOnly={accNodeOnly}
 | 
					 | 
				
			||||||
                            />
 | 
					                            />
 | 
				
			||||||
                        {/key}
 | 
					                        {/key}
 | 
				
			||||||
                    {/if}
 | 
					                    {/if}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    export let job
 | 
					    export let job
 | 
				
			||||||
    export let jobMetrics
 | 
					    export let jobMetrics
 | 
				
			||||||
    export let accMetrics
 | 
					 | 
				
			||||||
    export let accNodeOnly
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const allMetrics = [...new Set(jobMetrics.map(m => m.name))].sort(),
 | 
					    const allMetrics = [...new Set(jobMetrics.map(m => m.name))].sort(),
 | 
				
			||||||
          scopesForMetric = (metric) => jobMetrics
 | 
					          scopesForMetric = (metric) => jobMetrics
 | 
				
			||||||
@@ -23,17 +21,23 @@
 | 
				
			|||||||
            || getContext('cc-config')['job_view_nodestats_selectedMetrics']
 | 
					            || getContext('cc-config')['job_view_nodestats_selectedMetrics']
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
    for (let metric of allMetrics) {
 | 
					    for (let metric of allMetrics) {
 | 
				
			||||||
        // Not Exclusive or Single Node: Get maxScope()
 | 
					        // Not Exclusive or Multi-Node: get maxScope directly (mostly: node)
 | 
				
			||||||
        // No Accelerators in Job and not Acc-Metric: Use 'core'
 | 
					        //   -> Else: Load smallest available granularity as default as per availability
 | 
				
			||||||
        // Accelerator Metric available on accelerator scope: Use 'accelerator'
 | 
					        const availableScopes = scopesForMetric(metric)
 | 
				
			||||||
        // Accelerator Metric only on node scope: Fallback to 'node'
 | 
					        if (job.exclusive != 1 || job.numNodes == 1) {
 | 
				
			||||||
        selectedScopes[metric] = (job.exclusive != 1 || job.numNodes == 1) ?
 | 
					            if (availableScopes.includes('accelerator')) {
 | 
				
			||||||
                                   (job.numAccs != 0 && accMetrics.includes(metric)) ?
 | 
					                selectedScopes[metric] = 'accelerator'
 | 
				
			||||||
                                     accNodeOnly ?
 | 
					            } else if (availableScopes.includes('core')) {
 | 
				
			||||||
                                       'node'
 | 
					                selectedScopes[metric] = 'core'
 | 
				
			||||||
                                     : 'accelerator' 
 | 
					            } else if (availableScopes.includes('socket')) {
 | 
				
			||||||
                                   : 'core'
 | 
					                selectedScopes[metric] = 'socket'
 | 
				
			||||||
                                 : maxScope(scopesForMetric(metric))
 | 
					            } else {
 | 
				
			||||||
 | 
					                selectedScopes[metric] = 'node'
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            selectedScopes[metric] = maxScope(availableScopes)
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        sorting[metric] = {
 | 
					        sorting[metric] = {
 | 
				
			||||||
            min: { dir: 'up', active: false },
 | 
					            min: { dir: 'up', active: false },
 | 
				
			||||||
            avg: { dir: 'up', active: false },
 | 
					            avg: { dir: 'up', active: false },
 | 
				
			||||||
@@ -84,8 +88,7 @@
 | 
				
			|||||||
                            {metric}
 | 
					                            {metric}
 | 
				
			||||||
                        </InputGroupText>
 | 
					                        </InputGroupText>
 | 
				
			||||||
                        <select class="form-select"
 | 
					                        <select class="form-select"
 | 
				
			||||||
                            bind:value={selectedScopes[metric]}
 | 
					                            bind:value={selectedScopes[metric]}>
 | 
				
			||||||
                            disabled={scopesForMetric(metric, jobMetrics).length == 1}>
 | 
					 | 
				
			||||||
                            {#each scopesForMetric(metric, jobMetrics) as scope}
 | 
					                            {#each scopesForMetric(metric, jobMetrics) as scope}
 | 
				
			||||||
                                <option value={scope}>{scope}</option>
 | 
					                                <option value={scope}>{scope}</option>
 | 
				
			||||||
                            {/each}
 | 
					                            {/each}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user