Wizard: Add validation for kernel step

This adds validation for the Kernel step.
This commit is contained in:
regexowl 2025-01-20 12:35:48 +01:00 committed by Klara Simickova
parent 2d011c52e1
commit bfef28999d
5 changed files with 64 additions and 1 deletions

View file

@ -4,6 +4,8 @@ import { FormGroup } from '@patternfly/react-core';
import {
Alert,
Button,
HelperText,
HelperTextItem,
MenuToggle,
MenuToggleElement,
Select,
@ -20,6 +22,7 @@ import {
changeKernelName,
selectKernel,
} from '../../../../../store/wizardSlice';
import { useKernelValidation } from '../../../utilities/useValidation';
const initialOptions = ['kernel', 'kernel-debug'];
let kernelOptions = initialOptions;
@ -28,6 +31,8 @@ const KernelName = () => {
const dispatch = useAppDispatch();
const kernel = useAppSelector(selectKernel).name;
const stepValidation = useKernelValidation();
const [isOpen, setIsOpen] = useState(false);
const [inputValue, setInputValue] = useState<string>('');
const [filterValue, setFilterValue] = useState<string>('');
@ -166,6 +171,13 @@ const KernelName = () => {
))}
</SelectList>
</Select>
{stepValidation.errors.kernel && (
<HelperText>
<HelperTextItem variant={'error'}>
{stepValidation.errors.kernel}
</HelperTextItem>
</HelperText>
)}
</FormGroup>
</>
);