Skip to content

Commit ead22f9

Browse files
nvazquezdhslove
authored andcommitted
[UI] Add dedicated account field dropdown on zone creation (apache#11195)
1 parent 8864f90 commit ead22f9

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3423,6 +3423,7 @@
34233423
"message.error.sbdomain.username": "Please enter SMB domain username.",
34243424
"message.error.secret.key": "Please enter secret key.",
34253425
"message.error.select": "Please select option.",
3426+
"message.error.select.account.to.dedicate": "Please select an account to dedicate to.",
34263427
"message.error.select.domain.to.dedicate": "Please select domain to dedicate to.",
34273428
"message.error.select.zone.type": "Please select Zone type below.",
34283429
"message.error.server": "Please enter server.",

ui/src/views/infra/zone/ZoneWizardZoneDetailsStep.vue

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@
195195
optionFilterProp="label"
196196
:filterOption="(input, option) => {
197197
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
198-
}" >
198+
}"
199+
@change="val => { fetchDomainAccounts(val) }">
199200
<a-select-option v-for="dom in domains" :key="dom.id" :label="dom.path">
200201
{{ dom.path }}
201202
</a-select-option>
@@ -213,7 +214,20 @@
213214
:label="$t('label.account')"
214215
v-bind="formItemLayout"
215216
v-if="isDedicated">
216-
<a-input v-model:value="form.account" />
217+
<a-select
218+
v-model:value="form.account"
219+
v-focus="true"
220+
showSearch
221+
optionFilterProp="value"
222+
:filterOption="(input, option) => {
223+
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
224+
}"
225+
:placeholder="$t('message.error.select.account.to.dedicate')"
226+
>
227+
<a-select-option v-for="(acc, index) in selectedDomainAccounts" :value="acc.name" :key="index">
228+
{{ acc.name }}
229+
</a-select-option>
230+
</a-select>
217231
</a-form-item>
218232
<a-form-item
219233
name="localstorageenabled"
@@ -276,7 +290,8 @@ export default {
276290
availableNetworkOfferings: null,
277291
ipV4Regex: /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i,
278292
ipV6Regex: /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i,
279-
formModel: {}
293+
formModel: {},
294+
selectedDomainAccounts: []
280295
}),
281296
created () {
282297
this.hypervisors = this.prefillContent?.hypervisors || null
@@ -455,6 +470,17 @@ export default {
455470
hypervisor: [{ required: true, message: this.$t('message.error.hypervisor.type') }]
456471
})
457472
},
473+
fetchDomainAccounts (domainid) {
474+
api('listAccounts', {
475+
domainid: domainid
476+
}).then(response => {
477+
// Clean up the selected account from a previous domain
478+
this.form.account = null
479+
this.selectedDomainAccounts = response.listaccountsresponse.account || []
480+
}).catch(error => {
481+
this.$notifyError(error)
482+
})
483+
},
458484
fetchData () {
459485
getAPI('listHypervisors').then(json => {
460486
this.hypervisors = json.listhypervisorsresponse.hypervisor

0 commit comments

Comments
 (0)