Compliance: refactor handleKernelAppend duplicate
This commit is contained in:
parent
96da1817df
commit
cfa8cbcb28
3 changed files with 16 additions and 26 deletions
|
|
@ -20,7 +20,6 @@ import {
|
|||
useLazyGetOscapCustomizationsForPolicyQuery,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import {
|
||||
addKernelArg,
|
||||
changeCompliance,
|
||||
changeFileSystemConfigurationType,
|
||||
clearKernelAppend,
|
||||
|
|
@ -83,6 +82,7 @@ const PolicySelector = () => {
|
|||
const [isOpen, setIsOpen] = useState(false);
|
||||
const {
|
||||
clearCompliancePackages,
|
||||
handleKernelAppend,
|
||||
handlePackages,
|
||||
handlePartitions,
|
||||
handleServices,
|
||||
|
|
@ -145,17 +145,6 @@ const PolicySelector = () => {
|
|||
dispatch(clearKernelAppend());
|
||||
};
|
||||
|
||||
const handleKernelAppend = (kernelAppend: string | undefined) => {
|
||||
dispatch(clearKernelAppend());
|
||||
|
||||
if (kernelAppend) {
|
||||
const kernelArgsArray = kernelAppend.split(' ');
|
||||
for (const arg of kernelArgsArray) {
|
||||
dispatch(addKernelArg(arg));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const applyChanges = (selection: ComplianceSelectOptionValueType) => {
|
||||
if (selection.policyID === undefined) {
|
||||
// handle user has selected 'None' case
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import {
|
|||
OpenScapProfile,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import {
|
||||
addKernelArg,
|
||||
changeCompliance,
|
||||
changeFileSystemConfigurationType,
|
||||
clearKernelAppend,
|
||||
|
|
@ -40,8 +39,6 @@ import {
|
|||
selectDistribution,
|
||||
} from '../../../../../store/wizardSlice';
|
||||
import { useHasSpecificTargetOnly } from '../../../utilities/hasSpecificTargetOnly';
|
||||
import { parseSizeUnit } from '../../../utilities/parseSizeUnit';
|
||||
import { Partition, Units } from '../../FileSystem/components/FileSystemTable';
|
||||
import { removeBetaFromRelease } from '../removeBetaFromRelease';
|
||||
|
||||
type OScapSelectOptionValueType = {
|
||||
|
|
@ -75,6 +72,7 @@ const ProfileSelector = () => {
|
|||
const prefetchProfile = useBackendPrefetch('getOscapCustomizations');
|
||||
const {
|
||||
clearCompliancePackages,
|
||||
handleKernelAppend,
|
||||
handlePackages,
|
||||
handlePartitions,
|
||||
handleServices,
|
||||
|
|
@ -187,17 +185,6 @@ const ProfileSelector = () => {
|
|||
setFilterValue('');
|
||||
};
|
||||
|
||||
const handleKernelAppend = (kernelAppend: string | undefined) => {
|
||||
dispatch(clearKernelAppend());
|
||||
|
||||
if (kernelAppend) {
|
||||
const kernelArgsArray = kernelAppend.split(' ');
|
||||
for (const arg of kernelArgsArray) {
|
||||
dispatch(addKernelArg(arg));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onInputClick = () => {
|
||||
if (!isOpen) {
|
||||
setIsOpen(true);
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ import { v4 as uuidv4 } from 'uuid';
|
|||
import { useAppDispatch } from '../../../../../store/hooks';
|
||||
import { Filesystem, Services } from '../../../../../store/imageBuilderApi';
|
||||
import {
|
||||
addKernelArg,
|
||||
addPackage,
|
||||
addPartition,
|
||||
changeDisabledServices,
|
||||
changeEnabledServices,
|
||||
changeFileSystemConfigurationType,
|
||||
changeMaskedServices,
|
||||
clearKernelAppend,
|
||||
clearPartitions,
|
||||
removePackage,
|
||||
} from '../../../../../store/wizardSlice';
|
||||
|
|
@ -24,6 +26,17 @@ export const useSelectorHandlers = () => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleKernelAppend = (kernelAppend: string | undefined) => {
|
||||
dispatch(clearKernelAppend());
|
||||
|
||||
if (kernelAppend) {
|
||||
const kernelArgsArray = kernelAppend.split(' ');
|
||||
for (const arg of kernelArgsArray) {
|
||||
dispatch(addKernelArg(arg));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handlePackages = (
|
||||
oldOscapPackages: string[],
|
||||
newOscapPackages: string[],
|
||||
|
|
@ -72,6 +85,7 @@ export const useSelectorHandlers = () => {
|
|||
|
||||
return {
|
||||
clearCompliancePackages,
|
||||
handleKernelAppend,
|
||||
handlePackages,
|
||||
handleServices,
|
||||
handlePartitions,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue