Commit graph

264 commits

Author SHA1 Message Date
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
lucasgarfield
f1f544daec Wizard: Make AWS sources select scrollable in modal
There is a bug in Patternfly that causes 'pop out' selects (those that
use the menuAppendTo="parent" prop) to be rendered underneat the wizard
footer.

Until this is patched in Patternfly, we will have to live with
suboptimal select menus that scroll inside the modal.
2023-05-04 16:34:43 +02:00
regexowl
c581903745 Wizard: Disable "Add all" button when there's an exact match
This disables the "Add all" button in the `DualListSelectorControl` on the Packages step when there's too many results to display, even if there's an exact match.
2023-05-04 14:49:27 +02:00
lucasgarfield
05b411c241 Wizard: Add 'Refresh' button to repositories step
Users may visit the Repositories service to add or modify repositories
while they are on the repositories step in the wizard. This commit adds
a 'Refresh' button that will refetch the repositories and update the
table so that the user does not have to restart the wizard to view their
modifications.
2023-05-04 14:13:17 +02:00
lucasgarfield
383f2a6855 Wizard: Add filtering to repositories
This commit adds filtering based on architecture and version to the
repositories table in the wizard.

Apart from filtering, this commit now shows *all* repositories,
regardless of their status. Previously, invalid repositories were not
displayed. A future PR will add a status column and edge case handling
(how to handle an invalid repo, etc...). For now, invalid repos are
displayed and can be selected.

RTK Query is now used to manage the state of the repositories.
Previously, the repositories were fetched in a useEffect hook upon
opening the wizard.

MSW is now used instead of jest mocking for the tests involving
repositories. The repositories test fixture now contains a function that
mimics the content sources API.
2023-05-04 14:13:17 +02:00
Sanne Raymaekers
23d58d563d CreateImageWizard/Repositories: set custom-repositories
Embed the payload repositories into the image.
2023-05-02 14:33:53 +02:00
Sanne Raymaekers
f0679d1196 CreateImageWizard: rename custom- to payload-repositories
To avoid confusion between custom and payload repositories.

Custom repositories will be embedded in the yum config, payload
repositories are used for installing packages.
2023-05-02 14:33:53 +02:00
lucasgarfield
7bca4c7438 LandingPage/ImagesTable/Wizard: Remove all insights global calls
This commit replaces all calls to the insights.chrome global with calls
to the useChrome() hook (or the useGetEnvironment() custom hook that
wraps useChrome()).
2023-04-28 17:07:31 +02:00
lucasgarfield
b2e6e3cf04 Wizard: Use useChrome hook to set beta feature flag
The use of chrome.isBeta is deprecated, the useChrome hook should be
used instead to obtain an isBeta() function. Using the deprecrated
chrome.isBeta pollutes the browser console with warning messages.

This commit replaces the isBeta() helper function with a new custom
hook, useGetEnvironment().

We still sometimes need to know which environment is running outside of
React components, where we cannot call the useChrome() or
useGetEnvironment() hooks. For instance, in the json used to define a
wizard step. Therefore a new isBeta variable has been added to the
form's initialState for use in these cases.
2023-04-28 17:07:31 +02:00
regexowl
79fe46474a Wizard: Update text on Packages and Additional Red Hat packages steps
This removes unnecessary sentences from the description of Packages and Additional Red Hat packages steps. The min and max height of the `DualListSelector` was also updated.
2023-04-26 18:24:28 +02:00
Jakub Rusz
b17f18ddf8 Add ouiaID for resource group select 2023-04-26 13:17:29 +02:00
Pavel Odvody
2f13390eee Add MODAL_ANCHOR and anchor ShareImageModal
This patch adds a constant `MODAL_ANCHOR` so that the value
can be used in multiple modals that require it. Also the
ShareImageModal is now properly anchored to it.

Signed-off-by: Pavel Odvody <pavel@redhat.com>
2023-04-20 17:02:04 +02:00
Pavel Odvody
466f158374 Anchor modal to proper element
By default all modals are anchored to document.body
which interferes with Quickstarts by overlaying them.
This patch anchors the modal to the main element outside
of the Quickstart so that both can be visible at the same time.

Signed-off-by: Pavel Odvody <pavel@redhat.com>
2023-04-20 17:02:04 +02:00
lucasgarfield
bc1435994d Router: Modify /share and /imagewizard routing
Insights offers 'quickstarts', which can be used to provide
mini-tutorials in a sidebar.

Unfortunately, these quickstarts change our URL... they add an optional
query parameter related to the quickstart. The process of doing so
destroys our router's `location`, setting it to undefined.

We have been using the location state to store the GUID of the image,
needed when opening the wizard via the `Recreate image` action or when
opening the share modal.

As a workaround, we can simply accept that the quickstarts will change
our URL and destroy our router's location. Instead, we now put the image
id (its UUID) in the route itself. We can access it in the components as
necessary via the useParams hook.
2023-04-20 14:59:12 +02:00
regexowl
8f87626dfb Wizard: Fix unavailable key information error
When creating a new image and selecting an activation key on the Registration step the warning about unavailable key information is displayed even though the key information is loaded without any problems.

This shows the error on the Registration step only when fetching the activation key information ends in error.
2023-04-19 08:20:03 +02:00
Sanne Raymaekers
38dda9da67
CreateImageWizard: support verifying repository metadata (#1076) 2023-04-18 13:45:23 +02:00