Skip to content

Commit

Permalink
Merge pull request #41609 from nextcloud/enh/in-app-search
Browse files Browse the repository at this point in the history
feat: In app search
  • Loading branch information
szaimen authored Jun 27, 2024
2 parents ff499a6 + 3294037 commit a184161
Show file tree
Hide file tree
Showing 34 changed files with 862 additions and 285 deletions.
24 changes: 16 additions & 8 deletions apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,15 @@ export default defineComponent({
logger.debug('View changed', { newView, oldView })
this.selectionStore.reset()
this.resetSearch()
this.triggerResetSearch()
this.fetchContent()
},
dir(newDir, oldDir) {
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
Expand All @@ -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 })
Expand All @@ -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()
},
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion core/css/header.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/css/header.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions core/css/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
}

.header-right {
// Add some spacing so the last entry looks ok
margin-inline-end: calc(3 * var(--default-grid-baseline));

a:not(.button):focus-visible::after, div[role=button]:focus-visible::after {
bottom: 4px;
}
Expand Down
Loading

0 comments on commit a184161

Please sign in to comment.