Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 28 13:49:54 UTC 2024 - Martin Vidner <mvidner@suse.com>

- In Add/Edit file system dialog (VolumeDialog), keep the numeric value
when switching between Fixed and Range sizing (gh#openSUSE/agama#1277)

-------------------------------------------------------------------
Fri Jun 28 06:56:02 UTC 2024 - Martin Vidner <mvidner@suse.com>

Expand Down
7 changes: 1 addition & 6 deletions web/src/components/storage/VolumeDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ import {
* @property {VolumeFormErrors} errors
*
* @typedef {object} VolumeFormData
* @property {number|string} [size]
* @property {string} [sizeUnit]
* @property {number|string} [minSize]
* @property {string} [minSizeUnit]
* @property {number|string} [maxSize]
Expand Down Expand Up @@ -490,7 +488,6 @@ const sanitizeMountPath = (mountPath) => {
*/
const createUpdatedVolume = (volume, formData) => {
let sizeAttrs = {};
const size = parseToBytes(`${formData.size} ${formData.sizeUnit}`);
const minSize = parseToBytes(`${formData.minSize} ${formData.minSizeUnit}`);
const maxSize = parseToBytes(`${formData.maxSize} ${formData.maxSizeUnit}`);

Expand All @@ -499,7 +496,7 @@ const createUpdatedVolume = (volume, formData) => {
sizeAttrs = { minSize: undefined, maxSize: undefined, autoSize: true };
break;
case SIZE_METHODS.MANUAL:
sizeAttrs = { minSize: size, maxSize: size, autoSize: false };
sizeAttrs = { minSize, maxSize: minSize, autoSize: false };
break;
case SIZE_METHODS.RANGE:
sizeAttrs = { minSize, maxSize: formData.maxSize ? maxSize : undefined, autoSize: false };
Expand Down Expand Up @@ -543,8 +540,6 @@ const prepareFormData = (volume) => {
const { size: maxSize = "", unit: maxSizeUnit = minSizeUnit || DEFAULT_SIZE_UNIT } = splitSize(volume.maxSize);

return {
size: minSize,
sizeUnit: minSizeUnit,
minSize,
minSizeUnit,
maxSize,
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/storage/VolumeFields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ const SizeManual = ({ errors, formData, isDisabled, onChange }) => {
// (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)
// or use the "globalize" JS library which can also parse the localized string back
// (https://github.com/globalizejs/globalize#number-module)
value={formData.size}
onChange={(size) => onChange({ size })}
validated={errors.size && 'error'}
value={formData.minSize}
onChange={(minSize) => onChange({ minSize })}
validated={errors.minSize && 'error'}
isDisabled={isDisabled}
/>
</InputGroupItem>
Expand All @@ -334,8 +334,8 @@ const SizeManual = ({ errors, formData, isDisabled, onChange }) => {
// TRANSLATORS: units selector (like KiB, MiB, GiB...)
aria-label={_("Size unit")}
units={Object.values(SIZE_UNITS)}
value={formData.sizeUnit}
onChange={(_, sizeUnit) => onChange({ sizeUnit })}
value={formData.minSizeUnit}
onChange={(_, minSizeUnit) => onChange({ minSizeUnit })}
isDisabled={isDisabled}
/>
</InputGroupItem>
Expand Down