V2Wizard: Add packages to requestMapper

This adds packages to the request mapper in a needed format - a flat list of package names.
This commit is contained in:
regexowl 2024-02-26 09:25:17 +01:00 committed by Lucas Garfield
parent 2c6c326677
commit d9f9c61307

View file

@ -31,6 +31,7 @@ import {
selectGcpEmail,
selectGcpShareMethod,
selectImageTypes,
selectPackages,
selectRegistrationType,
selectServerUrl,
} from '../../../store/wizardSlice';
@ -154,7 +155,7 @@ const getCustomizations = (state: RootState, orgID: string): Customizations => {
directories: undefined,
files: undefined,
subscription: getSubscription(state, orgID),
packages: undefined,
packages: getPackages(state),
payload_repositories: undefined,
custom_repositories: undefined,
openscap: undefined,
@ -175,6 +176,16 @@ const getCustomizations = (state: RootState, orgID: string): Customizations => {
};
};
const getPackages = (state: RootState) => {
const packages = selectPackages(state);
if (packages.length > 0) {
return packages.map((pkg) => pkg.name);
} else {
return undefined;
}
};
const getSubscription = (
state: RootState,
orgID: string