Skip to content

Commit 714d8d0

Browse files
committed
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 <fenn25.fn@gmail.com>
1 parent 7499fa9 commit 714d8d0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

core/src/views/UnifiedSearchModal.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,22 +299,18 @@ export default {
299299
extraQueries: provider.extraParams,
300300
}
301301
302+
// This block of filter checks should be dynamic somehow and should be handled in
303+
// nextcloud/search lib
302304
if (filters.dateFilterIsApplied) {
303305
if (provider.filters.since && provider.filters.until) {
304306
params.since = this.dateFilter.startFrom
305307
params.until = this.dateFilter.endAt
306-
} else {
307-
// Date filter is applied but provider does not support it, no need to search provider
308-
return
309308
}
310309
}
311310
312311
if (filters.personFilterIsApplied) {
313312
if (provider.filters.person) {
314313
params.person = this.personFilter.user
315-
} else {
316-
// Person filter is applied but provider does not support it, no need to search provider
317-
return
318314
}
319315
}
320316
@@ -415,6 +411,10 @@ export default {
415411
this.filters[existingPersonFilter].name = person.displayName
416412
}
417413
414+
this.providers.forEach(async (provider, index) => {
415+
this.providers[index].disabled = !(await this.providerIsCompatibleWithFilters(provider, ['person']))
416+
})
417+
418418
this.debouncedFind(this.searchQuery)
419419
console.debug('Person filter applied', person)
420420
},
@@ -471,6 +471,7 @@ export default {
471471
if (filter.type === 'person') {
472472
this.personFilterIsApplied = false
473473
}
474+
this.enableAllProviders()
474475
break
475476
}
476477
}
@@ -509,6 +510,9 @@ export default {
509510
this.filters.push(this.dateFilter)
510511
}
511512
this.dateFilterIsApplied = true
513+
this.providers.forEach(async (provider, index) => {
514+
this.providers[index].disabled = !(await this.providerIsCompatibleWithFilters(provider, ['since', 'until']))
515+
})
512516
this.debouncedFind(this.searchQuery)
513517
},
514518
applyQuickDateRange(range) {

0 commit comments

Comments
 (0)