Skip to content

Commit 44ee94f

Browse files
committed
fix(FR-819): Fix share unit of resource preset. (#3489)
Resolves #3485 ([FR-819](https://lablup.atlassian.net/browse/FR-819)) ## Add `stringMode` to InputNumber for Resource Preset Settings This PR adds the `stringMode` prop to the InputNumber component in the ResourcePresetSettingModal. This change ensures that decimal values are properly handled when users input resource allocation values, particularly for fields with fractional values. **Changes:** - Added `stringMode={true}` to the InputNumber component to preserve decimal precision in resource preset settings **Checklist:** - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after [FR-819]: https://lablup.atlassian.net/browse/FR-819?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent b898457 commit 44ee94f

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

react/src/components/ResourcePresetList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const ResourcePresetList: React.FC<ResourcePresetListProps> = () => {
103103
title: t('resourcePreset.SharedMemory'),
104104
dataIndex: 'shared_memory',
105105
render: (text) =>
106-
text ? convertBinarySizeUnit(text + '', 'g')?.number : '-',
106+
text ? convertBinarySizeUnit(text + '', 'g')?.numberFixed : '-',
107107
},
108108
baiClient?.supports('resource-presets-per-resource-group') && {
109109
title: t('general.ResourceGroup'),

react/src/components/ResourcePresetSettingModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ const ResourcePresetSettingModal: React.FC<ResourcePresetSettingModalProps> = ({
331331
<DynamicUnitInputNumber />
332332
) : (
333333
<InputNumber
334+
stringMode
334335
min={resourceSlotKey === 'cpu' ? 1 : 0}
335336
step={
336337
_.includes(resourceSlotKey, '.shares') ? 0.1 : 1

0 commit comments

Comments
 (0)