diff --git a/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/index.tsx b/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/index.tsx index 4a53d3c908..1be5940f80 100644 --- a/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/index.tsx +++ b/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/index.tsx @@ -2,6 +2,9 @@ import React from 'react'; import { Card, CardBody } from '@patternfly/react-core'; +import { useAppSelector } from '@/store/hooks'; +import { selectIsImageMode, selectIsOnPremise } from '@/store/slices'; + import { Filesystem, Firewall, @@ -33,6 +36,8 @@ const AdvancedSettingsOverview = ({ oscapKernelArgs = [], oscapServices, }: AdvancedSettingsOverviewProps) => { + const isOnPremise = useAppSelector(selectIsOnPremise); + const isImageMode = useAppSelector(selectIsImageMode); return ( - + diff --git a/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/tests/AdvancedSettings.test.tsx b/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/tests/AdvancedSettings.test.tsx index 1ab81d7a0c..2ce27caf37 100644 --- a/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/tests/AdvancedSettings.test.tsx +++ b/src/Components/CreateImageWizard/steps/Review/components/AdvancedSettings/tests/AdvancedSettings.test.tsx @@ -901,6 +901,22 @@ echo 'Hello there, General Kenobi!'`; expect(screen.getByText('guest')).toBeInTheDocument(); expect(screen.getAllByText('*****')).toHaveLength(3); }); + + test('does not render users section in on-prem image mode', () => { + renderWithRedux( + , + { + imageTypes: ['guest-image'], + blueprintMode: 'image', + users: [adminUser], + }, + { + preloadedState: { env: { isOnPremise: true } }, + }, + ); + + expect(screen.queryByText('Users')).not.toBeInTheDocument(); + }); }); describe('Firewall', () => { diff --git a/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/index.tsx b/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/index.tsx index f8bf648c85..846e78cbd0 100644 --- a/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/index.tsx +++ b/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/index.tsx @@ -4,6 +4,7 @@ import { Card, CardBody } from '@patternfly/react-core'; import { ON_PREM_RELEASES, RELEASES } from '@/constants'; import { useTargetEnvironmentCategories } from '@/Hooks'; +import { useCustomizationRestrictions } from '@/store/api/distributions'; import { useAppSelector } from '@/store/hooks'; import { selectArchitecture, @@ -18,6 +19,7 @@ import { import { MiscFormats, PrivateClouds, PublicClouds } from './components'; +import { Users } from '../AdvancedSettings/components'; import { ReviewCardHeader, ReviewGroup, ReviewList } from '../shared'; const ImageOverview = () => { @@ -29,8 +31,12 @@ const ImageOverview = () => { const distribution = useAppSelector(selectDistribution); const arch = useAppSelector(selectArchitecture); + const environments = useAppSelector(selectImageTypes); const { publicClouds, privateClouds, miscFormats } = - useTargetEnvironmentCategories(useAppSelector(selectImageTypes)); + useTargetEnvironmentCategories(environments); + const { restrictions } = useCustomizationRestrictions({ + selectedImageTypes: environments, + }); const releases = isOnPremise ? ON_PREM_RELEASES : RELEASES; @@ -70,6 +76,11 @@ const ImageOverview = () => { + diff --git a/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/tests/ImageOverview.test.tsx b/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/tests/ImageOverview.test.tsx index 060783dbd1..bc8eedae9c 100644 --- a/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/tests/ImageOverview.test.tsx +++ b/src/Components/CreateImageWizard/steps/Review/components/ImageOverview/tests/ImageOverview.test.tsx @@ -5,6 +5,7 @@ import { screen } from '@testing-library/react'; import { RHEL_10, X86_64 } from '@/constants'; import { renderWithRedux } from '@/test/testUtils'; +import { adminUser } from '../../AdvancedSettings/tests/mocks'; import ImageOverview from '../index'; describe('ImageOverview', () => { @@ -230,4 +231,48 @@ describe('ImageOverview', () => { ).not.toBeInTheDocument(); }); }); + + describe('Users', () => { + test('displays users section in on-prem image mode', () => { + renderWithRedux( + , + { + imageTypes: ['guest-image'], + blueprintMode: 'image', + users: [adminUser], + }, + { + preloadedState: { env: { isOnPremise: true } }, + }, + ); + + expect(screen.getByText('Users')).toBeInTheDocument(); + expect(screen.getByText('admin')).toBeInTheDocument(); + }); + + test('does not display users section in hosted mode', () => { + renderWithRedux(, { + imageTypes: ['guest-image'], + users: [adminUser], + }); + + expect(screen.queryByText('Users')).not.toBeInTheDocument(); + }); + + test('does not display users section in on-prem package mode', () => { + renderWithRedux( + , + { + imageTypes: ['guest-image'], + blueprintMode: 'package', + users: [adminUser], + }, + { + preloadedState: { env: { isOnPremise: true } }, + }, + ); + + expect(screen.queryByText('Users')).not.toBeInTheDocument(); + }); + }); });