-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathKernelArguments.tsx
More file actions
68 lines (59 loc) · 2.14 KB
/
KernelArguments.tsx
File metadata and controls
68 lines (59 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react';
import { FormGroup, HelperText, HelperTextItem } from '@patternfly/react-core';
import LabelInput from '@/Components/CreateImageWizard/LabelInput';
import { useKernelValidation } from '@/Components/CreateImageWizard/utilities/useValidation';
import { isKernelArgumentValid } from '@/Components/CreateImageWizard/validators';
import { usePlatform } from '@/context/platform';
import { useAppSelector } from '@/store/hooks';
import {
addKernelArg,
removeKernelArg,
selectComplianceProfileID,
selectDistribution,
selectKernel,
} from '@/store/slices/wizard';
const KernelArguments = () => {
const {
queries: { useGetOscapCustomizationsQuery },
} = usePlatform();
const kernelAppend = useAppSelector(selectKernel).append;
const stepValidation = useKernelValidation();
const release = useAppSelector(selectDistribution);
const complianceProfileID = useAppSelector(selectComplianceProfileID);
const { data: oscapProfileInfo } = useGetOscapCustomizationsQuery(
{
distribution: release,
// @ts-ignore if complianceProfileID is undefined the query is going to get skipped, so it's safe here to ignore the linter here
profile: complianceProfileID,
},
{
skip: !complianceProfileID,
},
);
const requiredByOpenSCAP = kernelAppend.filter((arg) =>
oscapProfileInfo?.kernel?.append?.split(' ').includes(arg),
);
return (
<FormGroup isRequired={false} label='Arguments'>
<LabelInput
ariaLabel='Add kernel argument'
placeholder='Add kernel argument'
validator={isKernelArgumentValid}
list={kernelAppend.filter((arg) => !requiredByOpenSCAP.includes(arg))}
requiredList={requiredByOpenSCAP}
item='Kernel argument'
addAction={addKernelArg}
removeAction={removeKernelArg}
stepValidation={stepValidation}
fieldName='kernelAppend'
/>
<HelperText className='pf-v6-u-pt-sm'>
<HelperTextItem>
Enter additional kernel boot parameters. Examples: nomodeset or
console=ttyS0.
</HelperTextItem>
</HelperText>
</FormGroup>
);
};
export default KernelArguments;