From 997f26a6f250f64585e90e0463cdbaaf372d942d Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 24 Jul 2024 18:03:14 +0200 Subject: [PATCH] feat: simple filters --- .../executions/+page.svelte | 41 ++++-------- .../executions/simpleFilters.svelte | 66 +++++++++++++++++++ 2 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/executions/simpleFilters.svelte 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 56dff9540..673c10f75 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 @@ -14,12 +14,13 @@ import Create from '../create.svelte'; import { abbreviateNumber } from '$lib/helpers/numbers'; import { base } from '$app/paths'; - import { Filters, queries, TagList } from '$lib/components/filters'; + import { Filters, queries } from '$lib/components/filters'; import { writable } from 'svelte/store'; import type { Column } from '$lib/helpers/types'; import { View } from '$lib/helpers/load'; import Table from './table.svelte'; import { tags } from '$lib/components/filters/store'; + import SimpleFilters from './simpleFilters.svelte'; export let data; @@ -35,7 +36,7 @@ width: 110, array: true, format: 'enum', - elements: ['completed', 'scheduled', 'waiting', 'processing', 'cancelled', 'failed'] + elements: ['completed', 'failed', 'waiting', 'scheduled', 'processing', 'cancelled'] }, { id: '$createdAt', @@ -53,7 +54,11 @@ width: 90, array: true, format: 'enum', - elements: ['http', 'scheduled', 'event'] + elements: [ + { value: 'http', label: 'HTTP' }, + { value: 'schedule', label: 'Schedule' }, + { value: 'event', label: 'Event' } + ] }, { id: 'requestMethod', @@ -132,34 +137,16 @@
- - - + +
- - {#if $tags?.length} -
-
- - {/if}
diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/executions/simpleFilters.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/executions/simpleFilters.svelte new file mode 100644 index 000000000..97ffb8578 --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/executions/simpleFilters.svelte @@ -0,0 +1,66 @@ + + + + (showStatusFilter = !showStatusFilter)}> + {colStatus.title} + + + + + {#each statusOptions as option (option.value + option.checked)} + { + option.checked = !option.checked; + statusOptions = statusOptions; + addFilterAndApply( + colStatus.id, + ValidOperators.Equal, + null, + statusOptions.filter((opt) => opt.checked).map((opt) => opt.value) ?? [] + ); + }}> + {option.label} + + {/each} + +