Wizard: Refactor Minimum Size input in File system step to use new component

This commit refactors the Minimun size field by replacing HookValidatedInput with the new ValidatedInputAndTextArea component.
It fixes a bug where the error icon remained visible after the user cleared the value in the field.
This commit is contained in:
Michal Gold 2025-03-16 13:53:43 +02:00 committed by Lucas Garfield
parent 17f975e0ef
commit d448db9a04
3 changed files with 16 additions and 3 deletions

View file

@ -33,7 +33,7 @@ import {
selectPartitions,
} from '../../../../store/wizardSlice';
import { useFilesystemValidation } from '../../utilities/useValidation';
import { HookValidatedInput } from '../../ValidatedInput';
import { ValidatedInputAndTextArea } from '../../ValidatedInput';
export const FileSystemContext = React.createContext<boolean>(true);
@ -253,7 +253,7 @@ const MinimumSize = ({ partition }: MinimumSizePropTypes) => {
const stepValidation = useFilesystemValidation();
return (
<HookValidatedInput
<ValidatedInputAndTextArea
ariaLabel="minimum partition size"
value={partition.min_size}
isDisabled={partition.unit === 'B'}
@ -266,6 +266,7 @@ const MinimumSize = ({ partition }: MinimumSizePropTypes) => {
ouiaId="size"
stepValidation={stepValidation}
fieldName={`min-size-${partition.id}`}
placeholder="File system"
onChange={(event, minSize) => {
if (minSize === '' || /^\d+$/.test(minSize)) {
dispatch(