Update variable naming for filter implementation

This commit is contained in:
Christoph Kluge 2023-06-06 16:58:08 +02:00
parent 246ac0563f
commit b63969e5cc

View File

@ -25,12 +25,13 @@
filterPresets.startTime = { from: hourAgo.toISOString(), to: now.toISOString() } filterPresets.startTime = { from: hourAgo.toISOString(), to: now.toISOString() }
} }
let cluster let cluster;
let filters let filterComponent; // see why here: https://stackoverflow.com/questions/58287729/how-can-i-export-a-function-from-a-svelte-component-that-changes-a-value-in-the
let rooflineMaxY let jobFilters = [];
let colWidth let rooflineMaxY;
let numBins = 50 let colWidth;
let maxY = -1 let numBins = 50;
let maxY = -1;
const ccconfig = getContext('cc-config') const ccconfig = getContext('cc-config')
const metricConfig = getContext('metrics') const metricConfig = getContext('metrics')
@ -54,8 +55,8 @@
$: statsQuery = queryStore({ $: statsQuery = queryStore({
client: client, client: client,
query: gql` query: gql`
query($filters: [JobFilter!]!) { query($jobFilters: [JobFilter!]!) {
stats: jobsStatistics(filter: $filters) { stats: jobsStatistics(filter: $jobFilters) {
totalJobs totalJobs
shortJobs shortJobs
totalWalltime totalWalltime
@ -67,34 +68,34 @@
topUsers: jobsCount(filter: $filters, groupBy: USER, weight: NODE_HOURS, limit: 5) { name, count } topUsers: jobsCount(filter: $filters, groupBy: USER, weight: NODE_HOURS, limit: 5) { name, count }
} }
`, `,
variables: { filters } variables: { jobFilters }
}) })
$: footprintsQuery = queryStore({ $: footprintsQuery = queryStore({
client: client, client: client,
query: gql` query: gql`
query($filters: [JobFilter!]!, $metrics: [String!]!) { query($jobFilters: [JobFilter!]!, $metrics: [String!]!) {
footprints: jobsFootprints(filter: $filters, metrics: $metrics) { footprints: jobsFootprints(filter: $jobFilters, metrics: $metrics) {
nodehours, nodehours,
metrics { metric, data } metrics { metric, data }
} }
}`, }`,
variables: { filters, metrics } variables: { jobFilters, metrics }
}) })
$: rooflineQuery = queryStore({ $: rooflineQuery = queryStore({
client: client, client: client,
query: gql` query: gql`
query($filters: [JobFilter!]!, $rows: Int!, $cols: Int!, query($jobFilters: [JobFilter!]!, $rows: Int!, $cols: Int!,
$minX: Float!, $minY: Float!, $maxX: Float!, $maxY: Float!) { $minX: Float!, $minY: Float!, $maxX: Float!, $maxY: Float!) {
rooflineHeatmap(filter: $filters, rows: $rows, cols: $cols, rooflineHeatmap(filter: $jobFilters, rows: $rows, cols: $cols,
minX: $minX, minY: $minY, maxX: $maxX, maxY: $maxY) minX: $minX, minY: $minY, maxX: $maxX, maxY: $maxY)
} }
`, `,
variables: { filters, rows: 50, cols: 50, minX: 0.01, minY: 1., maxX: 1000., maxY } variables: { jobFilters, rows: 50, cols: 50, minX: 0.01, minY: 1., maxX: 1000., maxY }
}) })
onMount(() => filters.update()) onMount(() => filterComponent.update())
</script> </script>
<Row> <Row>
@ -115,12 +116,12 @@
</Col> </Col>
<Col xs="auto"> <Col xs="auto">
<Filters <Filters
bind:this={filters} bind:this={filterComponent}
filterPresets={filterPresets} filterPresets={filterPresets}
disableClusterSelection={true} disableClusterSelection={true}
startTimeQuickSelect={true} startTimeQuickSelect={true}
on:update={({ detail }) => { on:update={({ detail }) => {
filters = detail.filters; jobFilters = detail.filters;
}} /> }} />
</Col> </Col>
</Row> </Row>