V2Wizard: Fix FSC units on Edit

This updates the logic of parsing bytesize into size/unit pair.

Currently 'GiB' is set as a default which causes problem with smaller partitions on Edit.

A validation for the min_size is in place and the rule is that the size cannot be smaller than 0 of a given unit. If there was a partition with smaller size in KiB it will break the rule when converted to GiB.
This commit is contained in:
regexowl 2024-04-30 15:38:50 +02:00 committed by Lucas Garfield
parent 13d35a834e
commit df9ec1499d
7 changed files with 61 additions and 40 deletions

View file

@ -26,7 +26,7 @@ import {
} from '../Components/CreateImageWizardV2/steps/TargetEnvironment/Gcp';
import { V1ListSourceResponseItem } from '../Components/CreateImageWizardV2/types';
import { isBlueprintNameValid } from '../Components/CreateImageWizardV2/validators';
import { RHEL_9, UNIT_GIB, X86_64 } from '../constants';
import { RHEL_9, X86_64 } from '../constants';
import { RootState } from '.';
@ -452,7 +452,7 @@ export const wizardSlice = createSlice({
{
id: uuidv4(),
mountpoint: '/',
min_size: (10 * UNIT_GIB).toString(),
min_size: '10',
unit: 'GiB',
},
];
@ -467,7 +467,7 @@ export const wizardSlice = createSlice({
{
id: uuidv4(),
mountpoint: '/',
min_size: (10 * UNIT_GIB).toString(),
min_size: '10',
unit: 'GiB',
},
];