Skip to content

Commit e5becb7

Browse files
mgold1234kingsleyzissou
authored andcommitted
Wizard: Combine alert and empty state in Additional Packages step
This commit removes redundant info alert and moves search instructions into the empty state message. This eliminates duplicate content and provides a cleaner UI with contextual guidance.
1 parent 0ae49be commit e5becb7

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,21 +468,30 @@ const Packages = () => {
468468
<Tr>
469469
<Td colSpan={5}>
470470
<Bullseye>
471-
<EmptyState icon={SearchIcon} variant={EmptyStateVariant.sm}>
472-
{toggleSelected === 'toggle-available' ? (
471+
{toggleSelected === 'toggle-available' ? (
472+
<EmptyState
473+
headingLevel='h4'
474+
titleText='Search packages'
475+
icon={SearchIcon}
476+
variant={EmptyStateVariant.sm}
477+
>
473478
<EmptyStateBody>
474-
Search above to add additional
475-
<br />
476-
packages to your image.
479+
Search for exact matches by specifying the package name to
480+
add additional packages to your image
477481
</EmptyStateBody>
478-
) : (
482+
</EmptyState>
483+
) : (
484+
<EmptyState
485+
headingLevel='h4'
486+
titleText='There are no selected packages'
487+
icon={SearchIcon}
488+
variant={EmptyStateVariant.sm}
489+
>
479490
<EmptyStateBody>
480-
No packages selected.
481-
<br />
482-
Search above to see available packages.
491+
Search above to see available packages
483492
</EmptyStateBody>
484-
)}
485-
</EmptyState>
493+
</EmptyState>
494+
)}
486495
</Bullseye>
487496
</Td>
488497
</Tr>

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import React from 'react';
22

3-
import { Alert, Content, Form, Title } from '@patternfly/react-core';
3+
import { Content, Form, Title } from '@patternfly/react-core';
44

55
import PackageRecommendations from './PackageRecommendations';
66
import Packages from './Packages';
77

8-
import { useIsOnPremise } from '../../../../Hooks';
98
import { useAppSelector } from '../../../../store/hooks';
109
import { selectDistribution } from '../../../../store/wizardSlice';
1110
import isRhel from '../../../../Utilities/isRhel';
1211

1312
const PackagesStep = () => {
1413
const distribution = useAppSelector(selectDistribution);
15-
const isOnPremise = useIsOnPremise();
1614
return (
1715
<Form>
1816
<Title headingLevel='h1' size='xl'>
@@ -21,19 +19,6 @@ const PackagesStep = () => {
2119
<Content>
2220
Blueprints created with Images include all required packages.
2321
</Content>
24-
{!isOnPremise && (
25-
<Alert variant='info' isInline title='Search for package groups'>
26-
Search for package groups by starting your search with the
27-
&apos;@&apos; character. A single &apos;@&apos; as search input lists
28-
all available package groups.
29-
</Alert>
30-
)}
31-
{isOnPremise && (
32-
<Alert variant='info' isInline title='Searching for packages'>
33-
Search for exact matches by specifying the whole package name, or glob
34-
using asterisk wildcards (*) before or after the package name.
35-
</Alert>
36-
)}
3722
<Packages />
3823
{isRhel(distribution) && <PackageRecommendations />}
3924
</Form>

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,27 @@ describe('Step Packages', () => {
225225
});
226226
});
227227

228-
test('should display default state', async () => {
228+
test('should display default state in Available mode', async () => {
229229
await renderCreateMode();
230230
await goToPackagesStep();
231+
await screen.findByRole('heading', {
232+
name: /Search packages/i,
233+
});
231234
await screen.findByText(
232-
'Search above to add additionalpackages to your image.',
235+
/Search for exact matches by specifying the package name to add additional packages to your image/i,
233236
);
234237
});
235238

239+
test('should display correct empty state in Selected mode', async () => {
240+
await renderCreateMode();
241+
await goToPackagesStep();
242+
await toggleSelected();
243+
await screen.findByRole('heading', {
244+
name: /There are no selected packages/i,
245+
});
246+
await screen.findByText(/Search above to see available packages/i);
247+
});
248+
236249
test('search results should be sorted with most relevant results first', async () => {
237250
await renderCreateMode();
238251
await goToPackagesStep();

0 commit comments

Comments
 (0)