]> source.dussan.org Git - nextcloud-server.git/commitdiff
Unified search: update people select with API calls
authorfenn-cs <fenn25.fn@gmail.com>
Mon, 11 Dec 2023 21:43:53 +0000 (22:43 +0100)
committerfenn-cs <fenn25.fn@gmail.com>
Tue, 12 Dec 2023 20:24:52 +0000 (21:24 +0100)
On change/input from user which has the effect of filtering,
 we want to send the query to the API to obtained fresh results,
 based on the databased on not just preloaded contacts.

Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
core/src/components/UnifiedSearch/SearchableList.vue
core/src/views/UnifiedSearchModal.vue

index 43f7ace1b64ac3d82c56f7e863adf7bd9b634b94..33f45d062661f8fd69bb6771e268272c781f9932 100644 (file)
@@ -32,6 +32,7 @@
                                :label="labelText"
                                trailing-button-icon="close"
                                :show-trailing-button="searchTerm !== ''"
+                               @update:value="searchTermChanged"
                                @trailing-button-click="clearSearch">
                                <Magnify :size="20" />
                        </NcTextField>
@@ -126,6 +127,9 @@ export default {
                        this.clearSearch()
                        this.opened = false
                },
+               searchTermChanged(term) {
+                       this.$emit('search-term-change', term)
+               },
        },
 }
 </script>
index 500ed8ebf265f744f5fc0bd1b09205c362d4a15c..db13dd29a953997acd78a67005aa35cb17529c0e 100644 (file)
@@ -56,6 +56,7 @@
                                <SearchableList :label-text="t('core', 'Search people')"
                                        :search-list="userContacts"
                                        :empty-content-text="t('core', 'Not found')"
+                                       @search-term-change="debouncedFilterContacts"
                                        @item-selected="applyPersonFilter">
                                        <template #trigger>
                                                <NcButton>
@@ -199,6 +200,7 @@ export default {
                        results: [],
                        contacts: [],
                        debouncedFind: debounce(this.find, 300),
+                       debouncedFilterContacts: debounce(this.filterContacts, 300),
                        showDateRangeModal: false,
                        internalIsVisible: false,
                }