Skip to content

Commit 2094e6c

Browse files
committed
Wizard: Add "Added by OpenSCAP" label
1 parent 5317628 commit 2094e6c

File tree

1 file changed

+35
-3
lines changed
  • src/Components/CreateImageWizard/steps/Packages

1 file changed

+35
-3
lines changed

src/Components/CreateImageWizard/steps/Packages/index.tsx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import React from 'react';
22

3-
import { Content, Form, Title } from '@patternfly/react-core';
3+
import { Content, Form, Label, Title } from '@patternfly/react-core';
4+
import { InfoCircleIcon } from '@patternfly/react-icons';
45

6+
import { useGetOscapCustomizationsQuery } from '@/store/api/backend';
57
import { selectIsOnPremise } from '@/store/slices/env';
6-
import { selectDistribution } from '@/store/slices/wizard';
8+
import {
9+
selectComplianceProfileID,
10+
selectDistribution,
11+
} from '@/store/slices/wizard';
12+
import { asDistribution } from '@/store/typeGuards';
713

814
import PackageRecommendations from './components/PackageRecommendations';
915
import Packages from './components/Packages';
@@ -15,11 +21,37 @@ import { CustomizationLabels } from '../../../sharedComponents/CustomizationLabe
1521
const PackagesStep = () => {
1622
const distribution = useAppSelector(selectDistribution);
1723
const isOnPremise = useAppSelector(selectIsOnPremise);
24+
const release = useAppSelector(selectDistribution);
25+
const complianceProfileID = useAppSelector(selectComplianceProfileID);
26+
27+
const { data: oscapProfileInfo } = useGetOscapCustomizationsQuery(
28+
{
29+
distribution: asDistribution(release),
30+
// @ts-ignore if complianceProfileID is undefined the query is going to get skipped, so it's safe here to ignore the linter here
31+
profile: complianceProfileID,
32+
},
33+
{
34+
skip: !complianceProfileID,
35+
},
36+
);
37+
38+
const requiredByOpenSCAPCount =
39+
oscapProfileInfo?.packages?.filter(Boolean).length ?? 0;
40+
1841
return (
1942
<Form>
2043
<CustomizationLabels customization='packages' />
21-
<Title headingLevel='h1' size='xl'>
44+
<Title
45+
headingLevel='h1'
46+
size='xl'
47+
className='pf-v6-u-display-flex pf-v6-u-align-items-center'
48+
>
2249
Packages
50+
{requiredByOpenSCAPCount > 0 && (
51+
<Label icon={<InfoCircleIcon />} className='pf-v6-u-ml-sm'>
52+
{requiredByOpenSCAPCount} Added by OpenSCAP
53+
</Label>
54+
)}
2355
</Title>
2456
<Content>
2557
Search and add individual packages to include in your image. You can

0 commit comments

Comments
 (0)