From ee65fbfa27c756bf098e09289b21bc0e70483064 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 12 Dec 2023 07:39:13 +0300 Subject: [PATCH] Add advanced filter options to history grid --- .../src/components/Grid/configs/histories.ts | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/client/src/components/Grid/configs/histories.ts b/client/src/components/Grid/configs/histories.ts index ccde1f89a9c..38ee5749201 100644 --- a/client/src/components/Grid/configs/histories.ts +++ b/client/src/components/Grid/configs/histories.ts @@ -3,7 +3,7 @@ import { useEventBus } from "@vueuse/core"; import { deleteForm, undeleteForm } from "@/api/forms"; import { historiesQuery } from "@/api/histories"; -import Filtering, { contains, equals, toBool, type ValidFilter } from "@/utils/filtering"; +import Filtering, { contains, equals, expandNameTag, toBool, type ValidFilter } from "@/utils/filtering"; import _l from "@/utils/localization"; import { errorMessageAsString } from "@/utils/simple-error"; @@ -188,14 +188,36 @@ const fields: FieldArray = [ }, { key: "sharing", - title: "Sharing", + title: "Shared", type: "sharing", }, ]; +/** + * Declare filter options + */ const validFilters: Record> = { - name: { placeholder: "name", type: String, handler: contains("name"), menuItem: true }, - description: { placeholder: "description", type: String, handler: contains("desc"), menuItem: true }, + title: { placeholder: "name", type: String, handler: contains("name"), menuItem: true }, + tag: { + placeholder: "tag(s)", + type: "MultiTags", + handler: contains("tag", "tag", expandNameTag), + menuItem: true, + }, + published: { + placeholder: "Filter on published entries", + type: Boolean, + boolType: "is", + handler: equals("published", "published", toBool), + menuItem: true, + }, + importable: { + placeholder: "Filter on importable entries", + type: Boolean, + boolType: "is", + handler: equals("importable", "importable", toBool), + menuItem: true, + }, deleted: { placeholder: "Filter on deleted entries", type: Boolean,