From 2f3358e6ea2c59c8cda40a9ad2d0e3673421e1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C5=BEe=20Fortun?= Date: Wed, 20 Nov 2024 11:26:06 +0100 Subject: [PATCH] Fix searching record selector prompts if no queryFields is set --- .../src/components/ModuleFields/Editor/Record.vue | 2 +- .../prompts/kinds/CPromptComposeRecordPicker.vue | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/web/compose/src/components/ModuleFields/Editor/Record.vue b/client/web/compose/src/components/ModuleFields/Editor/Record.vue index 9f4617425..fa21c76ee 100644 --- a/client/web/compose/src/components/ModuleFields/Editor/Record.vue +++ b/client/web/compose/src/components/ModuleFields/Editor/Record.vue @@ -379,7 +379,7 @@ export default { this.fetchPrefiltered({ namespaceID, moduleID, query, sort: this.sortString(), limit, pageCursor }) } - }, 300), + }, 600), loadLatest () { const namespaceID = this.namespace.namespaceID diff --git a/lib/vue/src/components/prompts/kinds/CPromptComposeRecordPicker.vue b/lib/vue/src/components/prompts/kinds/CPromptComposeRecordPicker.vue index b0a8051c0..49959703d 100644 --- a/lib/vue/src/components/prompts/kinds/CPromptComposeRecordPicker.vue +++ b/lib/vue/src/components/prompts/kinds/CPromptComposeRecordPicker.vue @@ -182,12 +182,14 @@ export default { const { limit, pageCursor } = this.filter const namespaceID = this.namespaceID const moduleID = this.module.moduleID + const queryFields = this.pVal('queryFields') || [] if (moduleID && moduleID !== NoID) { // Determine what fields to use for searching // Default to label field - let qf = this.pVal('queryFields').map(f => f['@value']).filter(f => !!f) - if (!qf || qf.length === 0) { + let qf = queryFields.map(f => f['@value']).filter(f => !!f) + + if ((!qf || qf.length === 0) && this.pVal('labelField')) { qf = [this.pVal('labelField')] } @@ -198,9 +200,11 @@ export default { }).join(' OR ') } - this.fetchPrefiltered({ namespaceID, moduleID, query, limit }) + const sort = qf.filter(f => !!f).join(', ') + + this.fetchPrefiltered({ namespaceID, moduleID, query, sort, limit }) } - }, 300), + }, 600), fetchPrefiltered (q) { this.processing = true