chore(FR-831): update ResourcePresetSettingModal to display exact memory value#3540
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🔴 | Statements | 4.62% | 481/10415 |
| 🔴 | Branches | 4.04% | 297/7350 |
| 🔴 | Functions | 2.74% | 90/3288 |
| 🔴 | Lines | 4.57% | 466/10195 |
Test suite run success
161 tests passing in 15 suites.
Report generated by 🧪jest coverage report action from fb95980
ironAiken2
left a comment
There was a problem hiding this comment.
I have the same problem with shared memory, please fix it as well.
7c66f49 to
4ed41d0
Compare
4ed41d0 to
eb9ece5
Compare
3946b5e to
f05487e
Compare
f05487e to
7b08859
Compare
7b08859 to
dcd659f
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refines how memory values are displayed by removing hardcoded “(GB)” labels, introducing new unit-conversion helpers, and updating UI components to show exact or fallback values, especially handling zero correctly.
- Removed “(GB)” suffix from
SharedMemorylabels across all locales - Added
sizeUnitToDecimalSizeUnitandsizeUnitToBinarySizeUnithelper functions - Updated
ResourcePresetSettingModal,ResourcePresetList, andResourceNumberto use auto-scaling conversions and handle zero memory values properly
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/i18n/*.json | Removed the hardcoded “(GB)” suffix from SharedMemory translations |
| react/src/helper/index.tsx | Added DecimalSizeUnit/BinarySizeUnit types and mapping functions sizeUnitToDecimalSizeUnit & sizeUnitToBinarySizeUnit |
| react/src/components/ResourcePresetSettingModal.tsx | Switched memory conversion to use 'auto' when value ≠ 0 and fixed zero display |
| react/src/components/ResourcePresetList.tsx | Enhanced shared-memory column to show primary and fallback unit formats |
| react/src/components/ResourceNumber.tsx | Added secondary fallback display for non-zero memory with auto conversion |
Comments suppressed due to low confidence (1)
react/src/helper/index.tsx:188
- There are no unit tests covering
sizeUnitToDecimalSizeUnitandsizeUnitToBinarySizeUnit. Adding tests will ensure correct mappings and prevent regressions.
return unitMap[unit] || unit;
8c77c5d to
2026ac0
Compare
2026ac0 to
f9dac72
Compare
yomybaby
left a comment
There was a problem hiding this comment.
LGTM but I made a refactoring PR for this PR changes.
Merge activity
|
…ory value (#3540) resolves #3498 (FR-831) **changes** * Changed `convertBinarySizeUnit()` for memory values to initialize to the correct exact via `auto` when using `convertBinarySizeUnit()`. * Changed `ResourcePresetList` to more accurately show the value for `shared memory`. * add `sizeUnitToDecimalSizeUnit` and `sizeUnitToBinarySizeUnit` function. * Fixed strange unit display in modal when memory value was set to 0 * add `NumberWithUnit` component   **Checklist:** (if applicable) - [ ] 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
f9dac72 to
fb95980
Compare

resolves #3498 (FR-831)
changes
convertBinarySizeUnit()for memory values to initialize to the correct exact viaautowhen usingconvertBinarySizeUnit().ResourcePresetListto more accurately show the value forshared memory.sizeUnitToDecimalSizeUnitandsizeUnitToBinarySizeUnitfunction.NumberWithUnitcomponentChecklist: (if applicable)