Commit graph

119 commits

Author SHA1 Message Date
jkozol
a5b1b1f775 package.json: upgrade patternfly to version 5
This upgrade requires multiple package updates. There are many style
updates to reflect pf5's syntax and structure changes
2023-10-25 09:02:47 +02:00
Sanne Raymaekers
d706a7e5e2 ImagesTable: show error popover on s3 images
The error popover should be shown in case there's a reason for the
error. This is already the case for the other image types.
2023-10-12 15:24:55 +02:00
Thomas Lavocat
273aa52711 api: update to latest image builder
This will let the code access the new endpoints to get the OSCAP
profiles and OSCAP customizations for the images.

HMS-2077
2023-10-06 16:26:09 +02:00
lucasgarfield
99ae627007 LaunchWizard: Correct architecture prop
The `<LaunchWizard>` architecture prop was specified incorrectly,
which caused the Instance dropdown in the Launch wizard to fail to load
instance types.
2023-09-18 16:08:57 +02:00
lucasgarfield
adaec7e34d LaunchWizard: Restore Launch wizard functionality
This commit is a hotfix that restores functionality to the Launch
wizard.

The `appendTo` variable can't be recomputed on every render. Wrap it in
a useState() hook to work properly.

Additionally, the `hasAccess`  property was missing from the
<ProvisioningWizard> component.

To ensure full backwards compatibility, the component has also been
wrapped in a <Suspense> as it was previously.
2023-09-18 15:38:47 +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
Amir Fefer
0822a69619 feat(HMS-1454): add RBAC permissions to launch wizard 2023-09-07 14:18:44 +02:00
Sanne Raymaekers
93c1f43544 CreateImageWizard: add WSL image type in preview 2023-08-29 13:37:56 +02:00
lucasgarfield
a5aad6935f ImagesTable: Update RegionsPopover to prepare for Launch/Provisioning GA
Previously, the Launch/Provisioning wizard was only available in
preview. If an AWS or Azure image was created in preview and shared with
a source, and then viewed in the images table in stable, a popover over
the stable launch link would inform the user that the image had been
created in preview and provide a link to go to preview.

Now that launch/provisioning is going GA and the launch wizard is
available in stable, this feature is no longer necessary.
2023-08-23 15:59:32 +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
lucasgarfield
29704a0725 eslint/hooks: obey rules of hooks
See https://legacy.reactjs.org/docs/hooks-rules.html.
2023-08-17 17:18:55 +02:00
Thomas Lavocat
a1834ed76e eslint: unused-expression
A ternary operator means that something's going to be assigned to
something, and I think the interpretor might or might not have had
executed that ternary operator before this fix 🤷. Anyway,
rewritten as a if, it's the same as before, except that this time we
know it'll be executed.
2023-08-17 17:18:55 +02:00
Thomas Lavocat
89437c5e23 eslint: no conditional use calls
Move the calls of the use function outside conditions so that their
calling is consistent no matter what happens.
2023-08-17 17:18:55 +02:00
Ondrej Ezr
847ba2371d Prepare for Provisioning list endpoint nesting 2023-08-11 09:34:14 +02:00
Thomas Lavocat
9361ee8224 api: fix the null access
Some components were crashing in the test due to a lack of protection
for cases where any data is returned from the API. This solution is
quite temporary and is only ment to allow the unit tests to execute
without throwing errors. A major refactor of the queries is on its way
with RTKQueries and will fix the behavior when data can't be properly
fetched.
2023-08-09 16:03:00 +02:00
lucasgarfield
c3397794d6 ImagesTable: Fix bug where vsphere-ova details are not displayed
The conditional in the image details component needed to have a check
added for vsphere-ova type images.

A mock compose and corresponding status for a vsphere-ova type image
have also been added.
2023-08-08 13:18:30 +02:00
Amir Fefer
3a0969e2dd Fix missing aria label in launch wizard modal 2023-08-02 18:27:23 +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
lucasgarfield
834c9d8333 API: Remove /types directory
All Typescript types are now found in the programatically generated API
slices in `/src/store`.
2023-07-28 15:05:08 +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
regexowl
b8d56fff15 ImagesTable: Fix bug where failed AWS images showed sharing error
Failed AWS images showed a `Failed to share image to one or more regions.` error even though they weren't shared to other regions.

