diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-06-27 00:00:53 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-06-27 12:13:14 +0200 |
commit | 362c6238fcadb74c54c2a8c7b2c12c5a1011c0b5 (patch) | |
tree | 788796ae091291c2753905616f6a6db3aaa02464 /apps/files/src/views | |
parent | dd3dcf37039ed969b1a2f6b89941a65ccf73b696 (diff) | |
download | nextcloud-server-362c6238fcadb74c54c2a8c7b2c12c5a1011c0b5.tar.gz nextcloud-server-362c6238fcadb74c54c2a8c7b2c12c5a1011c0b5.zip |
fix: Allow to reset unified search using the `nextcloud:unified-search:reset` event
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src/views')
-rw-r--r-- | apps/files/src/views/FilesList.vue | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue index 8ba5a85ddac..98a817ac067 100644 --- a/apps/files/src/views/FilesList.vue +++ b/apps/files/src/views/FilesList.vue @@ -464,7 +464,7 @@ export default defineComponent({ logger.debug('View changed', { newView, oldView }) this.selectionStore.reset() - this.resetSearch() + this.triggerResetSearch() this.fetchContent() }, @@ -472,7 +472,7 @@ export default defineComponent({ logger.debug('Directory changed', { newDir, oldDir }) // TODO: preserve selection on browsing? this.selectionStore.reset() - this.resetSearch() + this.triggerResetSearch() this.fetchContent() // Scroll to top, force virtual scroller to re-render @@ -493,8 +493,8 @@ export default defineComponent({ subscribe('files:node:deleted', this.onNodeDeleted) subscribe('files:node:updated', this.onUpdatedNode) - subscribe('nextcloud:unified-search.search', this.onSearch) - subscribe('nextcloud:unified-search.reset', this.resetSearch) + subscribe('nextcloud:unified-search:search', this.onSearch) + subscribe('nextcloud:unified-search:reset', this.onResetSearch) // reload on settings change this.unsubscribeStoreCallback = this.userConfigStore.$subscribe(() => this.fetchContent(), { deep: true }) @@ -503,8 +503,8 @@ export default defineComponent({ unmounted() { unsubscribe('files:node:deleted', this.onNodeDeleted) unsubscribe('files:node:updated', this.onUpdatedNode) - unsubscribe('nextcloud:unified-search.search', this.onSearch) - unsubscribe('nextcloud:unified-search.reset', this.resetSearch) + unsubscribe('nextcloud:unified-search:search', this.onSearch) + unsubscribe('nextcloud:unified-search:reset', this.onResetSearch) this.unsubscribeStoreCallback() }, @@ -676,15 +676,23 @@ export default defineComponent({ }, /** - * Reset the search query + * Handle reset search query event */ - resetSearch() { + onResetSearch() { // Reset debounced calls to not set the query again this.onSearch.clear() // Reset filter query this.filterText = '' }, + /** + * Trigger a reset of the local search (part of unified search) + * This is usful to reset the search on directory / view change + */ + triggerResetSearch() { + emit('nextcloud:unified-search:reset') + }, + openSharingSidebar() { if (!this.currentFolder) { logger.debug('No current folder found for opening sharing sidebar') |