This is an automated email from the ASF dual-hosted git repository.

sureshanaparti pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.16 by this push:
     new f5b0d2f  ui: fix create user domain, account selection (#5487)
f5b0d2f is described below

commit f5b0d2f056f3e8cc02124f8f3236d7703f67ef2f
Author: Abhishek Kumar <[email protected]>
AuthorDate: Mon Jan 17 16:30:29 2022 +0530

    ui: fix create user domain, account selection (#5487)
    
    * ui: fix create user domain, account selection
    
    * fetch accounts only after domains
    
    * refresh on saml configure
    
    Signed-off-by: Abhishek Kumar <[email protected]>
---
 ui/src/views/iam/AddUser.vue              | 25 +++++++++++++++----------
 ui/src/views/iam/ConfigureSamlSsoAuth.vue |  1 +
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/ui/src/views/iam/AddUser.vue b/ui/src/views/iam/AddUser.vue
index f57585c..3275cc6 100644
--- a/ui/src/views/iam/AddUser.vue
+++ b/ui/src/views/iam/AddUser.vue
@@ -93,7 +93,8 @@
             optionFilterProp="children"
             :filterOption="(input, option) => {
               return 
option.componentOptions.propsData.label.toLowerCase().indexOf(input.toLowerCase())
 >= 0
-            }" >
+            }"
+            @change="val => this.fetchAccount(val)" >
             <a-select-option v-for="domain in domainsList" :key="domain.id" 
:label="domain.path || domain.name || domain.description">
               <span>
                 <resource-icon v-if="domain && domain.icon" 
:image="domain.icon.base64image" size="1x" style="margin-right: 5px"/>
@@ -192,7 +193,6 @@ export default {
       timeZoneMap: [],
       domainLoading: false,
       domainsList: [],
-      selectedDomain: '',
       samlEnable: false,
       idpLoading: false,
       idps: [],
@@ -220,9 +220,6 @@ export default {
       if (!this.domianid) {
         this.fetchDomains()
       }
-      if (!this.account) {
-        this.fetchAccount()
-      }
       this.fetchTimeZone()
       if (this.samlAllowed) {
         this.fetchIdps()
@@ -230,26 +227,34 @@ export default {
     },
     fetchDomains () {
       this.domainLoading = true
-      api('listDomains', {
+      var params = {
         listAll: true,
         showicon: true,
         details: 'min'
-      }).then(response => {
+      }
+      api('listDomains', params).then(response => {
         this.domainsList = response.listdomainsresponse.domain || []
-        this.selectedDomain = this.domainsList[0].id || ''
       }).catch(error => {
         this.$notification.error({
           message: `${this.$t('label.error')} ${error.response.status}`,
           description: error.response.data.errorresponse.errortext
         })
       }).finally(() => {
+        const domainid = this.domainsList[0].id || ''
+        this.form.setFieldsValue({ domainid: domainid })
+        this.fetchAccount(domainid)
         this.domainLoading = false
       })
     },
-    fetchAccount () {
+    fetchAccount (domainid) {
       this.accountList = []
+      this.form.setFieldsValue({ account: null })
       this.loadingAccount = true
-      api('listAccounts', { listAll: true, showicon: true }).then(response => {
+      var params = { listAll: true, showicon: true }
+      if (domainid) {
+        params.domainid = domainid
+      }
+      api('listAccounts', params).then(response => {
         this.accountList = response.listaccountsresponse.account || []
       }).catch(error => {
         this.$notification.error({
diff --git a/ui/src/views/iam/ConfigureSamlSsoAuth.vue 
b/ui/src/views/iam/ConfigureSamlSsoAuth.vue
index 63ba49a..182e79b 100644
--- a/ui/src/views/iam/ConfigureSamlSsoAuth.vue
+++ b/ui/src/views/iam/ConfigureSamlSsoAuth.vue
@@ -108,6 +108,7 @@ export default {
           userid: this.resource.id,
           entityid: values.samlEntity
         }).then(response => {
+          this.$emit('refresh-data')
           this.$notification.success({
             message: values.samlEnable ? this.$t('label.saml.enable') : 
this.$t('label.saml.disable'),
             description: values.samlEnable ? 
`${this.$t('message.success.enable.saml.auth')} ${this.$t('label.for')} 
${this.resource.username}`

Reply via email to