This was caused by checking for a 'failure' status in an array of `imageStatuses` that included the parent status.
2023-07-21 21:05:57 +02:00
regexowl
c0cc236c5a ImagesTable: Update wording and links on empty state
This updates text and links on empty state according to recent mocks.
2023-07-20 13:20:24 +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
regexowl
021f6019ba ImagesTable: Fix the GCP launch link
This fixes the bug when Launch button got replaced with Image command button even in the Preview.
2023-06-29 18:31:27 +02:00
regexowl
57be1e4a9d ImagesTable: Update Image commands popover for GCP images
This adds "Launch an instance" and "Save a copy" commands to the Image commands popover for GCP images.
2023-06-29 11:12:51 +02:00
mgold1234
795aa99fc3 imagesTable: capitalize all release values
This commit change the value of release column to be consistently,
and always show with Capital letter
related to issue - https://github.com/RedHatInsights/image-builder-frontend/issues/946
2023-06-26 13:05:29 +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
regexowl
2e6ea2ccaa ImagesTable: Remove Image name Spinner for failed Azure images
This removes Spinner next to the Image name when a build of an Azure image fails.
2023-06-15 14:56:04 +02:00
regexowl
5c8a08f45c ImagesTable: Add image details and update ClonesTable
This adds expandable rows details for each image and updates ClonesTable according to the new mocks.
2023-06-14 16:07:27 +02:00
lucasgarfield
b73b0ecd56 Wizard: Enable Azure and GCP provisioning links in ephemeral
Unleash is being used to determine whether or not to use the Launch
wizard for Azure and GCP images. Unleash is not yet supported in our
ephemeral environments, but we want our ephemeral environments to have
parity with beta. This commit ensures that the Launch wizard opens for
Azure and GCP images in ephemeral.
2023-06-09 15:59:44 +02:00
Klara Simickova
6af015f0e0 Revert "ImagesTable: Update ClonesTable"
This reverts commit 2f55648310.
2023-06-01 18:12:08 +02:00
regexowl
2f55648310 ImagesTable: Update ClonesTable
This updates ClonesTable according to the new mocks.
2023-06-01 16:38:49 +02:00
Amir Fefer
38f0b37a6b feat(HMS-776): Add feature flag for gcp provisioning 2023-05-30 14:08:03 +02:00
lucasgarfield
e8a40e27dc Wizard: Add Azure launch link for images created in preview
If an image does not contain a subscription_id property, the link to
view the image in Azure will be malformed. This happens when a user
creates an Azure image in beta/preview using sources, and then clicks
the 'View uploaded image' link in stable.

Now, if an Azure image was created using sources (as evidenced by presence
of a source_id in request's upload options), the Launch button appears
and its popover has a link to Preview.
2023-05-05 15:22:53 +02:00
regexowl
1fcb1cb4b5 ImagesTable: Fix switch statement in ImageLink
This fixes an erroneous switch statement.
2023-05-05 14:55:17 +02:00
lucasgarfield
56475e9470 Wizard: Fix erroneous switch statement in ImageLink
The switch statement used to determine the image type for the Launch
wizard was written incorrectly, this commit fixes it.
2023-05-05 13:56:41 +02:00
lucasgarfield
fb9b9ca9a6 Wizard: Adjust AWS launch popover for images created in preview
If an image does not contain a share_with_accounts property, launch
links do not appear in the launch popover. This happens when a user
creates an AWS image in beta/preview, and then clicks Launch in stable.

A message is now displayed that explains the image was created using
Preview features, and the link to Preview has been clarified to be more
explicit.
2023-05-05 12:52:27 +02:00
regexowl
d54d347d83 ClonesTable: Remove created_at column from the clones table
This removes the `created_at` column from the clones table as per the latest designs.
2023-05-05 12:26:16 +02:00
regexowl
dde0f195b4 ImagesTable/ShareImageModal: Update sharing options for AWS
This disables sharing to new regions in case of failed build of the parent image.

The regions that always end in failure were also disabled in the `ShareImageModal`.
2023-05-05 12:20:33 +02:00
lucasgarfield
70c232471a ImagesTable: Change 'beta' to 'preview' in Launch popover 2023-05-05 11:46:11 +02:00
lucasgarfield
675a676709 ClonesTable: Remove Instance column
The instance column is no longer in the clones table per the latest
designs.
2023-05-05 10:38:20 +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
031fd08b91 ImagesTable: Add popovers with error details for failed builds
This removes error details from the image detail and moves them to popovers activated by clicking on "Image build failed" status.

Popovers were also added for clones which didn't include any error details previously.
2023-04-25 11:20:34 +02:00
lucasgarfield
d06f929227 LaunchWizard: Add large variant prop to set width of wizard correctly
Without this prop, the wizard's width expands to fill the entire window.
2023-04-21 12:22:30 +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
b0a7456860 Use custom modal to show the wizard
So that it's anchored to proper element via `appendTo`

Signed-off-by: Pavel Odvody <pavel@redhat.com>
2023-04-20 17:02:04 +02:00
Pavel Odvody
45547c607b Ensure Launch wizard is anchored to proper element
By default modals are anchored to document.body which inteferes
with quickstarts

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
Lucas Garfield
0870ea7d55
ImagesTable: Fix bug where Launch link incorrectly displayed (#1085)
This commit fixes a bug where the Launch link (which opens the
Provisioning wizard) was incorrectly displayed for all image types.

The bug is currently in production beta, so this commit is needed for
the hotfix. Changes made are minimal, only what is necessary to fix the
bug - we still need to discuss the getImageProvider() function (the
original source of the bug) with the Provisioning team.
2023-04-19 10:53:26 +02:00
Sanne Raymaekers
341b37a567 ImagesTable/RegionsPopover: add "go to beta" under launch 2023-04-14 17:36:31 +02:00