From df6cff19601735a3540b20d06b99bcb84919b415 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Mon, 15 May 2023 16:14:42 +0200 Subject: [PATCH] Implement tag filter on search result page --- .../unreleased/enhancement-search-tag-filter | 6 + .../components/FilesList/ResourceTable.vue | 5 +- .../src/components/Search/List.vue | 113 +++++++- packages/web-app-files/src/router/common.ts | 2 +- .../tests/unit/components/Search/List.spec.ts | 261 ++++++------------ .../web-app-search/src/portals/SearchBar.vue | 12 +- packages/web-app-search/src/views/List.vue | 32 +-- .../tests/unit/portals/SearchBar.spec.ts | 29 +- .../tests/unit/views/List.spec.ts | 31 ++- .../web-pkg/src/components/ItemFilter.vue | 11 +- 10 files changed, 263 insertions(+), 239 deletions(-) create mode 100644 changelog/unreleased/enhancement-search-tag-filter diff --git a/changelog/unreleased/enhancement-search-tag-filter b/changelog/unreleased/enhancement-search-tag-filter new file mode 100644 index 00000000000..c254cabaedd --- /dev/null +++ b/changelog/unreleased/enhancement-search-tag-filter @@ -0,0 +1,6 @@ +Enhancement: Search tag filter + +The search result page now has a tag filter which can be used to filter the displayed search result by tags. + +https://github.com/owncloud/web/pull/9044 +https://github.com/owncloud/web/issues/9054 diff --git a/packages/web-app-files/src/components/FilesList/ResourceTable.vue b/packages/web-app-files/src/components/FilesList/ResourceTable.vue index 530b06a683a..72174602f8a 100644 --- a/packages/web-app-files/src/components/FilesList/ResourceTable.vue +++ b/packages/web-app-files/src/components/FilesList/ResourceTable.vue @@ -632,9 +632,10 @@ export default defineComponent({ shouldDisplayThumbnails(item) { return this.areThumbnailsDisplayed && !isResourceTxtFileAlmostEmpty(item) }, - getTagLink(tag) { + getTagLink(tag: string) { + const currentTerm = unref(this.$router.currentRoute).query?.term return createLocationCommon('files-common-search', { - query: { term: `Tags:"${tag}"`, provider: 'files.sdk' } + query: { provider: 'files.sdk', q_tags: tag, ...(currentTerm && { term: currentTerm }) } }) }, getTagComponentAttrs(tag) { diff --git a/packages/web-app-files/src/components/Search/List.vue b/packages/web-app-files/src/components/Search/List.vue index c31c0ba814c..ab545f33654 100644 --- a/packages/web-app-files/src/components/Search/List.vue +++ b/packages/web-app-files/src/components/Search/List.vue @@ -2,6 +2,28 @@
+
+ + + + +