oscap: add the compliance step to the wizard

This commit adds the Compliance step to the wizard. In this step the
user can select a policy from the list of available policies. Their
image is going to be updated with the necessary changes on the later
steps.

IB and The compliance endpoint are both returning the list of policies a
user has access to. The oscap step computes the intersection of the
policies accessible before showing the select list to the user.

HMS-2077
This commit is contained in:
Thomas Lavocat 2023-10-02 14:03:30 +02:00 committed by Klara Simickova
parent 1587ead4d9
commit 02a642df19
6 changed files with 209 additions and 1 deletions

View file

@ -19,6 +19,7 @@ import {
registration,
repositories,
review,
oscap,
} from './steps';
import {
fileSystemConfigurationValidator,
@ -95,6 +96,12 @@ const onSave = (values) => {
}
}
if (values['oscap-policy']) {
customizations.openscap = {
profile_id: values['oscap-policy'],
};
}
const requests = [];
if (values['target-environment']?.aws) {
const options =
@ -470,6 +477,10 @@ const requestToState = (composeRequest, distroInfo, isBeta, isProd) => {
formState['register-system'] = 'register-later';
}
// oscap policy
formState['oscap-policy'] =
composeRequest?.customizations?.openscap?.profile_id;
return formState;
} else {
return;
@ -495,6 +506,8 @@ const formStepHistory = (composeRequest, contentSourcesEnabled) => {
steps.push('registration');
}
steps.push('Compliance');
if (contentSourcesEnabled) {
steps.push('File system configuration', 'packages', 'repositories');
@ -654,6 +667,7 @@ const CreateImageWizard = () => {
fileSystemConfiguration,
imageName,
review,
oscap,
],
initialState: {
activeStep: initialStep || 'image-output', // name of the active step