saurabhkushwaha438 commented on code in PR #14413:
URL: https://github.com/apache/cloudstack/pull/14413#discussion_r4548488120
##########
ui/src/views/compute/wizard/ComputeSelection.vue:
##########
@@ -57,23 +57,42 @@
</a-col>
<a-col :md="colContraned" :lg="colContraned" v-if="isCustomized">
<a-form-item
- :label="$t('label.memory.mb')"
+ :label="$t('label.memory')"
:validate-status="errors.memory.status"
:help="errors.memory.message">
<a-row :gutter="12">
- <a-col :md="10" :lg="10" v-show="isConstrained && maxMemory &&
!isNaN(maxMemory)">
+ <a-col :md="14" :lg="14" v-show="isConstrained && maxMemory &&
!isNaN(maxMemory) && maxMemory < 1000000000">
<a-slider
- :min="minMemory"
- :max="maxMemory"
- v-model:value="memoryInputValue"
+ :min="minMemoryInUnit"
+ :max="maxMemoryInUnit"
+ :step="memoryStep"
+ v-model:value="memoryDisplayValue"
@change="($event) => updateComputeMemory($event)"
/>
</a-col>
- <a-col :md="4" :lg="4">
- <a-input-number
- v-model:value="memoryInputValue"
- @change="($event) => updateComputeMemory($event)"
- />
+ <a-col :md="isConstrained && maxMemory && !isNaN(maxMemory) &&
maxMemory < 1000000000 ? 10 : 24" :lg="isConstrained && maxMemory &&
!isNaN(maxMemory) && maxMemory < 1000000000 ? 10 : 24">
+ <a-input-group compact style="display: flex">
+ <a-tooltip :title="memoryTooltipText" placement="topLeft"
style="flex: 1; display: flex">
+ <a-input-number
+ style="width: 100%; min-width: 60px"
+ :min="isConstrained ? minMemoryInUnit : 0"
+ :max="isConstrained && maxMemoryInUnit > 0 ?
maxMemoryInUnit : undefined"
+ :step="memoryStep"
+ :precision="memoryUnit === 'GiB' ? 2 : 0"
+ v-model:value="memoryDisplayValue"
+ @change="($event) => updateComputeMemory($event)"
+ />
+ </a-tooltip>
+ <a-select
+ v-model:value="memoryUnit"
+ style="width: 75px"
+ @change="handleUnitChange">
+ <a-select-option value="GiB" :title="!isGiBAllowed ?
$t('message.memory.gib.not.supported') : undefined">
Review Comment:
1.Added :disabled="!isGiBAllowed" to the GiB <a-select-option>
2. When an offering does not support GiB (e.g. limits are not multiples of
256 MiB), the GiB option in the
select dropdown is now disabled with a tooltip explaining why.
3. The guard in handleUnitChange remains as an extra layer of protection
(e.g. when unconstrained
memory values are not multiples of 256 MiB).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]