diff --git a/src/lib/components/filters/filters.svelte b/src/lib/components/filters/filters.svelte index cae6f2878..793864e32 100644 --- a/src/lib/components/filters/filters.svelte +++ b/src/lib/components/filters/filters.svelte @@ -13,13 +13,19 @@ tags, ValidOperators } from './store'; + import { createEventDispatcher } from 'svelte'; export let query = '[]'; export let columns: Writable; export let disabled = false; export let fullWidthMobile = false; export let singleCondition = false; + export let clearOnClick = false; // When enabled the user doesn't have to click apply to clear the filters + export let enableApply = false; + export let quickFilters = false; + let displayQuickFilters = quickFilters; + const dispatch = createEventDispatcher(); const parsedQueries = queryParamToMap(query); queries.set(parsedQueries); @@ -44,10 +50,15 @@ function clearAll() { selectedColumn = null; queries.clearAll(); + if (clearOnClick) { + queries.apply(); + } } function apply() { - if ( + if (quickFilters && displayQuickFilters) { + dispatch('apply'); + } else if ( selectedColumn && operatorKey && (operatorKey === ValidOperators.IsNotNull || @@ -83,14 +94,15 @@ arrayValues = []; } - $: isButtonDisabled = $queriesAreDirty - ? false - : !selectedColumn || - !operatorKey || - (!value && - !arrayValues.length && - operatorKey !== ValidOperators.IsNotNull && - operatorKey !== ValidOperators.IsNull); + $: isButtonDisabled = + $queriesAreDirty || (quickFilters && displayQuickFilters && enableApply) + ? false + : !selectedColumn || + !operatorKey || + (!value && + !arrayValues.length && + operatorKey !== ValidOperators.IsNotNull && + operatorKey !== ValidOperators.IsNull); function toggleDropdown() { showFiltersDesktop = !showFiltersDesktop; @@ -115,24 +127,41 @@
-

Apply filter rules to refine the table view

- (applied = 0)} /> + {#if displayQuickFilters} + + {:else} +

Apply filter rules to refine the table view

+ (applied = 0)} /> + {/if}
-
- {#if singleCondition} - - {:else} - +
+ {#if quickFilters} + {/if} - +
+ {#if singleCondition} + + {:else} + + {/if} + +
@@ -160,22 +189,42 @@ description="Apply filter rules to refine the table view" bind:show={showFiltersMobile} size="big"> - (applied = 0)} /> + {#if displayQuickFilters} + + {:else} + (applied = 0)} /> + {/if} - {#if singleCondition} - - {:else} - - {/if} - +
+ {#if quickFilters} + + {/if} +
+ {#if singleCondition} + + {:else} + + {/if} + +
+
diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte index 742e6ce4f..ca8c26ff8 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/+page.svelte @@ -1,8 +1,8 @@ @@ -169,17 +195,45 @@
- - + +
+ +

Apply quick filter rules to refine the table view

+
+ + + + +
+
    + +
+
@@ -195,16 +249,44 @@
- + + + + +

Apply quick filter rules to refine the table view

+
+ + + + +
+
    + +
+
diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/simpleFilters.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/quickFilters.svelte similarity index 100% rename from src/routes/(console)/project-[project]/functions/function-[function]/executions/simpleFilters.svelte rename to src/routes/(console)/project-[project]/functions/function-[function]/executions/quickFilters.svelte