From fe8e43c98979f7473e005882c2d09d0df66dbdd3 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 5 Jul 2024 16:06:23 +0530 Subject: [PATCH 1/3] ui: fix account list on domain change in filterview Fixes #9274 Signed-off-by: Abhishek Kumar --- ui/src/components/view/SearchView.vue | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ui/src/components/view/SearchView.vue b/ui/src/components/view/SearchView.vue index c284b8a635ae..d17ed1b757ef 100644 --- a/ui/src/components/view/SearchView.vue +++ b/ui/src/components/view/SearchView.vue @@ -66,7 +66,8 @@ return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 }" :loading="field.loading" - @input="onchange($event, field.name)"> + @input="onchange($event, field.name)" + @change="onSelectFieldChange(field.name)"> -1) { this.fields[domainIndex].loading = false } + if (accountIndex > -1) { + this.fields[accountIndex].loading = false + } if (imageStoreIndex > -1) { this.fields[imageStoreIndex].loading = false } @@ -584,7 +593,9 @@ export default { if (diskOfferingIndex > -1) { this.fields[diskOfferingIndex].loading = false } - this.fillFormFieldValues() + if (Array.isArray(arrayField)) { + this.fillFormFieldValues() + } }) }, initFormFieldData () { @@ -595,6 +606,9 @@ export default { this.fetchDynamicFieldData(arrayField) }, sortArray (data, key = 'name') { + if (!data) { + return [] + } return data.sort(function (a, b) { if (a[key] < b[key]) { return -1 } if (a[key] > b[key]) { return 1 } @@ -644,7 +658,11 @@ export default { }, fetchAccounts (searchKeyword) { return new Promise((resolve, reject) => { - api('listAccounts', { listAll: true, showicon: true, keyword: searchKeyword }).then(json => { + const params = { listAll: true, showicon: true, keyword: searchKeyword } + if (this.form.domainid) { + params.domainid = this.form.domainid + } + api('listAccounts', params).then(json => { const account = json.listaccountsresponse.account resolve({ type: 'account', From 517258a3eac5bb053ab0b7166f266734236b8c16 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 8 Jul 2024 14:38:28 +0530 Subject: [PATCH 2/3] fix Signed-off-by: Abhishek Kumar --- ui/src/components/view/SearchView.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/components/view/SearchView.vue b/ui/src/components/view/SearchView.vue index d17ed1b757ef..1e8469fa8f85 100644 --- a/ui/src/components/view/SearchView.vue +++ b/ui/src/components/view/SearchView.vue @@ -71,8 +71,8 @@ + :value="['account'].includes(field.name) ? opt.name : opt.id" + :label="$t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path)">
@@ -86,7 +86,7 @@ - {{ $t(opt.path || opt.name) }} + {{ $t((['storageid'].includes(field.name) || !opt.path) ? opt.name : opt.path) }}
From fe1760ab49ccdab2b01c03f4218c67aabaae3357 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 8 Jul 2024 16:55:25 +0530 Subject: [PATCH 3/3] filter accounts for selected domain Signed-off-by: Abhishek Kumar --- ui/src/components/view/SearchView.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/src/components/view/SearchView.vue b/ui/src/components/view/SearchView.vue index 1e8469fa8f85..a43dfabf8689 100644 --- a/ui/src/components/view/SearchView.vue +++ b/ui/src/components/view/SearchView.vue @@ -658,12 +658,15 @@ export default { }, fetchAccounts (searchKeyword) { return new Promise((resolve, reject) => { - const params = { listAll: true, showicon: true, keyword: searchKeyword } + const params = { listAll: true, isrecursive: false, showicon: true, keyword: searchKeyword } if (this.form.domainid) { params.domainid = this.form.domainid } api('listAccounts', params).then(json => { - const account = json.listaccountsresponse.account + var account = json.listaccountsresponse.account + if (this.form.domainid) { + account = account.filter(a => a.domainid === this.form.domainid) + } resolve({ type: 'account', data: account