Skip to content

Commit 6d98056

Browse files
author
Hoang Nguyen
authored
ui: Zone wizard - Fixes wrong add resource step with localstorageenabled (#5303)
* zone wizard: fix wrong step for localstorageenabled * fix show zone resource, shorten the if-else
1 parent 21d7854 commit 6d98056

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
<a-step
2727
v-for="(step, index) in steps"
2828
:ref="`resourceStep${index}`"
29-
:key="step.title"
29+
:key="step.formKey"
3030
:title="$t(step.title)"></a-step>
3131
</a-steps>
3232
<static-inputs-form
33-
v-if="currentStep === 0"
33+
v-if="checkVisibleResource('clusterResource')"
3434
@nextPressed="nextPressed"
3535
@backPressed="handleBack"
3636
@fieldsChanged="fieldsChanged"
@@ -43,7 +43,7 @@
4343

4444
<div v-if="hypervisor !== 'VMware'">
4545
<static-inputs-form
46-
v-if="currentStep === 1"
46+
v-if="checkVisibleResource('hostResource')"
4747
@nextPressed="nextPressed"
4848
@backPressed="handleBack"
4949
@fieldsChanged="fieldsChanged"
@@ -54,7 +54,7 @@
5454
:isFixError="isFixError"
5555
/>
5656
<static-inputs-form
57-
v-if="currentStep === 2"
57+
v-if="(!localstorageenabled || !localstorageenabledforsystemvm) && checkVisibleResource('primaryResource')"
5858
@nextPressed="nextPressed"
5959
@backPressed="handleBack"
6060
@fieldsChanged="fieldsChanged"
@@ -65,7 +65,7 @@
6565
:isFixError="isFixError"
6666
/>
6767
<static-inputs-form
68-
v-if="currentStep === 3"
68+
v-if="checkVisibleResource('secondaryResource')"
6969
@nextPressed="nextPressed"
7070
@backPressed="handleBack"
7171
@fieldsChanged="fieldsChanged"
@@ -78,7 +78,7 @@
7878
</div>
7979
<div v-else>
8080
<static-inputs-form
81-
v-if="currentStep === 1"
81+
v-if="checkVisibleResource('primaryResource')"
8282
@nextPressed="nextPressed"
8383
@backPressed="handleBack"
8484
@fieldsChanged="fieldsChanged"
@@ -89,7 +89,7 @@
8989
:isFixError="isFixError"
9090
/>
9191
<static-inputs-form
92-
v-if="currentStep === 2"
92+
v-if="checkVisibleResource('secondaryResource')"
9393
@nextPressed="nextPressed"
9494
@backPressed="handleBack"
9595
@fieldsChanged="fieldsChanged"
@@ -135,11 +135,15 @@ export default {
135135
hypervisor () {
136136
return this.prefillContent.hypervisor ? this.prefillContent.hypervisor.value : null
137137
},
138+
localstorageenabled () {
139+
return this.prefillContent?.localstorageenabled?.value || false
140+
},
141+
localstorageenabledforsystemvm () {
142+
return this.prefillContent?.localstorageenabledforsystemvm?.value || false
143+
},
138144
steps () {
139145
const steps = []
140146
const hypervisor = this.prefillContent.hypervisor ? this.prefillContent.hypervisor.value : null
141-
const localStorageEnabled = this.prefillContent.localstorageenabled.value
142-
const localStorageEnabledForSystemVM = this.prefillContent.localstorageenabledforsystemvm.value
143147
steps.push({
144148
title: 'label.cluster',
145149
fromKey: 'clusterResource',
@@ -152,7 +156,7 @@ export default {
152156
description: 'message.desc.host'
153157
})
154158
}
155-
if (!localStorageEnabled || !localStorageEnabledForSystemVM) {
159+
if (!this.localstorageenabled || !this.localstorageenabledforsystemvm) {
156160
steps.push({
157161
title: 'label.primary.storage',
158162
fromKey: 'primaryResource',
@@ -926,6 +930,10 @@ export default {
926930
},
927931
submitLaunchZone () {
928932
this.$emit('submitLaunchZone')
933+
},
934+
checkVisibleResource (key) {
935+
const formKey = this.steps[this.currentStep]?.fromKey || ''
936+
return formKey === key
929937
}
930938
}
931939
}

0 commit comments

Comments
 (0)