diff options
author | F. E Noel Nfebe <fenn25.fn@gmail.com> | 2025-01-31 12:33:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-31 12:33:30 +0100 |
commit | 8bc5ec187966f00521ba68a832215aaaaa440ed8 (patch) | |
tree | 771e2e2ded13a4f9819a3ba3403aaee9e1c27b99 /core/src | |
parent | 566cecbcc441a479f828a78f634686934f5e16bf (diff) | |
parent | 8863b854204d71cbc1cf412e5abd6a0b7503bf18 (diff) | |
download | nextcloud-server-master.tar.gz nextcloud-server-master.zip |
fix: unified search provider id
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/components/UnifiedSearch/UnifiedSearchModal.vue | 21 | ||||
-rw-r--r-- | core/src/store/unified-search-external-filters.js | 4 | ||||
-rw-r--r-- | core/src/unified-search.ts | 5 |
3 files changed, 17 insertions, 13 deletions
diff --git a/core/src/components/UnifiedSearch/UnifiedSearchModal.vue b/core/src/components/UnifiedSearch/UnifiedSearchModal.vue index a2646780a13..08c3657ce78 100644 --- a/core/src/components/UnifiedSearch/UnifiedSearchModal.vue +++ b/core/src/components/UnifiedSearch/UnifiedSearchModal.vue @@ -121,7 +121,7 @@ </h3> <div v-for="providerResult in results" :key="providerResult.id" class="result"> <h4 :id="`unified-search-result-${providerResult.id}`" class="result-title"> - {{ providerResult.provider }} + {{ providerResult.name }} </h4> <ul class="result-items" :aria-labelledby="`unified-search-result-${providerResult.id}`"> <SearchResult v-for="(result, index) in providerResult.results" @@ -129,14 +129,14 @@ v-bind="result" /> </ul> <div class="result-footer"> - <NcButton type="tertiary-no-background" @click="loadMoreResultsForProvider(providerResult.id)"> + <NcButton type="tertiary-no-background" @click="loadMoreResultsForProvider(providerResult)"> {{ t('core', 'Load more results') }} <template #icon> <IconDotsHorizontal :size="20" /> </template> </NcButton> <NcButton v-if="providerResult.inAppSearch" alignment="end-reverse" type="tertiary-no-background"> - {{ t('core', 'Search in') }} {{ providerResult.provider }} + {{ t('core', 'Search in') }} {{ providerResult.name }} <template #icon> <IconArrowRight :size="20" /> </template> @@ -374,7 +374,7 @@ export default defineComponent({ const providersToSearch = this.filteredProviders.length > 0 ? this.filteredProviders : this.providers const searchProvider = (provider, filters) => { const params = { - type: provider.appId, + type: provider.searchFrom ?? provider.id, query, cursor: null, extraQueries: provider.extraParams, @@ -406,7 +406,9 @@ export default defineComponent({ newResults.push({ id: provider.id, appId: provider.appId, - provider: provider.name, + searchFrom: provider.searchFrom, + icon: provider.icon, + name: provider.name, inAppSearch: provider.inAppSearch, results: response.data.ocs.data.entries, }) @@ -500,11 +502,11 @@ export default defineComponent({ this.debouncedFind(this.searchQuery) unifiedSearchLogger.debug('Person filter applied', { person }) }, - loadMoreResultsForProvider(providerId) { + async loadMoreResultsForProvider(provider) { this.providerResultLimit += 5 - // If user wants more result for a particular filter remove other filters??? - this.filters = this.filters.filter(filter => filter.id === providerId) - const provider = this.providers.find(provider => provider.id === providerId) + // If load more result for filter, remove other filters + this.filters = this.filters.filter(filter => filter.id === provider.id) + this.filteredProviders = this.filteredProviders.filter(filteredProvider => filteredProvider.id === provider.id) this.addProviderFilter(provider, true) }, addProviderFilter(providerFilter, loadMoreResultsForProvider = false) { @@ -531,6 +533,7 @@ export default defineComponent({ this.filteredProviders.push({ id: providerFilter.id, appId: providerFilter.appId, + searchFrom: providerFilter.searchFrom, name: providerFilter.name, icon: providerFilter.icon, type: providerFilter.type || 'provider', diff --git a/core/src/store/unified-search-external-filters.js b/core/src/store/unified-search-external-filters.js index fdc2ba047ca..55de34b8b2a 100644 --- a/core/src/store/unified-search-external-filters.js +++ b/core/src/store/unified-search-external-filters.js @@ -10,8 +10,8 @@ export const useSearchStore = defineStore('search', { }), actions: { - registerExternalFilter({ id, appId, label, callback, icon }) { - this.externalFilters.push({ id, appId, name: label, callback, icon, isPluginFilter: true }) + registerExternalFilter({ id, appId, searchFrom, label, callback, icon }) { + this.externalFilters.push({ id, appId, searchFrom, name: label, callback, icon, isPluginFilter: true }) }, }, }) diff --git a/core/src/unified-search.ts b/core/src/unified-search.ts index fd5f9cb1fdf..a13b1036da1 100644 --- a/core/src/unified-search.ts +++ b/core/src/unified-search.ts @@ -36,6 +36,7 @@ Vue.mixin({ interface UnifiedSearchAction { id: string; appId: string; + searchFrom: string; label: string; icon: string; callback: () => void; @@ -44,9 +45,9 @@ interface UnifiedSearchAction { // Register the add/register filter action API globally window.OCA = window.OCA || {} window.OCA.UnifiedSearch = { - registerFilterAction: ({ id, appId, label, callback, icon }: UnifiedSearchAction) => { + registerFilterAction: ({ id, appId, searchFrom, label, callback, icon }: UnifiedSearchAction) => { const searchStore = useSearchStore() - searchStore.registerExternalFilter({ id, appId, label, callback, icon }) + searchStore.registerExternalFilter({ id, appId, searchFrom, label, callback, icon }) }, } |