V2Wizard: Add packages to the Review step

This adds packages counter and a table of packages in a popover to the Review step.

The name of the field was also updated to "Additional packages".
This commit is contained in:
regexowl 2024-02-21 16:00:15 +01:00 committed by Lucas Garfield
parent 4c80ab4ad7
commit 2c6c326677
3 changed files with 67 additions and 19 deletions

View file

@ -5,7 +5,10 @@ import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
import { useListRepositoriesQuery } from '../../../../store/contentSourcesApi';
import { useAppSelector } from '../../../../store/hooks';
import { selectCustomRepositories } from '../../../../store/wizardSlice';
import {
selectCustomRepositories,
selectPackages,
} from '../../../../store/wizardSlice';
type repoPropType = {
repoUrl: string[] | undefined;
@ -68,9 +71,33 @@ export const FSReviewTable = () => {
};
export const PackagesTable = () => {
const packages = useAppSelector((state) => selectPackages(state));
return (
<Panel isScrollable>
<PanelMain maxHeight="30ch"></PanelMain>
<PanelMain maxHeight="30ch">
<Table aria-label="Packages table" variant="compact">
<Thead>
<Tr>
<Th>Name</Th>
<Th>Description</Th>
<Th>Package repository</Th>
</Tr>
</Thead>
<Tbody data-testid="packages-tbody-review">
{packages.map((pkg, pkgIndex) => (
<Tr key={pkgIndex}>
<Td className="pf-m-width-30">{pkg.name}</Td>
<Td>{pkg.summary}</Td>
<Td className="pf-m-width-20">
{pkg.repository === 'distro'
? 'Red Hat repository'
: 'Custom repository'}
</Td>
</Tr>
))}
</Tbody>
</Table>
</PanelMain>
</Panel>
);
};