From 07bd2de2914bed10444c19f123e3dafbd05f22ed Mon Sep 17 00:00:00 2001 From: Vishesh Date: Tue, 13 Aug 2024 14:58:10 +0530 Subject: [PATCH 1/3] UI: Show applied search filters --- ui/public/config.json | 3 +- ui/src/components/view/SearchFilter.vue | 555 ++++++++++++++++++++++++ ui/src/views/AutogenView.vue | 48 ++ 3 files changed, 605 insertions(+), 1 deletion(-) create mode 100644 ui/src/components/view/SearchFilter.vue diff --git a/ui/public/config.json b/ui/public/config.json index 64d102841862..e3d1d30b95fb 100644 --- a/ui/public/config.json +++ b/ui/public/config.json @@ -98,5 +98,6 @@ "multipleServer": false, "allowSettingTheme": true, "docHelpMappings": {}, - "notifyLatestCSVersion": true + "notifyLatestCSVersion": true, + "showSearchFilters": true } diff --git a/ui/src/components/view/SearchFilter.vue b/ui/src/components/view/SearchFilter.vue new file mode 100644 index 000000000000..ccec21f7a15b --- /dev/null +++ b/ui/src/components/view/SearchFilter.vue @@ -0,0 +1,555 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + + + diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index a01e300c1c9a..6acc81d6a029 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -106,6 +106,16 @@ @change-filter="changeFilter"/> + + + @@ -469,6 +479,7 @@ import ListView from '@/components/view/ListView' import ResourceView from '@/components/view/ResourceView' import ActionButton from '@/components/view/ActionButton' import SearchView from '@/components/view/SearchView' +import SearchFilter from '@/components/view/SearchFilter' import OsLogo from '@/components/widgets/OsLogo' import ResourceIcon from '@/components/view/ResourceIcon' import BulkActionProgress from '@/components/view/BulkActionProgress' @@ -482,6 +493,7 @@ export default { ListView, ActionButton, SearchView, + SearchFilter, BulkActionProgress, TooltipLabel, OsLogo, @@ -1126,6 +1138,42 @@ export default { eventBus.emit('action-closing', { action: this.currentAction }) this.closeAction() }, + getActiveFilters () { + const queryParams = Object.assign({}, this.$route.query) + const activeFilters = [] + for (const filter in queryParams) { + if (!filter.startsWith('tags[')) { + activeFilters.push({ + key: filter, + value: queryParams[filter], + isTag: false + }) + } else if (filter.endsWith('].key')) { + const tagIdx = filter.split('[')[1].split(']')[0] + const tagKey = queryParams[`tags[${tagIdx}].key`] + const tagValue = queryParams[`tags[${tagIdx}].value`] + activeFilters.push({ + key: tagKey, + value: tagValue, + isTag: true, + tagIdx: tagIdx + }) + } + } + return activeFilters + }, + removeFilter (filter) { + const queryParams = Object.assign({}, this.$route.query) + if (filter.isTag) { + delete queryParams[`tags[${filter.tagIdx}].key`] + delete queryParams[`tags[${filter.tagIdx}].value`] + } else { + delete queryParams[filter.key] + } + queryParams.page = '1' + queryParams.pagesize = String(this.pageSize) + this.$router.push({ query: queryParams }) + }, onRowSelectionChange (selection) { this.selectedRowKeys = selection if (selection?.length > 0) { From 8c634cd475eee701bf15a1ae17985a1f44b4737b Mon Sep 17 00:00:00 2001 From: vishesh92 Date: Thu, 29 Jan 2026 15:28:57 +0530 Subject: [PATCH 2/3] Address comments --- ui/src/components/view/SearchFilter.vue | 90 +++++++++++++------------ 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/ui/src/components/view/SearchFilter.vue b/ui/src/components/view/SearchFilter.vue index ccec21f7a15b..ed950c094a3b 100644 --- a/ui/src/components/view/SearchFilter.vue +++ b/ui/src/components/view/SearchFilter.vue @@ -21,8 +21,8 @@ :wrap="false" >