Wizard: add warning for the min size in bytes

This commit is contained in:
Anna Vítová 2024-11-18 16:38:46 +02:00 committed by Klara Simickova
parent 63e9610beb
commit c75dc5da21
2 changed files with 14 additions and 0 deletions

View file

@ -27,6 +27,7 @@ interface HookValidatedTextInputPropTypes extends TextInputProps {
placeholder?: string;
stepValidation: StepValidation;
fieldName: string;
warning?: string;
}
export const HookValidatedInput = ({
@ -40,6 +41,7 @@ export const HookValidatedInput = ({
stepValidation,
fieldName,
type = 'text',
warning = undefined,
}: HookValidatedTextInputPropTypes) => {
const [isPristine, setIsPristine] = useState(!value ? true : false);
// Do not surface validation on pristine state components
@ -77,6 +79,13 @@ export const HookValidatedInput = ({
</HelperTextItem>
</HelperText>
)}
{warning !== undefined && (
<HelperText>
<HelperTextItem variant="warning" hasIcon>
{warning}
</HelperTextItem>
</HelperText>
)}
</>
);
};

View file

@ -257,6 +257,11 @@ const MinimumSize = ({ partition }: MinimumSizePropTypes) => {
ariaLabel="minimum partition size"
value={partition.min_size}
isDisabled={partition.unit === 'B'}
warning={
partition.unit === 'B'
? 'The Wizard only supports KiB, MiB, or GiB. Adjust or keep the current value.'
: undefined
}
type="text"
ouiaId="size"
stepValidation={stepValidation}