Skip to content

Commit 8edd709

Browse files
author
Hoang Nguyen
authored
ui: disabled root disk size customization if Service Offering has a fixed size (#4933)
1 parent 7da7c48 commit 8edd709

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

ui/src/views/compute/DeployVM.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@
106106
@update-template-iso="updateFieldValue" />
107107
<span>
108108
{{ $t('label.override.rootdisk.size') }}
109-
<a-switch :disabled="template.deployasis" @change="val => { this.showRootDiskSizeChanger = val }" style="margin-left: 10px;"/>
109+
<a-switch
110+
:checked="showRootDiskSizeChanger && rootDiskSizeFixed > 0"
111+
:disabled="rootDiskSizeFixed > 0 || template.deployasis"
112+
@change="val => { this.showRootDiskSizeChanger = val }"
113+
style="margin-left: 10px;"/>
110114
<div v-if="template.deployasis"> {{ this.$t('message.deployasis') }} </div>
111115
</span>
112116
<disk-size-selection
@@ -185,7 +189,7 @@
185189
</a-form-item>
186190
<compute-offering-selection
187191
:compute-items="options.serviceOfferings"
188-
:selected-template="template"
192+
:selected-template="template ? template : {}"
189193
:row-count="rowCount.serviceOfferings"
190194
:zoneId="zoneId"
191195
:value="serviceOffering ? serviceOffering.id : ''"
@@ -771,7 +775,8 @@ export default {
771775
dataPreFill: {},
772776
showDetails: false,
773777
showRootDiskSizeChanger: false,
774-
securitygroupids: []
778+
securitygroupids: [],
779+
rootDiskSizeFixed: 0
775780
}
776781
},
777782
computed: {
@@ -1422,6 +1427,8 @@ export default {
14221427
}
14231428
if (this.showRootDiskSizeChanger && values.rootdisksize && values.rootdisksize > 0) {
14241429
deployVmData.rootdisksize = values.rootdisksize
1430+
} else if (this.rootDiskSizeFixed > 0) {
1431+
deployVmData.rootdisksize = this.rootDiskSizeFixed
14251432
}
14261433
if (values.hypervisor && values.hypervisor.length > 0) {
14271434
deployVmData.hypervisor = values.hypervisor
@@ -1958,6 +1965,10 @@ export default {
19581965
this.updateFieldValue('memory', this.selectedTemplateConfiguration.memory)
19591966
}
19601967
}
1968+
if (offering && offering.rootdisksize > 0) {
1969+
this.rootDiskSizeFixed = offering.rootdisksize / (1024 * 1024 * 1024.0).toFixed(2)
1970+
this.showRootDiskSizeChanger = false
1971+
}
19611972
}
19621973
}
19631974
}

0 commit comments

Comments
 (0)