From 246ac0563fc5e916fcb513cbfec621bb30b9c17d Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 6 Jun 2023 16:52:40 +0200 Subject: [PATCH] Fix filter implementation in user view --- web/frontend/src/User.root.svelte | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/web/frontend/src/User.root.svelte b/web/frontend/src/User.root.svelte index 7aa6317..03d6a3d 100644 --- a/web/frontend/src/User.root.svelte +++ b/web/frontend/src/User.root.svelte @@ -18,8 +18,9 @@ export let user export let filterPresets - let filters = [] - let jobList + 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 jobList; + let jobFilters = []; let sorting = { field: 'startTime', order: 'DESC' }, isSortingOpen = false let metrics = ccconfig.plot_list_selectedMetrics, isMetricsSelectionOpen = false let w1, w2, histogramHeight = 250 @@ -29,8 +30,8 @@ $: stats = queryStore({ client: client, query: gql` - query($filters: [JobFilter!]!) { - jobsStatistics(filter: $filters) { + query($jobFilters: [JobFilter!]!) { + jobsStatistics(filter: $jobFilters) { totalJobs shortJobs totalWalltime @@ -38,12 +39,10 @@ histDuration { count, value } histNumNodes { count, value } }}`, - variables: { filters } + variables: { jobFilters } }) - $: selectedCluster = filters[0]?.cluster ? filters[0].cluster.eq : null - - onMount(() => filters.update()) + onMount(() => filterComponent.update()) @@ -74,10 +73,10 @@ { - let jobFilters = [...detail.filters, { user: { eq: user.username } }] - filters = jobFilters + jobFilters = [...detail.filters, { user: { eq: user.username } }] + selectedCluster = jobFilters[0]?.cluster ? jobFilters[0].cluster.eq : null jobList.update(jobFilters) }} />