Skip to content

Commit 40035f5

Browse files
authored
[UI] Add dedicated account field dropdown on zone creation (#11195)
1 parent 609efcc commit 40035f5

2 files changed

Lines changed: 30 additions & 3 deletions

File tree

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,6 +3168,7 @@
31683168
"message.error.sbdomain.username": "Please enter SMB domain username.",
31693169
"message.error.secret.key": "Please enter secret key.",
31703170
"message.error.select": "Please select option.",
3171+
"message.error.select.account.to.dedicate": "Please select an account to dedicate to.",
31713172
"message.error.select.domain.to.dedicate": "Please select domain to dedicate to.",
31723173
"message.error.select.zone.type": "Please select Zone type below.",
31733174
"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
@@ -454,6 +469,17 @@ export default {
454469
hypervisor: [{ required: true, message: this.$t('message.error.hypervisor.type') }]
455470
})
456471
},
472+
fetchDomainAccounts (domainid) {
473+
api('listAccounts', {
474+
domainid: domainid
475+
}).then(response => {
476+
// Clean up the selected account from a previous domain
477+
this.form.account = null
478+
this.selectedDomainAccounts = response.listaccountsresponse.account || []
479+
}).catch(error => {
480+
this.$notifyError(error)
481+
})
482+
},
457483
fetchData () {
458484
api('listHypervisors').then(json => {
459485
this.hypervisors = json.listhypervisorsresponse.hypervisor

0 commit comments

Comments
 (0)