From 5b51c80f5f4024df70287ca91ee54ac733af2193 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 12 Mar 2024 17:13:53 -0500 Subject: [PATCH] do not perform query when invalid filters are present Modified the `Filtering.getValidFilters` function to return an `invalidFilters` object as well, which can be used to tell the user which filters were invalid. --- client/src/components/Common/FilterMenu.vue | 22 +- client/src/components/Grid/GridList.vue | 72 +++-- .../History/CurrentHistory/HistoryPanel.vue | 4 +- .../components/Workflow/WorkflowFilters.js | 268 +++++++++++------- .../Workflow/WorkflowIndicators.vue | 3 +- .../src/components/Workflow/WorkflowList.vue | 150 ++++------ client/src/utils/filtering.ts | 32 ++- 7 files changed, 297 insertions(+), 254 deletions(-) diff --git a/client/src/components/Common/FilterMenu.vue b/client/src/components/Common/FilterMenu.vue index 8dee4e4bd08d..f3deb4ee9894 100644 --- a/client/src/components/Common/FilterMenu.vue +++ b/client/src/components/Common/FilterMenu.vue @@ -4,7 +4,7 @@ import { faAngleDoubleUp, faQuestion, faRedo, faSearch } from "@fortawesome/free import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton, BModal } from "bootstrap-vue"; import { kebabCase } from "lodash"; -import { computed, ref, watch } from "vue"; +import { computed, ref } from "vue"; import type Filtering from "@/utils/filtering"; import { type Alias, getOperatorForAlias } from "@/utils/filtering"; @@ -68,7 +68,6 @@ const props = withDefaults(defineProps(), { const emit = defineEmits<{ (e: "update:filter-text", filter: string): void; - (e: "on-backend-filter", filter: string): void; (e: "update:show-advanced", showAdvanced: boolean): void; (e: "on-search", filters: Record, filterText?: string, backendFilter?: string): void; }>(); @@ -127,25 +126,6 @@ function onToggle() { function updateFilterText(newFilterText: string) { emit("update:filter-text", newFilterText); } - -// as the filterText changes, emit a backend-filter that can be used as a backend query -watch( - () => props.filterText, - (newFilterText: string) => { - const defaultBackendFilter = props.filterClass.getFilterText(props.filterClass.defaultFilters, true); - const currentBackendFilter = props.filterClass.getFilterText(filters.value, true); - - const backendFilter = - defaultBackendFilter === currentBackendFilter - ? `${ - defaultBackendFilter && !newFilterText.includes(defaultBackendFilter) - ? defaultBackendFilter + " " - : "" - }` + newFilterText - : props.filterClass.getFilterText(filters.value, true); - emit("on-backend-filter", backendFilter); - } -);