From dbebecfcdb95132776c479571ee1dff341012b58 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 6 Jun 2023 17:03:08 +0200 Subject: [PATCH] Update variable naming for filter implementation --- web/frontend/src/List.root.svelte | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/web/frontend/src/List.root.svelte b/web/frontend/src/List.root.svelte index 371c743..b219f35 100644 --- a/web/frontend/src/List.root.svelte +++ b/web/frontend/src/List.root.svelte @@ -29,12 +29,17 @@ "Invalid list type provided!" ); + 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 jobFilters = []; + let nameFilter = ""; + let sorting = { field: "totalJobs", direction: "down" }; + const client = getContextClient(); $: stats = queryStore({ client: client, query: gql` - query($filters: [JobFilter!]!) { - rows: jobsStatistics(filter: $filters, groupBy: ${type}) { + query($jobFilters: [JobFilter!]!) { + rows: jobsStatistics(filter: $jobFilters, groupBy: ${type}) { id name totalJobs @@ -42,13 +47,9 @@ totalCoreHours } }`, - variables: { filters } + variables: { jobFilters } }); - let filters; - let nameFilter = ""; - let sorting = { field: "totalJobs", direction: "down" }; - function changeSorting(event, field) { let target = event.target; while (target.tagName != "BUTTON") target = target.parentElement; @@ -73,7 +74,7 @@ return stats.filter((u) => u.id.includes(nameFilter)).sort(cmp); } - onMount(() => filters.update()); + onMount(() => filterComponent.update()); @@ -93,12 +94,12 @@ { - filters = detail.filters; + jobFilters = detail.filters; }} />