Skip to content

Commit b447fb1

Browse files
davidjumaniyadvr
authored andcommitted
deployvm: Hiding networks for basic zones (#864)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 8316bc4 commit b447fb1

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

ui/src/views/compute/DeployVM.vue

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@
269269
</a-step>
270270
<a-step
271271
:title="this.$t('label.networks')"
272-
:status="zoneSelected ? 'process' : 'wait'">
272+
:status="zoneSelected ? 'process' : 'wait'"
273+
v-if="zone && zone.networktype !== 'Basic'">
273274
<template slot="description">
274275
<div v-if="zoneSelected">
275276
<div v-if="vm.templateid && templateNics && templateNics.length > 0">
@@ -955,7 +956,7 @@ export default {
955956
return this.$route.query.networkid || null
956957
},
957958
showSecurityGroupSection () {
958-
return this.networks.length > 0 && this.zone.securitygroupsenabled
959+
return (this.networks.length > 0 && this.zone.securitygroupsenabled) || (this.zone && this.zone.networktype === 'Basic')
959960
}
960961
},
961962
watch: {
@@ -1455,52 +1456,54 @@ export default {
14551456
// step 5: select an affinity group
14561457
deployVmData.affinitygroupids = (values.affinitygroupids || []).join(',')
14571458
// step 6: select network
1458-
if ('networkMap' in values) {
1459-
const keys = Object.keys(values.networkMap)
1460-
for (var j = 0; j < keys.length; ++j) {
1461-
if (values.networkMap[keys[j]] && values.networkMap[keys[j]].length > 0) {
1462-
deployVmData['nicnetworklist[' + j + '].nic'] = keys[j].replace('nic-', '')
1463-
deployVmData['nicnetworklist[' + j + '].network'] = values.networkMap[keys[j]]
1459+
if (this.zone.networktype !== 'Basic') {
1460+
if ('networkMap' in values) {
1461+
const keys = Object.keys(values.networkMap)
1462+
for (var j = 0; j < keys.length; ++j) {
1463+
if (values.networkMap[keys[j]] && values.networkMap[keys[j]].length > 0) {
1464+
deployVmData['nicnetworklist[' + j + '].nic'] = keys[j].replace('nic-', '')
1465+
deployVmData['nicnetworklist[' + j + '].network'] = values.networkMap[keys[j]]
1466+
}
14641467
}
1465-
}
1466-
} else {
1467-
const arrNetwork = []
1468-
networkIds = values.networkids
1469-
if (networkIds.length > 0) {
1470-
for (let i = 0; i < networkIds.length; i++) {
1471-
if (networkIds[i] === this.defaultNetwork) {
1472-
const ipToNetwork = {
1473-
networkid: this.defaultNetwork
1474-
}
1475-
arrNetwork.unshift(ipToNetwork)
1476-
} else {
1477-
const ipToNetwork = {
1478-
networkid: networkIds[i]
1468+
} else {
1469+
const arrNetwork = []
1470+
networkIds = values.networkids
1471+
if (networkIds.length > 0) {
1472+
for (let i = 0; i < networkIds.length; i++) {
1473+
if (networkIds[i] === this.defaultNetwork) {
1474+
const ipToNetwork = {
1475+
networkid: this.defaultNetwork
1476+
}
1477+
arrNetwork.unshift(ipToNetwork)
1478+
} else {
1479+
const ipToNetwork = {
1480+
networkid: networkIds[i]
1481+
}
1482+
arrNetwork.push(ipToNetwork)
14791483
}
1480-
arrNetwork.push(ipToNetwork)
14811484
}
1485+
} else {
1486+
this.$notification.error({
1487+
message: this.$t('message.request.failed'),
1488+
description: this.$t('message.step.4.continue')
1489+
})
1490+
this.loading.deploy = false
1491+
return
14821492
}
1483-
} else {
1484-
this.$notification.error({
1485-
message: this.$t('message.request.failed'),
1486-
description: this.$t('message.step.4.continue')
1487-
})
1488-
this.loading.deploy = false
1489-
return
1490-
}
1491-
for (let j = 0; j < arrNetwork.length; j++) {
1492-
deployVmData['iptonetworklist[' + j + '].networkid'] = arrNetwork[j].networkid
1493-
if (this.networkConfig.length > 0) {
1494-
const networkConfig = this.networkConfig.filter((item) => item.key === arrNetwork[j].networkid)
1495-
if (networkConfig && networkConfig.length > 0) {
1496-
deployVmData['iptonetworklist[' + j + '].ip'] = networkConfig[0].ipAddress ? networkConfig[0].ipAddress : undefined
1497-
deployVmData['iptonetworklist[' + j + '].mac'] = networkConfig[0].macAddress ? networkConfig[0].macAddress : undefined
1493+
for (let j = 0; j < arrNetwork.length; j++) {
1494+
deployVmData['iptonetworklist[' + j + '].networkid'] = arrNetwork[j].networkid
1495+
if (this.networkConfig.length > 0) {
1496+
const networkConfig = this.networkConfig.filter((item) => item.key === arrNetwork[j].networkid)
1497+
if (networkConfig && networkConfig.length > 0) {
1498+
deployVmData['iptonetworklist[' + j + '].ip'] = networkConfig[0].ipAddress ? networkConfig[0].ipAddress : undefined
1499+
deployVmData['iptonetworklist[' + j + '].mac'] = networkConfig[0].macAddress ? networkConfig[0].macAddress : undefined
1500+
}
14981501
}
14991502
}
15001503
}
1501-
}
1502-
if (this.securitygroupids.length > 0) {
1503-
deployVmData.securitygroupids = this.securitygroupids.join(',')
1504+
if (this.securitygroupids.length > 0) {
1505+
deployVmData.securitygroupids = this.securitygroupids.join(',')
1506+
}
15041507
}
15051508
// step 7: select ssh key pair
15061509
deployVmData.keypair = values.keypair

0 commit comments

Comments
 (0)