From 8617265a48310f7cbdb135a27dbc67807dd54669 Mon Sep 17 00:00:00 2001
From: Ferdinand Thiessen <opensource@fthiessen.de>
Date: Thu, 21 Mar 2024 14:10:55 +0100
Subject: fix(workflowengine): Use correct event for searching for groups

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
---
 .../src/components/Checks/RequestUserGroup.vue      | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

(limited to 'apps/workflowengine/src/components/Checks/RequestUserGroup.vue')

diff --git a/apps/workflowengine/src/components/Checks/RequestUserGroup.vue b/apps/workflowengine/src/components/Checks/RequestUserGroup.vue
index 2b248153aa6..ee774b7939f 100644
--- a/apps/workflowengine/src/components/Checks/RequestUserGroup.vue
+++ b/apps/workflowengine/src/components/Checks/RequestUserGroup.vue
@@ -22,21 +22,26 @@
 
 <template>
 	<div>
-		<NcSelect :value="currentValue"
+		<NcSelect :aria-label-combobox="t('workflowengine', 'Select groups')"
+			:aria-label-listbox="t('workflowengine', 'Groups')"
+			:clearable="false"
 			:loading="status.isLoading && groups.length === 0"
+			:placeholder="t('workflowengine', 'Type to search for group …')"
 			:options="groups"
-			:clearable="false"
+			:value="currentValue"
 			label="displayname"
-			@search-change="searchAsync"
+			@search="searchAsync"
 			@input="(value) => $emit('input', value.id)" />
 	</div>
 </template>
 
 <script>
-import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
-import axios from '@nextcloud/axios'
+import { translate as t } from '@nextcloud/l10n'
 import { generateOcsUrl } from '@nextcloud/router'
 
+import axios from '@nextcloud/axios'
+import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
+
 const groups = []
 const status = {
 	isLoading: false,
@@ -69,14 +74,18 @@ export default {
 		},
 	},
 	async mounted() {
+		// If empty, load first chunk of groups
 		if (this.groups.length === 0) {
 			await this.searchAsync('')
 		}
-		if (this.currentValue === null) {
+		// If a current group is set but not in our list of groups then search for that group
+		if (this.currentValue === null && this.value) {
 			await this.searchAsync(this.value)
 		}
 	},
 	methods: {
+		t,
+
 		searchAsync(searchQuery) {
 			if (this.status.isLoading) {
 				return
-- 
cgit v1.2.3

