Wizard: Fix kernel validation
Kernel validation worked only for one invalid field on the step. Now it is able to validate both.
This commit is contained in:
parent
3a85341dbf
commit
5eef2b3f9a
4 changed files with 26 additions and 20 deletions
|
|
@ -23,6 +23,7 @@ import {
|
|||
selectKernel,
|
||||
} from '../../../../../store/wizardSlice';
|
||||
import { useKernelValidation } from '../../../utilities/useValidation';
|
||||
import { isKernelNameValid } from '../../../validators';
|
||||
|
||||
const initialOptions = ['kernel', 'kernel-debug'];
|
||||
let kernelOptions = initialOptions;
|
||||
|
|
@ -48,7 +49,9 @@ const KernelName = () => {
|
|||
if (!filteredKernelPkgs.some((kernel) => kernel === filterValue)) {
|
||||
filteredKernelPkgs = [
|
||||
...filteredKernelPkgs,
|
||||
`Custom kernel package "${filterValue}"`,
|
||||
isKernelNameValid(filterValue)
|
||||
? `Custom kernel package "${filterValue}"`
|
||||
: `"${filterValue}" is not a valid kernel package name`,
|
||||
];
|
||||
}
|
||||
if (!isOpen) {
|
||||
|
|
@ -165,7 +168,11 @@ const KernelName = () => {
|
|||
>
|
||||
<SelectList>
|
||||
{selectOptions.map((option) => (
|
||||
<SelectOption key={option} value={option}>
|
||||
<SelectOption
|
||||
key={option}
|
||||
value={option}
|
||||
isDisabled={/not a valid kernel package name/i.test(option)}
|
||||
>
|
||||
{option}
|
||||
</SelectOption>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue