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 <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2022-01-17 16:30:29 +05:30 committed by GitHub
parent a42ed1fb89
commit f5b0d2f056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View File

@ -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({

View File

@ -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}`