Skip to content

Commit 59a2b31

Browse files
committed
Merge remote-tracking branch 'apache/4.18' into main
2 parents 6672c13 + 0ad94ce commit 59a2b31

3 files changed

Lines changed: 121 additions & 37 deletions

File tree

ui/src/views/compute/CreateAutoScaleVmGroup.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,7 @@ export default {
12051205
},
12061206
zones: {
12071207
list: 'listZones',
1208+
networktype: 'Advanced',
12081209
isLoad: true,
12091210
field: 'zoneid'
12101211
},
@@ -2552,7 +2553,7 @@ export default {
25522553
const args = { listall: true, showicon: true }
25532554
if (zoneId) args.id = zoneId
25542555
api(param.list, args).then(json => {
2555-
const zoneResponse = json.listzonesresponse.zone || []
2556+
const zoneResponse = (json.listzonesresponse.zone || []).filter(item => item.securitygroupsenabled === false)
25562557
if (listZoneAllow && listZoneAllow.length > 0) {
25572558
zoneResponse.map(zone => {
25582559
if (listZoneAllow.includes(zone.id)) {

ui/src/views/network/CreateIsolatedNetworkForm.vue

Lines changed: 65 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,36 @@
8585
</a-select-option>
8686
</a-select>
8787
</a-form-item>
88+
<a-form-item ref="account" name="account" v-if="accountVisible">
89+
<template #label>
90+
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.account.description"/>
91+
</template>
92+
<a-select
93+
v-model:value="form.account"
94+
showSearch
95+
optionFilterProp="label"
96+
:filterOption="(input, option) => {
97+
return option.children[0].children.toLowerCase().indexOf(input.toLowerCase()) >= 0
98+
}"
99+
:loading="accountLoading"
100+
:placeholder="apiParams.account.description"
101+
@change="val => { handleAccountChange(accounts[val]) }">
102+
<a-select-option v-for="(opt, optIndex) in accounts" :key="optIndex">
103+
{{ opt.name || opt.description }}
104+
</a-select-option>
105+
</a-select>
106+
</a-form-item>
107+
<a-form-item
108+
ref="networkdomain"
109+
name="networkdomain"
110+
v-if="!isObjectEmpty(selectedNetworkOffering) && !selectedNetworkOffering.forvpc">
111+
<template #label>
112+
<tooltip-label :title="$t('label.networkdomain')" :tooltip="apiParams.networkdomain.description"/>
113+
</template>
114+
<a-input
115+
v-model:value="form.networkdomain"
116+
:placeholder="apiParams.networkdomain.description"/>
117+
</a-form-item>
88118
<a-form-item ref="networkofferingid" name="networkofferingid">
89119
<template #label>
90120
<tooltip-label :title="$t('label.networkofferingid')" :tooltip="apiParams.networkofferingid.description"/>
@@ -261,28 +291,6 @@
261291
</a-col>
262292
</a-row>
263293
</div>
264-
<a-form-item
265-
ref="networkdomain"
266-
name="networkdomain"
267-
v-if="!isObjectEmpty(selectedNetworkOffering) && !selectedNetworkOffering.forvpc">
268-
<template #label>
269-
<tooltip-label :title="$t('label.networkdomain')" :tooltip="apiParams.networkdomain.description"/>
270-
</template>
271-
<a-input
272-
v-model:value="form.networkdomain"
273-
:placeholder="apiParams.networkdomain.description"/>
274-
</a-form-item>
275-
<a-form-item
276-
ref="account"
277-
name="account"
278-
v-if="accountVisible">
279-
<template #label>
280-
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.account.description"/>
281-
</template>
282-
<a-input
283-
v-model:value="form.account"
284-
:placeholder="apiParams.account.description"/>
285-
</a-form-item>
286294
<div :span="24" class="action-button">
287295
<a-button
288296
:loading="actionLoading"
@@ -339,6 +347,10 @@ export default {
339347
domains: [],
340348
domainLoading: false,
341349
selectedDomain: {},
350+
accountVisible: isAdminOrDomainAdmin(),
351+
accounts: [],
352+
accountLoading: false,
353+
selectedAccount: {},
342354
zones: [],
343355
zoneLoading: false,
344356
selectedZone: {},
@@ -348,7 +360,6 @@ export default {
348360
vpcs: [],
349361
vpcLoading: false,
350362
selectedVpc: {},
351-
accountVisible: isAdminOrDomainAdmin(),
352363
privateMtuMax: 1500,
353364
publicMtuMax: 1500,
354365
minMTU: 68,
@@ -466,8 +477,12 @@ export default {
466477
this.accountVisible = domain.id !== '-1'
467478
if (isAdminOrDomainAdmin()) {
468479
this.updateVPCCheckAndFetchNetworkOfferingData()
480+
this.fetchAccounts()
469481
}
470482
},
483+
handleAccountChange (account) {
484+
this.selectedAccount = account
485+
},
471486
updateVPCCheckAndFetchNetworkOfferingData () {
472487
if (this.vpc !== null) { // from VPC section
473488
this.fetchNetworkOfferingData(true)
@@ -544,6 +559,31 @@ export default {
544559
}
545560
})
546561
},
562+
fetchAccounts () {
563+
this.accountLoading = true
564+
var params = {}
565+
if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins
566+
params.domainid = this.selectedDomain.id
567+
}
568+
this.accounts = [
569+
{
570+
id: '-1',
571+
name: ' '
572+
}
573+
]
574+
this.selectedAccount = {}
575+
api('listAccounts', params).then(json => {
576+
const listAccounts = json.listaccountsresponse.account || []
577+
this.accounts = this.accounts.concat(listAccounts)
578+
}).catch(error => {
579+
this.$notifyError(error)
580+
}).finally(() => {
581+
this.accountLoading = false
582+
if (this.arrayHasItems(this.accounts)) {
583+
this.form.account = null
584+
}
585+
})
586+
},
547587
handleSubmit () {
548588
if (this.actionLoading) return
549589
this.formRef.value.validate().then(() => {
@@ -570,8 +610,8 @@ export default {
570610
}
571611
if ('domainid' in values && values.domainid > 0) {
572612
params.domainid = this.selectedDomain.id
573-
if (this.isValidTextValueForKey(values, 'account')) {
574-
params.account = values.account
613+
if (this.isValidTextValueForKey(values, 'account') && this.selectedAccount.id !== '-1') {
614+
params.account = this.selectedAccount.name
575615
}
576616
}
577617
api('createNetwork', params).then(json => {

ui/src/views/network/CreateL2NetworkForm.vue

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,25 @@
8989
</a-select-option>
9090
</a-select>
9191
</a-form-item>
92+
<a-form-item v-if="accountVisible" name="account" ref="account">
93+
<template #label>
94+
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.account.description"/>
95+
</template>
96+
<a-select
97+
v-model:value="form.account"
98+
showSearch
99+
optionFilterProp="label"
100+
:filterOption="(input, option) => {
101+
return option.children[0].children.toLowerCase().indexOf(input.toLowerCase()) >= 0
102+
}"
103+
:loading="accountLoading"
104+
:placeholder="apiParams.account.description"
105+
@change="val => { handleAccountChange(accounts[val]) }">
106+
<a-select-option v-for="(opt, optIndex) in accounts" :key="optIndex">
107+
{{ opt.name || opt.description }}
108+
</a-select-option>
109+
</a-select>
110+
</a-form-item>
92111
<a-form-item name="networkofferingid" ref="networkofferingid">
93112
<template #label>
94113
<tooltip-label :title="$t('label.networkofferingid')" :tooltip="apiParams.networkofferingid.description"/>
@@ -164,14 +183,6 @@
164183
v-model:value="form.isolatedpvlan"
165184
:placeholder="apiParams.isolatedpvlan.description"/>
166185
</a-form-item>
167-
<a-form-item v-if="accountVisible" name="account" ref="account">
168-
<template #label>
169-
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.account.description"/>
170-
</template>
171-
<a-input
172-
v-model:value="form.account"
173-
:placeholder="apiParams.account.description"/>
174-
</a-form-item>
175186
<div :span="24" class="action-button">
176187
<a-button
177188
:loading="actionLoading"
@@ -227,13 +238,16 @@ export default {
227238
domains: [],
228239
domainLoading: false,
229240
selectedDomain: {},
241+
accountVisible: isAdminOrDomainAdmin(),
242+
accounts: [],
243+
accountLoading: false,
244+
selectedAccount: {},
230245
zones: [],
231246
zoneLoading: false,
232247
selectedZone: {},
233248
networkOfferings: [],
234249
networkOfferingLoading: false,
235250
selectedNetworkOffering: {},
236-
accountVisible: isAdminOrDomainAdmin(),
237251
isolatePvlanType: 'none'
238252
}
239253
},
@@ -336,8 +350,12 @@ export default {
336350
this.accountVisible = domain.id !== '-1'
337351
if (isAdminOrDomainAdmin()) {
338352
this.updateVPCCheckAndFetchNetworkOfferingData()
353+
this.fetchAccounts()
339354
}
340355
},
356+
handleAccountChange (account) {
357+
this.selectedAccount = account
358+
},
341359
updateVPCCheckAndFetchNetworkOfferingData () {
342360
if (this.vpc !== null) { // from VPC section
343361
this.fetchNetworkOfferingData(true)
@@ -390,6 +408,31 @@ export default {
390408
handleNetworkOfferingChange (networkOffering) {
391409
this.selectedNetworkOffering = networkOffering
392410
},
411+
fetchAccounts () {
412+
this.accountLoading = true
413+
var params = {}
414+
if (isAdminOrDomainAdmin() && this.selectedDomain.id !== '-1') { // domain is visible only for admins
415+
params.domainid = this.selectedDomain.id
416+
}
417+
this.accounts = [
418+
{
419+
id: '-1',
420+
name: ' '
421+
}
422+
]
423+
this.selectedAccount = {}
424+
api('listAccounts', params).then(json => {
425+
const listAccounts = json.listaccountsresponse.account || []
426+
this.accounts = this.accounts.concat(listAccounts)
427+
}).catch(error => {
428+
this.$notifyError(error)
429+
}).finally(() => {
430+
this.accountLoading = false
431+
if (this.arrayHasItems(this.accounts)) {
432+
this.form.account = null
433+
}
434+
})
435+
},
393436
handleSubmit (e) {
394437
if (this.actionLoading) return
395438
this.formRef.value.validate().then(() => {
@@ -410,8 +453,8 @@ export default {
410453
}
411454
if ('domainid' in values && values.domainid > 0) {
412455
params.domainid = this.selectedDomain.id
413-
if (this.isValidTextValueForKey(values, 'account')) {
414-
params.account = values.account
456+
if (this.isValidTextValueForKey(values, 'account') && this.selectedAccount.id !== '-1') {
457+
params.account = this.selectedAccount.name
415458
}
416459
}
417460
if (this.isValidValueForKey(values, 'isolatedpvlantype') && values.isolatedpvlantype !== 'none') {

0 commit comments

Comments
 (0)