Skip to content

Commit 600d81e

Browse files
author
Hoang Nguyen
authored
UI: Fixes some issues from zone wizard with VMWare hypervisor (#6480)
* hide html warning in message * hidden ip address step * refill value of edit tariff * close modal when icon-close clicked * fixes modal not show when error * check valid traffic label with VMWare * remove automatic change clustername
1 parent d8da5e6 commit 600d81e

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

ui/src/locales/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export const i18n = createI18n({
2626
fallbackLocale: 'en',
2727
silentTranslationWarn: true,
2828
messages: messages,
29-
silentFallbackWarn: true
29+
silentFallbackWarn: true,
30+
warnHtmlInMessage: 'off'
3031
})
3132

3233
export function loadLanguageAsync (lang) {

ui/src/views/infra/ClusterAdd.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,12 @@ export default {
269269
this.addCluster()
270270
},
271271
addCluster () {
272+
let clustername = this.clustername
273+
272274
if (this.hypervisor === 'VMware') {
273275
const clusternameVal = this.clustername
274276
this.url = `http://${this.host}/${this.dataCenter}/${clusternameVal}`
275-
this.clustername = `${this.host}/${this.dataCenter}/${clusternameVal}`
277+
clustername = `${this.host}/${this.dataCenter}/${clusternameVal}`
276278
}
277279
this.loading = true
278280
this.parentToggleLoading()
@@ -281,7 +283,7 @@ export default {
281283
hypervisor: this.hypervisor,
282284
clustertype: this.clustertype,
283285
podId: this.podId,
284-
clustername: this.clustername,
286+
clustername: clustername,
285287
url: this.url
286288
}
287289
if (this.ovm3pool) {

ui/src/views/infra/zone/ZoneWizardAddResources.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ export default {
137137
return this.prefillContent?.hypervisor || null
138138
},
139139
localstorageenabled () {
140-
return this.prefillContent?.localstorageenabled?.value || false
140+
return this.prefillContent?.localstorageenabled || false
141141
},
142142
localstorageenabledforsystemvm () {
143-
return this.prefillContent?.localstorageenabledforsystemvm?.value || false
143+
return this.prefillContent?.localstorageenabledforsystemvm || false
144144
},
145145
steps () {
146146
const steps = []
147-
const hypervisor = this.prefillContent.hypervisor ? this.prefillContent.hypervisor.value : null
147+
const hypervisor = this.prefillContent.hypervisor ? this.prefillContent.hypervisor : null
148148
steps.push({
149149
title: 'label.cluster',
150150
fromKey: 'clusterResource',

ui/src/views/infra/zone/ZoneWizardPhysicalNetworkSetupStep.vue

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@
143143
</a-button>
144144
</div>
145145
<a-modal
146-
:visible="showError"
146+
v-model:visible="showError"
147147
:title="`${$t('label.error')}!`"
148148
:maskClosable="false"
149149
:closable="true"
150150
:footer="null"
151151
@cancel="() => { showError = false }"
152152
centered
153153
>
154-
<div v-ctrl-enter="showError = false">
154+
<div v-ctrl-enter="() => showError = false">
155155
<span>{{ $t('message.required.traffic.type') }}</span>
156156
<div :span="24" class="action-button">
157157
<a-button @click="showError = false">{{ $t('label.cancel') }}</a-button>
@@ -161,7 +161,7 @@
161161
</a-modal>
162162
<a-modal
163163
:title="$t('label.edit.traffic.type')"
164-
:visible="showEditTraffic"
164+
v-model:visible="showEditTraffic"
165165
:closable="true"
166166
:maskClosable="false"
167167
centered
@@ -323,7 +323,7 @@ export default {
323323
return traffics
324324
},
325325
hypervisor () {
326-
return this.prefillContent.hypervisor?.value || null
326+
return this.prefillContent.hypervisor || null
327327
}
328328
},
329329
created () {
@@ -414,14 +414,22 @@ export default {
414414
const shouldHaveLabels = this.physicalNetworks.length > 1
415415
let isValid = true
416416
this.requiredTrafficTypes.forEach(type => {
417+
if (!isValid) return false
417418
let foundType = false
418419
this.physicalNetworks.forEach(net => {
419420
net.traffics.forEach(traffic => {
421+
if (!isValid) return false
420422
if (traffic.type === type) {
421423
foundType = true
422424
}
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+
}
425433
}
426434
})
427435
})
@@ -477,12 +485,12 @@ export default {
477485
const fields = {}
478486
if (this.hypervisor === 'VMware') {
479487
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
482490
if (traffic.type === 'guest') {
483491
fields.vSwitchName = this.trafficInEdit?.traffic?.vSwitchName || 'vSwitch0'
484492
}
485-
fields.vSwitchType = 'vmwaresvs'
493+
fields.vSwitchType = this.trafficInEdit?.traffic?.vSwitchType || 'vmwaresvs'
486494
} else {
487495
delete this.trafficInEdit.traffic.vSwitchName
488496
delete this.trafficInEdit.traffic.vlanId

0 commit comments

Comments
 (0)