|
143 | 143 | </a-button> |
144 | 144 | </div> |
145 | 145 | <a-modal |
146 | | - :visible="showError" |
| 146 | + v-model:visible="showError" |
147 | 147 | :title="`${$t('label.error')}!`" |
148 | 148 | :maskClosable="false" |
149 | 149 | :closable="true" |
150 | 150 | :footer="null" |
151 | 151 | @cancel="() => { showError = false }" |
152 | 152 | centered |
153 | 153 | > |
154 | | - <div v-ctrl-enter="showError = false"> |
| 154 | + <div v-ctrl-enter="() => showError = false"> |
155 | 155 | <span>{{ $t('message.required.traffic.type') }}</span> |
156 | 156 | <div :span="24" class="action-button"> |
157 | 157 | <a-button @click="showError = false">{{ $t('label.cancel') }}</a-button> |
|
161 | 161 | </a-modal> |
162 | 162 | <a-modal |
163 | 163 | :title="$t('label.edit.traffic.type')" |
164 | | - :visible="showEditTraffic" |
| 164 | + v-model:visible="showEditTraffic" |
165 | 165 | :closable="true" |
166 | 166 | :maskClosable="false" |
167 | 167 | centered |
@@ -323,7 +323,7 @@ export default { |
323 | 323 | return traffics |
324 | 324 | }, |
325 | 325 | hypervisor () { |
326 | | - return this.prefillContent.hypervisor?.value || null |
| 326 | + return this.prefillContent.hypervisor || null |
327 | 327 | } |
328 | 328 | }, |
329 | 329 | created () { |
@@ -414,14 +414,22 @@ export default { |
414 | 414 | const shouldHaveLabels = this.physicalNetworks.length > 1 |
415 | 415 | let isValid = true |
416 | 416 | this.requiredTrafficTypes.forEach(type => { |
| 417 | + if (!isValid) return false |
417 | 418 | let foundType = false |
418 | 419 | this.physicalNetworks.forEach(net => { |
419 | 420 | net.traffics.forEach(traffic => { |
| 421 | + if (!isValid) return false |
420 | 422 | if (traffic.type === type) { |
421 | 423 | foundType = true |
422 | 424 | } |
423 | | - if (shouldHaveLabels && (!traffic.label || traffic.label.length === 0)) { |
424 | | - isValid = false |
| 425 | + if (this.hypervisor !== 'VMware') { |
| 426 | + if (shouldHaveLabels && (!traffic.label || traffic.label.length === 0)) { |
| 427 | + isValid = false |
| 428 | + } |
| 429 | + } else { |
| 430 | + if (shouldHaveLabels && (!traffic.vSwitchName || traffic.vSwitchName.length === 0)) { |
| 431 | + isValid = false |
| 432 | + } |
425 | 433 | } |
426 | 434 | }) |
427 | 435 | }) |
@@ -477,12 +485,12 @@ export default { |
477 | 485 | const fields = {} |
478 | 486 | if (this.hypervisor === 'VMware') { |
479 | 487 | delete this.trafficInEdit.traffic.label |
480 | | - fields.vSwitchName = null |
481 | | - fields.vlanId = null |
| 488 | + fields.vSwitchName = this.trafficInEdit?.traffic?.vSwitchName || null |
| 489 | + fields.vlanId = this.trafficInEdit?.traffic?.vlanId || null |
482 | 490 | if (traffic.type === 'guest') { |
483 | 491 | fields.vSwitchName = this.trafficInEdit?.traffic?.vSwitchName || 'vSwitch0' |
484 | 492 | } |
485 | | - fields.vSwitchType = 'vmwaresvs' |
| 493 | + fields.vSwitchType = this.trafficInEdit?.traffic?.vSwitchType || 'vmwaresvs' |
486 | 494 | } else { |
487 | 495 | delete this.trafficInEdit.traffic.vSwitchName |
488 | 496 | delete this.trafficInEdit.traffic.vlanId |
|
0 commit comments