Commit graph

279 commits

Author SHA1 Message Date
Thomas Lavocat
7c55190ac3 fsc: load the oscap profile when available.
When the user has selected a profile to customize their distribution,
the FSC step now shows immediately the manual configuration opened up
with the partitions coming from the profile already filled in.

If the user goes back to the Compliance step and changes anything, the
FSC step is going to be reinitialized.

HMS-2077
2023-10-06 16:26:09 +02:00
Thomas Lavocat
18cc74cf6b wizard: add oscap to the review step
The review step now list the OpenSCAP policy chosen by the user.
2023-10-06 16:26:09 +02:00
Thomas Lavocat
3e11639960 wizard: the oscap step is reserved for beta
Do not show the oscap step outside of beta. Only protecting the step
itself is sufficient since the FSC and the Packages steps wont load any
profile data if no entry point allows to get one.

HMS-2077

wizardrecreatebeta
2023-10-06 16:26:09 +02:00
Thomas Lavocat
02a642df19 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
2023-10-06 16:26:09 +02:00
Adi Abramovich
a890dc5666 wizard: add GCP image sharing options
Adding GCP image sharing option according to the discussion on slack(https://redhat-internal.slack.com/archives/C03AZ0264LW/p1692789579814619) and mocks(https://issues.redhat.com/browse/HMS-2352).

In summary, within our GCP sources, we store the project ID. Images cannot be shared directly with a project ID, but they can be shared with a service account or a Google account. Consequently, to launch instances in GCP, users are not required to provide their Google account; instead, the images should be shared with the provisioning service account. This ensures that the provisioning team has access to the necessary images, as sharing them with individual users would not allow that.

After a thorough discussion, we have collectively decided to introduce an option. This option allows users to exclusively utilize the Launch service without the need to share the image with a Google account.
2023-09-27 13:53:36 +02:00
Justin Sherrill
5d6b6dfbfe Filter content-sources repos by origin and content_type 2023-09-19 09:22:37 +02:00
lucasgarfield
7b9e726151 ImagesTable: Convert ImagesTable to Typescript & RTK Query
This commit converts the Images Table to Typescript and converts all API
calls to image-builder to use RTK Query hooks.

This should increase the performance of the app significantly.
Previously our calls to the image-builder API were made in series. They
are now made in parallel. We may want to investigate the possibility of
hitting rate limiting now that we will be issuing requests in much more
rapid succession.

In the tests, moving to RTK Query hooks has allowed us to remove
virtually all Jest mocking. However, this means that some of our
previous tests which tested against implementation details were broken.
Most notably, we no longer check the Redux store to verify that clones
have been added correctly and we no longer check that compose requests
were issued successfully. Test coverage will be restored in a follow-up
PR where the dev-dependency @msw/data is added. Adding a persistent data
layer to the tests using @msw/data will allow us to verify that our POST
requests (creating composes and cloning them) are working by testing
that the Images Table has been updated.
2023-09-18 10:35:04 +02:00
Jakub Rusz
4fe1242c49 Adding some ouiaId for File system customization 2023-09-13 15:56:10 +02:00
regexowl
9f5a0af826 Wizard: Update the Repositories step
This updates the Repositories and Review step as per [mocks](https://www.sketch.com/s/d7aa6d29-fca0-4283-a846-09cc5fd10612/a/MyEbDz7).

Repositories with the unavailable or invalid status have a popover that allows for further inspection. The time of the last introspection and the counter of failed attempts was added to the popover, together with the "Go to Repositories" button.

On Recreate the payload repositories are checked against "freshly" fetched list of repositories. In case any of the previously checked repositories is no longer available in content sources an Alert is rendered on both Repositories and Review steps. The unavailable repository is checked, but the checkbox is disabled and the information is dashed out. Since the information about the repository is stored in the Repository type, the only information available to be rendered is the baseurl.

Create image button is also disabled when recreating an image with unavailable repositories.
2023-09-11 10:30:04 +02:00
Sanne Raymaekers
93c1f43544 CreateImageWizard: add WSL image type in preview 2023-08-29 13:37:56 +02:00
regexowl
ab1b60ee99 feat(HMS-1491): Fix capitalization on the Register step
This fixes the capitalization on the Review step from "Automatically Register your systems" to "Automatically register your systems".
2023-08-29 12:55:49 +02:00
regexowl
90a012d49b HMS-1492: Change rhc to non-capitalized
Fixes HMS-1492

This changes all occurences of "rhc" and "remote host configuration" from capitalized to lowercase.
In cases where the sentence started with "rhc" this was changed to "remote host configuration" to avoid
starting the sentence with "Rhc".
2023-08-29 12:36:38 +02:00
Ondrej Ezr
8b796ef431 Switch to Content Sources search
Enable searching for RH packages through Content Sources service.
Gates the search by Content Sources feature flag, to keep the easy kill switch.
2023-08-24 14:41:16 +02:00
mgold1234
52966fc729 Wizard: update popup with repositories name on Review step
fixes https://github.com/RedHatInsights/image-builder-frontend/issues/1305
This commit update popup of custom repositories with name of repository instead
of url of repository
2023-08-23 16:13:01 +02:00
Ondrej Ezr
b486f44dcb Custom Repositories gate by Feature flag 2023-08-23 15:38:25 +02:00
regexowl
77ff00d107 lint: Fix the "Expected a default case" warning
This fixes the "Expected a default case" warning
2023-08-23 14:54:23 +02:00
regexowl
b3767e0503 lint: Fix "missing alt for images" warning
This fixes the "img elements must have an alt prop, either with meaningful text, or an empty string for decorative images" warning.
2023-08-23 14:54:23 +02:00
regexowl
a9dc4f4a14 lint: Fix "assign before exporting" warnings
This fixes all instances which caused the following lint warning: "Assign object/arrow function to a variable before exporting as module default"
2023-08-23 14:54:23 +02:00
Ondrej Ezr
2a8e5a10df Launch button in stable environments
This moves Beta only features to stable environment:
- Sharing Images through Sources
- Launch button

This tries to avoid any refactoring, just moving components from Beta to stable with minimal changes.
2023-08-23 09:27:25 +02:00
Sanne Raymaekers
042af03052 CreateImageWizard: don't allow arbitrary mountpoints under /boot 2023-08-21 09:02:14 +02:00
lucasgarfield
0de68305c1 Wizard: Update registration step activation key link URL
Fixes HMS-2322: On the Register step of the image build wizard, the link
to "Create and manage activation keys here" should point to
https://console.redhat.com/insights/connector/activation-keys.
2023-08-16 14:31:52 +02:00
Ondrej Ezr
847ba2371d Prepare for Provisioning list endpoint nesting 2023-08-11 09:34:14 +02:00
regexowl
cdce271306 Wizard: Migrate ActivationKeyInformation to TypeScript
This migrates the ActivationKeyInformation component to TypeScript
2023-08-10 12:56:46 +02:00
Thomas Lavocat
b8c136dccb wizard: avoid a no-op
This removes a warning on a no-op being fired when the wizard changes a
state when the request for creation comes back as a success.
Instead don't update the form state if the wizard is going to be closed
anyway.
2023-08-09 16:03:00 +02:00
regexowl
87ff2a24c9 Wizard: Fix the Failed prop type error
Incorrect proptype for `selectedAvailablePackages` was causing following error:
```Warning: Failed prop type: Invalid prop `selectedAvailablePackages` of type `object` supplied to `ExactMatch`, expected an array.```

This fixes the problem.
2023-08-08 13:56:51 +02:00
regexowl
9a4c07c7ea Wizard: Fix visibility of the Image Details expandable
The Image Details expandable is now visible even if no name or description were added for the image. This fixes the issue.
2023-08-07 15:09:31 +02:00
regexowl
857257591c Wizard: Disable non-valid repositories and add a Status column
This disables adding of repositories that do not have 'Valid' status.

Status column was also added to the Repositories table to make the reason why the checkbox is disabled visible.
2023-08-02 15:40:57 +02:00
lucasgarfield
13b02eca7e eslint: Add support for Typescript
This commit adds eslint support for .ts and .tsx files.

The recommended Typescript rules are applied only to .ts and .tsx files
and not to existing .js or .jsx files. This is accomplished by creating
a separate .eslintrc-typescript.yml file and pointing to it in the
.eslintrc.yml overrides parameter.

A .eslintignore file was added. This file has syntax similiar to
.gitignore and is used to ignore the programatically generated API
slices so that we do not have to deal with a massive diff whenever we
update one of them.
2023-08-02 13:46:08 +02:00
Thomas Lavocat
deab7f95a9 wizard/registration: cleaning of a useEffect
A useEffect was used without conditions to update the value of a state
variable depending on the form state. That's apparent to a way to
initialize the state. Instead, what can be done, is to immediately
initialize the state at the proper value.
2023-08-01 12:39:21 +02:00
lucasgarfield
702b667dc5 API: Add programatically generated Provisioning API slice definitions
These definitions were generated using the RTKQ code generation tool and
will replace the existing definitions.
2023-07-28 15:05:08 +02:00
lucasgarfield
74528356fa API: Add programatically generated Content Sources API slice definitions
These definitions were generated using the RTKQ code generation tool and
will replace the existing definitions.
2023-07-28 15:05:08 +02:00
lucasgarfield
22df78bffa API: Add programatically generated RHSM API slice definitions
These definitions were generated using the RTKQ code generation tool and
will replace the existing definitions.
2023-07-28 15:05:08 +02:00
lucasgarfield
1894a9dcb2 API: Add programatically generated Image Builder API slice definitions
These definitions were generated using the RTKQ code generation tool and
will replace the existing definitions.
2023-07-28 15:05:08 +02:00
mgold1234
7cb3f2d0b6 Wizard: add description field to Details steps 2023-07-28 12:24:25 +02:00
mgold1234
5c1952d8c9 Wizard: change the name of wizard details
This commit change the name of wizard-details to details, to prevent misconfusion with the image-name component
2023-07-26 17:13:42 +02:00
mgold1234
ca2f2f7ba3 Wizard: change the image name
fixes #1196
this commit update the wording on image name step
when user create new image.
2023-07-17 17:05:03 +02:00
regexowl
d03b17de13 Wizard: Remove ModalProps from schema
These changes were introduced in #1079 to ensure that quickstarts stay visible even after opening a Wizard modal as they are both top-most components.

`ModalProps` which were used for this purpose were introduced in version 3.20.6 of `@data-driven-forms/pf4-component-mapper`. Since then we had to regress the version to 3.20.5 as it was crashing the application on closing of a modal. The issue linked to this can be found here: https://github.com/data-driven-forms/react-forms/issues/1389

As we are now using mapper version that does not allow to use `ModalProps` the functionality of the workaround was lost and it was causing following console.error: `Warning: React does not recognize the `ModalProps` prop on a DOM element.`
2023-07-11 17:49:18 +02:00
regexowl
c4f616763d Wizard: Image name validation
This adds validation of an image name based on a pattern, which was chosen as an intersection of the naming constrains of hyperscalers.

The pattern is based on the one for naming GCP images as those naming guidelines are the most restrictive. With added minimal length restriction of AWS.
2023-07-11 10:39:32 +02:00
Sanne Raymaekers
f20686df4d CreateImageWizard: Add support for vsphere-ova imagetype
The OVA type is also the default when checking VMWare now.
2023-07-05 13:02:39 +02:00
Sanne Raymaekers
a5edf0bb75 src: Update doc links
The access.redhat.com documentation moved from
`https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/creating_customized_rhel_images_using_the_image_builder_service/index`
to
`https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/creating_customized_images_by_using_insights_image_builder/index`.
2023-06-30 15:33:50 +02:00
Thomas Lavocat
9136378935 Components/ReviewStepTextLists: remove useEffect
According to the documentation (https://react.dev/learn/you-might-not-need-an-effect)
useEffect should only be used to synchronize with external systems.

In the FSC component showing the partition table useEffect was used to
compute a value based on the form state.

The documentation present two relatable usecases to what we were doing
in the component:
- https://react.dev/learn/you-might-not-need-an-effect#resetting-all-state-when-a-prop-changes
- https://react.dev/learn/you-might-not-need-an-effect#updating-state-based-on-props-or-state

This commit uses the presented strategies to externalise in a new
component the computation of the MinSize. Because it has for dependency
the list of partitions and the manual setting, it will get redrwan every
time these values are changed in the form state.
2023-06-30 09:05:23 +02:00
mgold1234
8dbca83c14 googleCloud: Format the text on GCP target
This commit fix the format text when create image
with Google Cloud Platform target
related to issue: https://github.com/RedHatInsights/image-builder-frontend/issues/1195
2023-06-27 14:48:37 +02:00
Lukas Zapletal
9ba6498037 GCP: rename Email label to Principal 2023-06-26 14:25:00 +02:00
lucasgarfield
0fd07f1f74 RTKQ: Add typing to RTKQ hooks in apiSlice
This commit adds typing to the RTK Query hooks. The hooks have been
refactored to be simpler and all custom query functions have been
removed.
2023-06-20 16:36:39 +02:00
lucasgarfield
8f454e5a89 ESLint: Add eqeqeq rule
This rule forbids use of == or !=, and enforces use of === and !==.
2023-06-20 14:55:10 +02:00
lucasgarfield
0fe9770bc3 Wizard: Hotfix for recreate image rate limiting issue
Related to HMS-1886: Clicking the recreate button on a build with a lot
of packages results in the user being rate limited.

Package summaries are obtained by querying the Content Sources API. A
large number of packages requires a large number of requests and leads
to the rate limiting problem when using the 'Recreate image' function.

This commit fixes the problem by not requesting or displaying package
summaries when 'Recreate image' is used. (Note that newly added packages
will still request and display a summary.)

The 'Recreate image' function will soon be replaced by
blueprints. This hotfix should carry us forward until then.
2023-06-05 17:49:18 +02:00
Sanne Raymaekers
ff50b59126 CreateImageWizard/Registration: use PF4 property names
By using the standard HTML property name, PF4 considered the Radio
uncontrolled. This causes warnings in the console.

By using the correct property names, PF4 correctly considers the
component controlled.
2023-05-30 10:08:44 +02:00
Sanne Raymaekers
fc63aec015 CreateImageWizard: turn off gpg check explicitly
gpgcheck is on by default, and if no gpgkey is specified dnf complains.
2023-05-12 23:07:42 +02:00
lucasgarfield
eb3a702c68 Wizard: Prefetch data for external API calls
This makes the wizard feel much 'faster' for a better user experience.
The implementation uses RTK Query for prefetching. For most API
requests, prefetching is done when the 'next' button is hovered over on
the previous step.
2023-05-05 09:17:59 +02:00
regexowl
83206171f9 ImagesTable: Ensure created_at date for a new image
This adds a temporary value of current date to `created_at` for newly created images.

This is not the most elegant solution and will be reworked after the ImagesTable refactor.
2023-05-04 17:09:47 +02:00