Skip to content
Closed
Changes from 1 commit
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
Next Next commit
feat: Adapt providers disabled property to match user applied filters
Some filters are only available for certain providers, the UI should give the user
a hint to what providers such filters are available in.

Currently, if a filter (date or person) is not support by an a provider, the provider is
blurred out in the places dropdown.

Signed-off-by: nfebe <[email protected]>
  • Loading branch information
nfebe authored and backportbot[bot] committed Jan 17, 2025
commit 7e64f33450dd94db0b1655134a4e7e8473f83620
16 changes: 10 additions & 6 deletions core/src/views/UnifiedSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -299,22 +299,18 @@ export default {
extraQueries: provider.extraParams,
}

// This block of filter checks should be dynamic somehow and should be handled in
// nextcloud/search lib
if (filters.dateFilterIsApplied) {
if (provider.filters.since && provider.filters.until) {
params.since = this.dateFilter.startFrom
params.until = this.dateFilter.endAt
} else {
// Date filter is applied but provider does not support it, no need to search provider
return
}
}

if (filters.personFilterIsApplied) {
if (provider.filters.person) {
params.person = this.personFilter.user
} else {
// Person filter is applied but provider does not support it, no need to search provider
return
}
}

Expand Down Expand Up @@ -415,6 +411,10 @@ export default {
this.filters[existingPersonFilter].name = person.displayName
}

this.providers.forEach(async (provider, index) => {
this.providers[index].disabled = !(await this.providerIsCompatibleWithFilters(provider, ['person']))
})

this.debouncedFind(this.searchQuery)
console.debug('Person filter applied', person)
},
Expand Down Expand Up @@ -471,6 +471,7 @@ export default {
if (filter.type === 'person') {
this.personFilterIsApplied = false
}
this.enableAllProviders()
break
}
}
Expand Down Expand Up @@ -509,6 +510,9 @@ export default {
this.filters.push(this.dateFilter)
}
this.dateFilterIsApplied = true
this.providers.forEach(async (provider, index) => {
this.providers[index].disabled = !(await this.providerIsCompatibleWithFilters(provider, ['since', 'until']))
})
this.debouncedFind(this.searchQuery)
},
applyQuickDateRange(range) {
Expand Down