mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Cleanup and shift FilterRanges to configuration
This commit is contained in:
parent
48c1ba097a
commit
5e002def0a
@ -38,7 +38,7 @@
|
|||||||
{cluster.name}
|
{cluster.name}
|
||||||
</ListGroupItem>
|
</ListGroupItem>
|
||||||
{/each}
|
{/each}
|
||||||
</ListGroup>
|
</ListGroup>
|
||||||
{/if}
|
{/if}
|
||||||
{#if $initialized && pendingCluster != null}
|
{#if $initialized && pendingCluster != null}
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import DoubleRangeSlider from './DoubleRangeSlider.svelte'
|
import DoubleRangeSlider from './DoubleRangeSlider.svelte'
|
||||||
|
|
||||||
const clusters = getContext('clusters'),
|
const clusters = getContext('clusters'),
|
||||||
|
ccconfig = getContext('cc-config'),
|
||||||
initialized = getContext('initialized'),
|
initialized = getContext('initialized'),
|
||||||
dispatch = createEventDispatcher()
|
dispatch = createEventDispatcher()
|
||||||
|
|
||||||
@ -26,16 +27,17 @@
|
|||||||
$: {
|
$: {
|
||||||
if ($initialized) {
|
if ($initialized) {
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
const { filterRanges, subClusters } = clusters.find(c => c.name == cluster)
|
const { subClusters } = clusters.find(c => c.name == cluster)
|
||||||
|
const { filterRanges } = ccconfig.clusters.find(c => c.name == cluster)
|
||||||
minNumNodes = filterRanges.numNodes.from
|
minNumNodes = filterRanges.numNodes.from
|
||||||
maxNumNodes = filterRanges.numNodes.to
|
maxNumNodes = filterRanges.numNodes.to
|
||||||
maxNumAccelerators = findMaxNumAccels([{ subClusters }])
|
maxNumAccelerators = findMaxNumAccels([{ subClusters }])
|
||||||
} else if (clusters.length > 0) {
|
} else if (clusters.length > 0) {
|
||||||
const { filterRanges } = clusters[0]
|
const { filterRanges } = ccconfig.clusters[0]
|
||||||
minNumNodes = filterRanges.numNodes.from
|
minNumNodes = filterRanges.numNodes.from
|
||||||
maxNumNodes = filterRanges.numNodes.to
|
maxNumNodes = filterRanges.numNodes.to
|
||||||
maxNumAccelerators = findMaxNumAccels(clusters)
|
maxNumAccelerators = findMaxNumAccels(clusters)
|
||||||
for (let cluster of clusters) {
|
for (let cluster of ccconfig.clusters) {
|
||||||
const { filterRanges } = cluster
|
const { filterRanges } = cluster
|
||||||
minNumNodes = Math.min(minNumNodes, filterRanges.numNodes.from)
|
minNumNodes = Math.min(minNumNodes, filterRanges.numNodes.from)
|
||||||
maxNumNodes = Math.max(maxNumNodes, filterRanges.numNodes.to)
|
maxNumNodes = Math.max(maxNumNodes, filterRanges.numNodes.to)
|
||||||
|
@ -9,7 +9,7 @@ import { readable } from 'svelte/store'
|
|||||||
*
|
*
|
||||||
* It does several things:
|
* It does several things:
|
||||||
* - Initialize the GraphQL client
|
* - Initialize the GraphQL client
|
||||||
* - Creates a readable store 'initialization' which indicates when the values below can be used.
|
* - Creates a readable store 'initialization' which indicates when the values below can be used.
|
||||||
* - Adds 'tags' to the context (list of all tags)
|
* - Adds 'tags' to the context (list of all tags)
|
||||||
* - Adds 'clusters' to the context (object with cluster names as keys)
|
* - Adds 'clusters' to the context (object with cluster names as keys)
|
||||||
* - Adds 'metrics' to the context, a function that takes a cluster and metric name and returns the MetricConfig (or undefined)
|
* - Adds 'metrics' to the context, a function that takes a cluster and metric name and returns the MetricConfig (or undefined)
|
||||||
@ -43,11 +43,6 @@ export function init(extraInitQuery = '') {
|
|||||||
aggregation,
|
aggregation,
|
||||||
subClusters { name, peak, normal, caution, alert }
|
subClusters { name, peak, normal, caution, alert }
|
||||||
}
|
}
|
||||||
filterRanges {
|
|
||||||
duration { from, to }
|
|
||||||
numNodes { from, to }
|
|
||||||
startTime { from, to }
|
|
||||||
}
|
|
||||||
partitions
|
partitions
|
||||||
subClusters {
|
subClusters {
|
||||||
name, processorType
|
name, processorType
|
||||||
@ -104,7 +99,7 @@ export function init(extraInitQuery = '') {
|
|||||||
|
|
||||||
for (let tag of data.tags)
|
for (let tag of data.tags)
|
||||||
tags.push(tag)
|
tags.push(tag)
|
||||||
|
|
||||||
for (let cluster of data.clusters)
|
for (let cluster of data.clusters)
|
||||||
clusters.push(cluster)
|
clusters.push(cluster)
|
||||||
|
|
||||||
@ -241,7 +236,7 @@ export async function fetchMetrics(job, metrics, scopes) {
|
|||||||
if (res.status != 200) {
|
if (res.status != 200) {
|
||||||
return { error: { status: res.status, message: await res.text() } }
|
return { error: { status: res.status, message: await res.text() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
return await res.json()
|
return await res.json()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return { error: e }
|
return { error: e }
|
||||||
|
Loading…
Reference in New Issue
Block a user