Commit graph

246 commits

Author SHA1 Message Date
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
regexowl
e5a9f0eaf9 Wizard: Add "refine search" warning to Packages step
Fixes #913.

This adds status bars to the `DualListSelectorPane` on the Packages step. The status bar indicates how many packages were found and how many of those have been selected.

Warning for too many returned results was also added. When an exact match is found during a search with over 100 results, it is shown together with the warning.
2023-04-14 18:27:10 +02:00
regexowl
5f99bc79cf Wizard: Migrate activation keys calls to RTK Query
This migrates calls to RHSM endpoints `activation_keys` and `/activation_keys/{name}` to RTK Query.

Tests were also updated to use Mock Service Worker instead of previous Jest mock function.
2023-04-14 16:52:47 +02:00
regexowl
02a584b36f Wizard: Remove prop validation for ReviewStepTables and ReviewStepTextLists
This removes prop validation that was left behind after the props were removed during a Review step updates PR review.
2023-04-14 12:12:38 +02:00
regexowl
876e605a23 Wizard: Ensure unique IDs for buttons
Fixes #1065.

This sets buttons on the Repositories and Additional custom packages steps to `CustomButtons` to ensure buttons in each of the steps have a unique ID.
2023-04-13 13:58:16 +02:00
Ondrej Ezr
065900c0f8 Add sources selection for Azure
Fixes HMS-1511
2023-04-13 13:32:23 +02:00
lucasgarfield
c7add821c2 Wizard: Fix bug causing crash upon visiting Azure step
This commit fixes a bug in the wizard. The Azure step name was
incorrectly set when using the 'Recreate image' option which caused the
wizard to crash when trying to access the Azure step.
2023-04-12 16:33:19 +02:00
regexowl
4405d2ddd2 Wizard: Disable remove button for the root partition
Fixes #910. This disables the remove button and select for the root partition as that one is required to continue with creating an image.

The third point mentioned in the issue is removing mount points that have already been chosen from the dropdown to prevent adding duplicate mountpoints.

This point was not implemented as we need to allow the user to create multiple sub directories under the same mount point if needed.
2023-04-04 18:05:53 +02:00
Sanne Raymaekers
1df2df1360 CreateImageWizard: show error details on save
Show details when the wizard sends a request that results in an
error. Now that AWS and Azure have a maximum size, this needs to be
shown.
2023-04-03 10:51:54 +02:00
regexowl
87dc7f8440 Wizard: Update links on File system configuration step
Fixes #1023. This updates the links on the File system configuration step.
2023-03-29 14:28:13 +02:00
Jakub Rusz
9637a86351 Set ouiaId for activation key Select widget 2023-03-29 12:05:19 +02:00
lucasgarfield
4c2a410dd7 Wizard: Expose beta features in qa environment
The QE team has requested that all beta features be exposed in the
ephemeral environment (insights.chrome.getEnvironment() === 'qa').
2023-03-28 09:26:13 +02:00
regexowl
254ba7afac Wizard: Update the Review step to have expandable sections
Fixes #919.

This updates the Review step as per proposed mocks.

The tabs were replaced by expandable sections containing all the information relevant to a specific step.
2023-03-27 10:35:17 +02:00
Sanne Raymaekers
808d8b8452 CreateImageWizard/Registration: remove extra rhc/insights vars
They just complicated the logic, might as well rely on the form api
value.
2023-03-13 13:48:43 +01:00
Sanne Raymaekers
9d0448979d CreateImageWizard: fix plain list styling
The list styling should only apply to unordered lists (present on the
review page).
2023-03-13 13:48:43 +01:00
Sanne Raymaekers
7635bda168 CreateImageWizard/Registration: refine tooltip texts 2023-03-13 13:48:43 +01:00
Alexander Todorov
0b3d6a2b01 Specify ouiaId to use as selector for testing
see release_select for ImageOutputReleaseSelect for example
2023-03-09 12:27:21 +01:00
regexowl
a7d915dad7 Wizard: Ensure only one scrollbar on the Packages step
Fixes #914.

This adds a maximum height limit to the dual list selector on the Packages step.
That way the Wizard doesn't become scrollable when the Packages search returns more results.
2023-03-09 11:13:37 +01:00
Sanne Raymaekers
724668a3a4 CreateImageWizard: add org id in activation key popover 2023-03-08 16:45:31 +01:00