Skip to content

Commit 96728c5

Browse files
Merge branch '4.20'
2 parents e57e8cf + f5b4858 commit 96728c5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ui/src/views/network/CreateVpc.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
:placeholder="apiParams.cidr.description"/>
7373
</a-form-item>
7474
<a-form-item
75-
v-if="selectedVpcOffering && selectedVpcOffering.networkmode === 'ROUTED'"
75+
v-if="selectedVpcOfferingHavingRoutedNetworkMode"
7676
ref="cidrsize"
7777
name="cidrsize">
7878
<template #label>
@@ -276,6 +276,9 @@ export default {
276276
return sourcenatService && sourcenatService.length === 1
277277
}
278278
return false
279+
},
280+
selectedVpcOfferingHavingRoutedNetworkMode () {
281+
return this.selectedVpcOffering && this.selectedVpcOffering.networkmode === 'ROUTED'
279282
}
280283
},
281284
methods: {
@@ -397,6 +400,7 @@ export default {
397400
handleVpcOfferingChange (value) {
398401
this.selectedVpcOffering = {}
399402
if (!value) {
403+
this.updateCidrRule()
400404
return
401405
}
402406
for (var offering of this.vpcOfferings) {
@@ -406,9 +410,17 @@ export default {
406410
if (this.isASNumberRequired()) {
407411
this.fetchZoneASNumbers()
408412
}
409-
return
413+
break
410414
}
411415
}
416+
this.updateCidrRule()
417+
},
418+
updateCidrRule () {
419+
if (!this.selectedVpcOfferingHavingRoutedNetworkMode) {
420+
this.rules.cidr = [{ required: true, message: this.$t('message.error.required.input') }]
421+
} else {
422+
delete this.rules.cidr
423+
}
412424
},
413425
handleASNumberChange (selectedIndex) {
414426
this.selectedAsNumber = this.asNumbersZone[selectedIndex].asnumber

0 commit comments

Comments
 (0)