Skip to content

Commit ea2cd07

Browse files
author
Hoang Nguyen
authored
UI - Scale VM - Fix compute offering selection not working (apache#5392)
* scale VM: fix compute offering selection not working * hidden slider when cpuspeed empty & show customiops * remove logs * fix condition * fix condition for coltranned
1 parent aec034b commit ea2cd07

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ui/src/components/view/InfoCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
@click="$message.success(`${$t('label.copied.clipboard')} : ${name}`)"
2727
v-clipboard:copy="name" >
2828
<slot name="avatar">
29-
<os-logo v-if="resource.ostypeid || resource.ostypename" :osId="resource.ostypeid" :osName="resource.ostypename" size="4x" @update-osname="(name) => this.resource.ostypename = name"/>
29+
<os-logo v-if="resource.ostypeid || resource.ostypename" :osId="resource.ostypeid" :osName="resource.ostypename" size="4x" @update-osname="(name) => resource.ostypename = name"/>
3030
<a-icon v-else-if="typeof $route.meta.icon ==='string'" style="font-size: 36px" :type="$route.meta.icon" />
3131
<a-icon v-else style="font-size: 36px" :component="$route.meta.icon" />
3232
</slot>

ui/src/views/compute/ScaleVM.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
@handle-search-filter="($event) => fetchData($event)" />
3333

3434
<compute-selection
35-
v-if="selectedOffering && selectedOffering.iscustomized"
35+
v-if="selectedOffering && (selectedOffering.iscustomized || selectedOffering.iscustomizediops)"
3636
:cpunumber-input-decorator="cpuNumberKey"
3737
:cpuspeed-input-decorator="cpuSpeedKey"
3838
:memory-input-decorator="memoryKey"
@@ -42,6 +42,8 @@
4242
:maxCpu="'serviceofferingdetails' in selectedOffering ? selectedOffering.serviceofferingdetails.maxcpunumber*1 : Number.MAX_SAFE_INTEGER"
4343
:minMemory="getMinMemory()"
4444
:maxMemory="'serviceofferingdetails' in selectedOffering ? selectedOffering.serviceofferingdetails.maxmemory*1 : Number.MAX_SAFE_INTEGER"
45+
:isCustomized="selectedOffering.iscustomized"
46+
:isCustomizedIOps="'iscustomizediops' in selectedOffering && selectedOffering.iscustomizediops"
4547
@update-compute-cpunumber="updateFieldValue"
4648
@update-compute-cpuspeed="updateFieldValue"
4749
@update-compute-memory="updateFieldValue" />
@@ -120,14 +122,14 @@ export default {
120122
if (this.resource.state === 'Running') {
121123
return this.resource.cpunumber
122124
}
123-
return 'serviceofferingdetails' in this.selectedOffering ? this.selectedOffering.serviceofferingdetails.mincpunumber * 1 : 1
125+
return this.selectedOffering?.serviceofferingdetails?.mincpunumber * 1 || 1
124126
},
125127
getMinMemory () {
126128
// We can only scale up while a VM is running
127129
if (this.resource.state === 'Running') {
128130
return this.resource.memory
129131
}
130-
return 'serviceofferingdetails' in this.selectedOffering ? this.selectedOffering.serviceofferingdetails.minmemory * 1 : 32
132+
return this.selectedOffering?.serviceofferingdetails?.minmemory * 1 || 32
131133
},
132134
getMessage () {
133135
if (this.resource.hypervisor === 'VMware') {

ui/src/views/compute/wizard/ComputeSelection.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
:validate-status="errors.cpu.status"
2626
:help="errors.cpu.message">
2727
<a-row :gutter="12">
28-
<a-col :md="10" :lg="10" v-show="isConstrained">
28+
<a-col :md="10" :lg="10" v-show="isConstrained && maxCpu && !isNaN(maxCpu)">
2929
<a-slider
3030
:min="minCpu"
3131
:max="maxCpu"
@@ -61,7 +61,7 @@
6161
:validate-status="errors.memory.status"
6262
:help="errors.memory.message">
6363
<a-row :gutter="12">
64-
<a-col :md="10" :lg="10" v-show="isConstrained">
64+
<a-col :md="10" :lg="10" v-show="isConstrained && maxMemory && !isNaN(maxMemory)">
6565
<a-slider
6666
:min="minMemory"
6767
:max="maxMemory"
@@ -175,7 +175,11 @@ export default {
175175
},
176176
computed: {
177177
colContraned () {
178-
return this.isConstrained ? 12 : 8
178+
if (this.isConstrained && this.maxCpu && !isNaN(this.maxCpu)) {
179+
return 12
180+
}
181+
182+
return 8
179183
}
180184
},
181185
watch: {

0 commit comments

Comments
 (0)