Wizard: Add Kernel name input
This adds a kernel name input.
This commit is contained in:
parent
7129cf866e
commit
c121e5caba
7 changed files with 169 additions and 6 deletions
|
|
@ -335,6 +335,7 @@ function commonRequestToState(
|
|||
disabled: request.customizations?.services?.disabled || [],
|
||||
},
|
||||
kernel: {
|
||||
name: request.customizations.kernel?.name || '',
|
||||
append: request.customizations?.kernel?.append || '',
|
||||
},
|
||||
timezone: {
|
||||
|
|
@ -539,9 +540,7 @@ const getCustomizations = (state: RootState, orgID: string): Customizations => {
|
|||
users: getUsers(state),
|
||||
services: getServices(state),
|
||||
hostname: selectHostname(state) || undefined,
|
||||
kernel: selectKernel(state).append
|
||||
? { append: selectKernel(state).append }
|
||||
: undefined,
|
||||
kernel: getKernel(state),
|
||||
groups: undefined,
|
||||
timezone: getTimezone(state),
|
||||
locale: getLocale(state),
|
||||
|
|
@ -758,3 +757,16 @@ const getPayloadRepositories = (state: RootState) => {
|
|||
}
|
||||
return payloadAndRecommendedRepositories;
|
||||
};
|
||||
|
||||
const getKernel = (state: RootState) => {
|
||||
const kernel = selectKernel(state);
|
||||
|
||||
if (!kernel.name && !kernel.append) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return {
|
||||
name: selectKernel(state).name || undefined,
|
||||
append: selectKernel(state).append || undefined,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {
|
|||
selectActivationKey,
|
||||
selectRegistrationType,
|
||||
selectHostname,
|
||||
selectKernel,
|
||||
} from '../../../store/wizardSlice';
|
||||
import {
|
||||
getDuplicateMountPoints,
|
||||
|
|
@ -27,6 +28,7 @@ import {
|
|||
isMountpointMinSizeValid,
|
||||
isSnapshotValid,
|
||||
isHostnameValid,
|
||||
isKernelNameValid,
|
||||
} from '../validators';
|
||||
|
||||
export type StepValidation = {
|
||||
|
|
@ -41,6 +43,7 @@ export function useIsBlueprintValid(): boolean {
|
|||
const filesystem = useFilesystemValidation();
|
||||
const snapshot = useSnapshotValidation();
|
||||
const hostname = useHostnameValidation();
|
||||
const kernel = useKernelValidation();
|
||||
const firstBoot = useFirstBootValidation();
|
||||
const details = useDetailsValidation();
|
||||
return (
|
||||
|
|
@ -48,6 +51,7 @@ export function useIsBlueprintValid(): boolean {
|
|||
!filesystem.disabledNext &&
|
||||
!snapshot.disabledNext &&
|
||||
!hostname.disabledNext &&
|
||||
!kernel.disabledNext &&
|
||||
!firstBoot.disabledNext &&
|
||||
!details.disabledNext
|
||||
);
|
||||
|
|
@ -155,6 +159,20 @@ export function useHostnameValidation(): StepValidation {
|
|||
return { errors: {}, disabledNext: false };
|
||||
}
|
||||
|
||||
export function useKernelValidation(): StepValidation {
|
||||
const kernel = useAppSelector(selectKernel);
|
||||
|
||||
if (!isKernelNameValid(kernel.name)) {
|
||||
return {
|
||||
errors: {
|
||||
kernel: 'Invalid kernel name',
|
||||
},
|
||||
disabledNext: true,
|
||||
};
|
||||
}
|
||||
return { errors: {}, disabledNext: false };
|
||||
}
|
||||
|
||||
export function useDetailsValidation(): StepValidation {
|
||||
const name = useAppSelector(selectBlueprintName);
|
||||
const description = useAppSelector(selectBlueprintDescription);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue