OpenSCAP profile info is now correctly loaded into the state and verified to be in the final request with tests. I modified the fixtures for the OpenSCAP profiles. My changes ensure we have a Venn-diagram like overlap when changing from one profile to another where one package is the same, one package is removed, and one package is added. The same is true for the services and partitions. For kernel args it is not so important as that is just a string (as opposed to an array), so it is enough to be different. I was able to eliminate a useEffect by replacing it with a lazy query trigger function. Setting the second arg `preferCacheValue` to `true` means that a request is only made if cached data is not available. I modified the Redux reducers a bit to add some additional safety. `changeFileSystemPartitionMode` is now responsible for initializing the partitions field in the state by adding the root partition – previously this was done in the components themselves by dispatching `addPartition`. This reducer can always be safely dispatched – if the mode is ‘manual’, dispatching it with a payload of ‘manual’ will not result in any changes to the state. `addPackage` is also safer now. When a package is added, the list of packages is checked. If there is a package with an identical name, the new package overwrites the previous package. This is useful because the description may be different for the same package – for instance, when adding an OpenSCAP package, we use a custom description (‘this package required by OpenSCAP’).
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
|
|
import { FormGroup, Label, Radio } from '@patternfly/react-core';
|
|
|
|
import { useAppDispatch, useAppSelector } from '../../../../store/hooks';
|
|
import {
|
|
changeFileSystemPartitionMode,
|
|
selectFileSystemPartitionMode,
|
|
selectProfile,
|
|
} from '../../../../store/wizardSlice';
|
|
|
|
const FileSystemPartition = () => {
|
|
const dispatch = useAppDispatch();
|
|
const fileSystemPartitionMode = useAppSelector(selectFileSystemPartitionMode);
|
|
const hasOscapProfile = useAppSelector(selectProfile);
|
|
|
|
if (hasOscapProfile) {
|
|
return undefined;
|
|
}
|
|
|
|
return (
|
|
<FormGroup>
|
|
<Radio
|
|
id="automatic file system config radio"
|
|
ouiaId="automatic-configure-fsc-radio"
|
|
label={
|
|
<>
|
|
<Label isCompact color="blue">
|
|
Recommended
|
|
</Label>{' '}
|
|
Use automatic partitioning
|
|
</>
|
|
}
|
|
name="sc-radio-automatic"
|
|
description="Automatically partition your image to what is best, depending on the target environment(s)"
|
|
isChecked={fileSystemPartitionMode === 'automatic'}
|
|
onChange={() => {
|
|
dispatch(changeFileSystemPartitionMode('automatic'));
|
|
}}
|
|
/>
|
|
<Radio
|
|
id="manual file system config radio"
|
|
ouiaId="manual-configure-fsc-radio"
|
|
label="Manually configure partitions"
|
|
name="fsc-radio-manual"
|
|
description="Manually configure the file system of your image by adding, removing, and editing partitions"
|
|
isChecked={fileSystemPartitionMode === 'manual'}
|
|
onChange={() => {
|
|
dispatch(changeFileSystemPartitionMode('manual'));
|
|
}}
|
|
/>
|
|
</FormGroup>
|
|
);
|
|
};
|
|
|
|
export default FileSystemPartition;
|