Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: In app search #41609

Merged
merged 7 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading