diff options
author | Grigory Vodyanov <scratchx@gmx.com> | 2024-04-11 20:35:15 +0200 |
---|---|---|
committer | Grigory Vodyanov <scratchx@gmx.com> | 2024-04-11 20:35:15 +0200 |
commit | 7e85f131d3fa2f7b7f176a57f6bf21c0afd62cc3 (patch) | |
tree | 867896c1008c6829bf089d9632af831cf1abf141 | |
parent | efee821a7eeae9cc111b5c4413dd322c45e11ed9 (diff) |
Add searching capability to ContactPickerFix/add-searching-capability-to-contact-picker
Signed-off-by: Grigory Vodyanov <scratchx@gmx.com>
-rw-r--r-- | src/components/EntityPicker/ContactsPicker.vue | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/components/EntityPicker/ContactsPicker.vue b/src/components/EntityPicker/ContactsPicker.vue index e35813ed..72181d49 100644 --- a/src/components/EntityPicker/ContactsPicker.vue +++ b/src/components/EntityPicker/ContactsPicker.vue @@ -13,6 +13,7 @@ :data-types="pickerTypes" :data-set="pickerData" @close="onContactPickerClose" + @search="onSearch" @submit="onContactPickerPick" /> </template> @@ -25,6 +26,8 @@ import { NcModal as Modal } from '@nextcloud/vue' import AddToGroupView from '../../views/Processing/AddToGroupView.vue' import appendContactToGroup from '../../services/appendContactToGroup.js' import EntityPicker from './EntityPicker.vue' +import { getSuggestions } from '../../services/collaborationAutocompletion' +import { showError } from '@nextcloud/dialogs' export default { name: 'ContactsPicker', @@ -167,6 +170,20 @@ export default { }) }, + /** + * On EntityPicker search. + * + * @param {string} term the searched term + */ + async onSearch(term) { + try { + this.pickerData = await getSuggestions(term) + } catch (error) { + console.error('Unable to get the results', error) + showError(t('contacts', 'Unable to get the results')) + } + }, + closeProcess() { this.pickerforGroup = null this.isProcessing = false |