diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index a95aecc7b33..65d75402fe9 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -1337,12 +1337,9 @@ export default { } this.zone = _.find(this.options.zones, (option) => option.id === instanceConfig.zoneid) this.affinityGroups = _.filter(this.options.affinityGroups, (option) => _.includes(instanceConfig.affinitygroupids, option.id)) - this.networks = _.filter(this.options.networks, (option) => _.includes(instanceConfig.networkids, option.id)) + this.networks = this.getSelectedNetworksWithExistingConfig(_.filter(this.options.networks, (option) => _.includes(instanceConfig.networkids, option.id))) this.diskOffering = _.find(this.options.diskOfferings, (option) => option.id === instanceConfig.diskofferingid) - this.zone = _.find(this.options.zones, (option) => option.id === instanceConfig.zoneid) - this.affinityGroups = _.filter(this.options.affinityGroups, (option) => _.includes(instanceConfig.affinitygroupids, option.id)) - this.networks = _.filter(this.options.networks, (option) => _.includes(instanceConfig.networkids, option.id)) this.sshKeyPair = _.find(this.options.sshKeyPairs, (option) => option.name === instanceConfig.keypair) if (this.zone) { @@ -2594,6 +2591,19 @@ export default { }, handleNicsNetworkSelection (nicToNetworkSelection) { this.nicToNetworkSelection = nicToNetworkSelection + }, + getSelectedNetworksWithExistingConfig (networks) { + for (var i in this.networks) { + var n = this.networks[i] + for (var c of this.networkConfig) { + if (n.id === c.key) { + n = { ...n, ...c } + networks[i] = n + break + } + } + } + return networks } } } diff --git a/ui/src/views/compute/wizard/NetworkConfiguration.vue b/ui/src/views/compute/wizard/NetworkConfiguration.vue index 3f014171a90..a31f7f4cb61 100644 --- a/ui/src/views/compute/wizard/NetworkConfiguration.vue +++ b/ui/src/views/compute/wizard/NetworkConfiguration.vue @@ -172,12 +172,20 @@ export default { const rules = {} this.dataItems.forEach(record => { - rules['ipAddress' + record.id] = [{ + const ipAddressKey = 'ipAddress' + record.id + const macAddressKey = 'macAddress' + record.id + rules[ipAddressKey] = [{ validator: this.validatorIpAddress, cidr: record.cidr, networkType: record.type }] - rules['macAddress' + record.id] = [{ validator: this.validatorMacAddress }] + if (record.ipAddress) { + form[ipAddressKey] = record.ipAddress + } + rules[macAddressKey] = [{ validator: this.validatorMacAddress }] + if (record.macAddress) { + form[macAddressKey] = record.macAddress + } }) this.form = reactive(form) this.rules = reactive(rules) @@ -201,7 +209,7 @@ export default { this.networks.filter((item, index) => { if (item.key === key) { - this.networks[index].name = value + this.networks[index][name] = value } }) this.$emit('update-network-config', this.networks)