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:
regexowl 2025-03-03 14:08:33 +01:00 committed by Klara Simickova
parent 3a85341dbf
commit 5eef2b3f9a
4 changed files with 26 additions and 20 deletions

View file

@ -262,14 +262,10 @@ export function useHostnameValidation(): StepValidation {
export function useKernelValidation(): StepValidation {
const kernel = useAppSelector(selectKernel);
const errors = {};
if (!isKernelNameValid(kernel.name)) {
return {
errors: {
kernel: 'Invalid format.',
},
disabledNext: true,
};
Object.assign(errors, { kernel: 'Invalid format.' });
}
if (kernel.append.length > 0) {
@ -282,14 +278,16 @@ export function useKernelValidation(): StepValidation {
}
if (invalidArgs.length > 0) {
return {
errors: { kernelAppend: `Invalid kernel arguments: ${invalidArgs}` },
disabledNext: true,
};
Object.assign(errors, {
kernelAppend: `Invalid kernel arguments: ${invalidArgs}`,
});
}
}
return { errors: {}, disabledNext: false };
return {
errors: errors,
disabledNext: 'kernel' in errors || 'kernelAppend' in errors,
};
}
export function useFirewallValidation(): StepValidation {