Skip to content

Commit f5b0d2f

Browse files
authored
ui: fix create user domain, account selection (apache#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>
1 parent a42ed1f commit f5b0d2f

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

ui/src/views/iam/AddUser.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
optionFilterProp="children"
9494
:filterOption="(input, option) => {
9595
return option.componentOptions.propsData.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
96-
}" >
96+
}"
97+
@change="val => this.fetchAccount(val)" >
9798
<a-select-option v-for="domain in domainsList" :key="domain.id" :label="domain.path || domain.name || domain.description">
9899
<span>
99100
<resource-icon v-if="domain && domain.icon" :image="domain.icon.base64image" size="1x" style="margin-right: 5px"/>
@@ -192,7 +193,6 @@ export default {
192193
timeZoneMap: [],
193194
domainLoading: false,
194195
domainsList: [],
195-
selectedDomain: '',
196196
samlEnable: false,
197197
idpLoading: false,
198198
idps: [],
@@ -220,36 +220,41 @@ export default {
220220
if (!this.domianid) {
221221
this.fetchDomains()
222222
}
223-
if (!this.account) {
224-
this.fetchAccount()
225-
}
226223
this.fetchTimeZone()
227224
if (this.samlAllowed) {
228225
this.fetchIdps()
229226
}
230227
},
231228
fetchDomains () {
232229
this.domainLoading = true
233-
api('listDomains', {
230+
var params = {
234231
listAll: true,
235232
showicon: true,
236233
details: 'min'
237-
}).then(response => {
234+
}
235+
api('listDomains', params).then(response => {
238236
this.domainsList = response.listdomainsresponse.domain || []
239-
this.selectedDomain = this.domainsList[0].id || ''
240237
}).catch(error => {
241238
this.$notification.error({
242239
message: `${this.$t('label.error')} ${error.response.status}`,
243240
description: error.response.data.errorresponse.errortext
244241
})
245242
}).finally(() => {
243+
const domainid = this.domainsList[0].id || ''
244+
this.form.setFieldsValue({ domainid: domainid })
245+
this.fetchAccount(domainid)
246246
this.domainLoading = false
247247
})
248248
},
249-
fetchAccount () {
249+
fetchAccount (domainid) {
250250
this.accountList = []
251+
this.form.setFieldsValue({ account: null })
251252
this.loadingAccount = true
252-
api('listAccounts', { listAll: true, showicon: true }).then(response => {
253+
var params = { listAll: true, showicon: true }
254+
if (domainid) {
255+
params.domainid = domainid
256+
}
257+
api('listAccounts', params).then(response => {
253258
this.accountList = response.listaccountsresponse.account || []
254259
}).catch(error => {
255260
this.$notification.error({

ui/src/views/iam/ConfigureSamlSsoAuth.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export default {
108108
userid: this.resource.id,
109109
entityid: values.samlEntity
110110
}).then(response => {
111+
this.$emit('refresh-data')
111112
this.$notification.success({
112113
message: values.samlEnable ? this.$t('label.saml.enable') : this.$t('label.saml.disable'),
113114
description: values.samlEnable ? `${this.$t('message.success.enable.saml.auth')} ${this.$t('label.for')} ${this.resource.username}`

0 commit comments

Comments
 (0)