v2Wizrd: add kernel and services data
this commit adds kernel arguments and enabled/disabled services to Oscap step. and also add to Review step, add some tests to kernel and services as well.
This commit is contained in:
parent
74f71f2dca
commit
40b1d4de57
6 changed files with 204 additions and 89 deletions
|
|
@ -26,12 +26,23 @@ import {
|
|||
} from '../../../../store/imageBuilderApi';
|
||||
import {
|
||||
changeOscapProfile,
|
||||
changeKernel,
|
||||
selectDistribution,
|
||||
selectProfile,
|
||||
selectKernel,
|
||||
selectDisabledServices,
|
||||
selectEnabledServices,
|
||||
changeDisabledServices,
|
||||
changeEnabledServices,
|
||||
} from '../../../../store/wizardSlice';
|
||||
|
||||
const ProfileSelector = () => {
|
||||
const oscapProfile = useAppSelector((state) => selectProfile(state));
|
||||
let kernel = useAppSelector((state) => selectKernel(state));
|
||||
let disabledServices = useAppSelector((state) =>
|
||||
selectDisabledServices(state)
|
||||
);
|
||||
let enabledServices = useAppSelector((state) => selectEnabledServices(state));
|
||||
const release = useAppSelector((state) => selectDistribution(state));
|
||||
const dispatch = useAppDispatch();
|
||||
const [profileName, setProfileName] = useState<string | undefined>('None');
|
||||
|
|
@ -56,6 +67,26 @@ const ProfileSelector = () => {
|
|||
skip: !oscapProfile,
|
||||
}
|
||||
);
|
||||
kernel = data?.kernel?.append;
|
||||
disabledServices = data?.services?.disabled;
|
||||
enabledServices = data?.services?.enabled;
|
||||
|
||||
useEffect(() => {
|
||||
if (isFetching || !isSuccess) return;
|
||||
dispatch(changeKernel(kernel));
|
||||
dispatch(changeDisabledServices(disabledServices));
|
||||
dispatch(changeEnabledServices(enabledServices));
|
||||
}, [
|
||||
isFetching,
|
||||
isSuccess,
|
||||
dispatch,
|
||||
data?.kernel?.append,
|
||||
data?.services?.disabled,
|
||||
data?.services?.enabled,
|
||||
disabledServices,
|
||||
enabledServices,
|
||||
kernel,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
|
|
@ -76,6 +107,9 @@ const ProfileSelector = () => {
|
|||
|
||||
const handleClear = () => {
|
||||
dispatch(changeOscapProfile(undefined));
|
||||
dispatch(changeKernel(undefined));
|
||||
dispatch(changeDisabledServices(undefined));
|
||||
dispatch(changeEnabledServices(undefined));
|
||||
setProfileName(undefined);
|
||||
};
|
||||
|
||||
|
|
@ -84,6 +118,9 @@ const ProfileSelector = () => {
|
|||
selection: DistributionProfileItem
|
||||
) => {
|
||||
dispatch(changeOscapProfile(selection));
|
||||
dispatch(changeKernel(kernel));
|
||||
dispatch(changeDisabledServices(disabledServices));
|
||||
dispatch(changeEnabledServices(enabledServices));
|
||||
setIsOpen(false);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import React from 'react';
|
||||
|
||||
import {
|
||||
Alert,
|
||||
CodeBlock,
|
||||
CodeBlockCode,
|
||||
Spinner,
|
||||
TextContent,
|
||||
TextList,
|
||||
|
|
@ -17,7 +20,7 @@ import {
|
|||
selectProfile,
|
||||
} from '../../../../store/wizardSlice';
|
||||
|
||||
const OscapProfileInformation = (): JSX.Element => {
|
||||
export const OscapProfileInformation = (): JSX.Element => {
|
||||
const release = useAppSelector((state) => selectDistribution(state));
|
||||
const oscapProfile = useAppSelector((state) => selectProfile(state));
|
||||
|
||||
|
|
@ -36,46 +39,97 @@ const OscapProfileInformation = (): JSX.Element => {
|
|||
}
|
||||
);
|
||||
|
||||
const enabledServicesDisplayString =
|
||||
oscapProfileInfo?.services?.enabled?.join(' ');
|
||||
const disableServicesDisplayString =
|
||||
oscapProfileInfo?.services?.disabled?.join(' ');
|
||||
|
||||
return (
|
||||
<>
|
||||
{isFetchingOscapProfileInfo && <Spinner size="lg" />}
|
||||
{isSuccessOscapProfileInfo && (
|
||||
<TextContent>
|
||||
<br />
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Profile description:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{oscapProfileInfo.openscap?.profile_description}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Operating system:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{RELEASES.get(release)}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Reference ID:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{oscapProfileInfo.openscap?.profile_id}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
</TextContent>
|
||||
<>
|
||||
<TextContent>
|
||||
<br />
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Profile description:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{oscapProfileInfo.openscap?.profile_description}
|
||||
</TextListItem>
|
||||
component={TextListVariants.dl}
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Operating system:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{RELEASES.get(release)}
|
||||
</TextListItem>
|
||||
component={TextListVariants.dl}
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Reference ID:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{oscapProfileInfo.openscap?.profile_id}
|
||||
</TextListItem>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Kernel arguments:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
<CodeBlock>
|
||||
<CodeBlockCode>
|
||||
{oscapProfileInfo?.kernel?.append}
|
||||
</CodeBlockCode>
|
||||
</CodeBlock>
|
||||
</TextListItem>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Disabled services:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
<CodeBlock>
|
||||
<CodeBlockCode>{disableServicesDisplayString}</CodeBlockCode>
|
||||
</CodeBlock>
|
||||
</TextListItem>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Enabled services:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
<CodeBlock>
|
||||
<CodeBlockCode>{enabledServicesDisplayString}</CodeBlockCode>
|
||||
</CodeBlock>
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
</TextContent>
|
||||
|
||||
<Alert
|
||||
variant="info"
|
||||
isInline
|
||||
isPlain
|
||||
title="Additional customizations"
|
||||
>
|
||||
Selecting an OpenSCAP profile will cause the appropriate packages,
|
||||
file system configuration, kernel arguments, and services to be
|
||||
added to your image.
|
||||
</Alert>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import {
|
|||
} from '../../../../constants';
|
||||
import { extractProvisioningList } from '../../../../store/helpers';
|
||||
import { useAppSelector } from '../../../../store/hooks';
|
||||
import { useGetOscapCustomizationsQuery } from '../../../../store/imageBuilderApi';
|
||||
import { useGetSourceListQuery } from '../../../../store/provisioningApi';
|
||||
import { useShowActivationKeyQuery } from '../../../../store/rhsmApi';
|
||||
import {
|
||||
|
|
@ -45,12 +44,12 @@ import {
|
|||
selectGcpAccountType,
|
||||
selectGcpEmail,
|
||||
selectGcpShareMethod,
|
||||
selectProfile,
|
||||
selectRegistrationType,
|
||||
} from '../../../../store/wizardSlice';
|
||||
import { toMonthAndYear } from '../../../../Utilities/time';
|
||||
import { useGetEnvironment } from '../../../../Utilities/useGetEnvironment';
|
||||
import { MajorReleasesLifecyclesChart } from '../../../CreateImageWizard/formComponents/ReleaseLifecycle';
|
||||
import OscapProfileInformation from '../Oscap/OscapProfileInformation';
|
||||
|
||||
const ExpirationWarning = () => {
|
||||
return (
|
||||
|
|
@ -501,54 +500,5 @@ export const ImageDetailsList = () => {
|
|||
};
|
||||
|
||||
export const OscapList = () => {
|
||||
const oscapProfile = useAppSelector((state) => selectProfile(state));
|
||||
const release = useAppSelector((state) => selectDistribution(state));
|
||||
const { data } = useGetOscapCustomizationsQuery(
|
||||
{
|
||||
distribution: release,
|
||||
// @ts-ignore if oscapProfile is undefined the query is going to get skipped, so it's safe here to ignore the linter here
|
||||
profile: oscapProfile,
|
||||
},
|
||||
{
|
||||
skip: !oscapProfile,
|
||||
}
|
||||
);
|
||||
return (
|
||||
<TextContent>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Profile name:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{data?.openscap?.profile_name}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Profile description:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{data?.openscap?.profile_description}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
<TextList component={TextListVariants.dl}>
|
||||
<TextListItem
|
||||
component={TextListItemVariants.dt}
|
||||
className="pf-u-min-width"
|
||||
>
|
||||
Reference ID:
|
||||
</TextListItem>
|
||||
<TextListItem component={TextListItemVariants.dd}>
|
||||
{oscapProfile}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
<br />
|
||||
</TextContent>
|
||||
);
|
||||
return <OscapProfileInformation />;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue