Skip to content

Commit 6aa691c

Browse files
committed
vpc fill gateway and netmask
1 parent 95c2481 commit 6aa691c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

ui/src/views/network/VpcTiersTab.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,43 @@ export default {
617617
this.initForm()
618618
this.fetchNetworkAclList()
619619
this.fetchNetworkOfferings()
620+
const cidr = this.resource.cidr
621+
if (cidr && cidr.includes('/')) {
622+
const [address, maskBits] = cidr.split('/')
623+
this.form.gateway = address
624+
625+
const prefix = Number(maskBits)
626+
627+
const subnetMasks = {
628+
8: '255.0.0.0',
629+
9: '255.128.0.0',
630+
10: '255.192.0.0',
631+
11: '255.224.0.0',
632+
12: '255.240.0.0',
633+
13: '255.248.0.0',
634+
14: '255.252.0.0',
635+
15: '255.254.0.0',
636+
16: '255.255.0.0',
637+
17: '255.255.128.0',
638+
18: '255.255.192.0',
639+
19: '255.255.224.0',
640+
20: '255.255.240.0',
641+
21: '255.255.248.0',
642+
22: '255.255.252.0',
643+
23: '255.255.254.0',
644+
24: '255.255.255.0',
645+
25: '255.255.255.128',
646+
26: '255.255.255.192',
647+
27: '255.255.255.224',
648+
28: '255.255.255.240',
649+
29: '255.255.255.248',
650+
30: '255.255.255.252',
651+
31: '255.255.255.254',
652+
32: '255.255.255.255'
653+
}
654+
655+
this.form.netmask = subnetMasks[prefix] || '255.255.255.0'
656+
}
620657
this.showCreateNetworkModal = true
621658
this.rules = {
622659
name: [{ required: true, message: this.$t('label.required') }],

0 commit comments

Comments
 (0)