Commit graph

193 commits

Author SHA1 Message Date
lucasgarfield
c73482dd7f Utilities: Add useExperimentalFlag hook
This commit DRYs out the code, extracting the logic for setting the
value of the experimentalFlag into a new hook found in the utilities.

It also makes the typing stricter - the hook returns a boolean. The
pattern we were using previously to set the value of experimentalFlag
variables could be boolean, string, or undefined.
2024-03-05 19:27:46 +01:00
lucasgarfield
baddf66273 Test: rename create-image-action data-testid
The data-testid for the Create image button in the empty state has been
renamed from create-image-action has been renamed to create-image-action-empty-state.

The test `renders EmptyState child component` started failing after changing
isBeta() from false to true in the useChrome() mocking function.

It was failing because the findBy query selector was able to find two
components with this data-testid, which was truly the case - the Create
Image button in the table header, and the Create Image button in the
empty state.

I have no explanation for why this test wasn't failing before.
2024-03-05 19:27:46 +01:00
Thomas Lavocat
c81ac76ea8 App: experimental features in beta only
When the unleash switch `image-builder.new-wizard.enabled` will get
activated on stage the blueprint and new wizard will be visible on the
platform.
To make them only visible in preview we need to change the condition to
check if Beta is selected by the user.
2024-03-05 19:27:46 +01:00
Anna Vítová
5813fdaf10 feat(HMS-3686): Update position of blueprint buttons 2024-03-05 13:49:31 +01:00
Amir
97b7aa6bfd fix(HMS-3704): hiding blueprint out of sync alert 2024-03-04 18:11:10 +01:00
Amir
a911c02780 Blueprints: add blueprint's images empty state 2024-03-04 15:36:06 +01:00
Amir
5b662a39ea Blueprints: add blueprint out-of-sync alert 2024-02-28 13:04:40 +01:00
regexowl
d834099a9b ImagesTable: Replace null with an empty string in ClipboardCopy
ClipboardCopy component doesn't like null anymore so this replaces it with an empty string.
2024-02-27 10:37:17 +01:00
Amir
97a75e0465 feat(HMS-3392): add blueprint's version in image table 2024-02-08 07:35:18 +01:00
Amir
13ca8e868d feat(HMS-3431): add a blueprint build images 2024-02-07 17:58:13 +01:00
Amir
017f5bfb51 feat(HMS-3391): add blueprint onclick handler 2024-01-25 09:28:34 +01:00
lucasgarfield
531369276c ImagesTable: Add error state
It is important we have an error state for times that we may need to
bring the image builder service down for whatever reason.
2024-01-24 20:09:42 +01:00
regexowl
3ac435db85 ImagesTable: Remove unused Skeleton
This removes an unused compoment from the imports.
2024-01-05 12:25:10 +01:00
mgold1234
262ac6d3be ImagesTable: fix grey box under AMI when image build is in progress
Previously a Skeleton component was used as a placeholder for an AMI when the build was still pending.
This removes the Skeleton and returns undefined rendering the AMI as empty.
2024-01-03 08:51:14 +01:00
regexowl
3e07472826 Wizard/ImagesTable/test: Change "VMWare" to "VMware"
The "w" in VMware should be lower case, this updates it in all places.
2023-12-05 13:20:42 +01:00
Sanne Raymaekers
b60c37f1f8 ImagesTable: show architecture of composes 2023-11-23 17:55:43 +01:00
mgold1234
b8c634eac0 fix some lint warning message 2023-11-20 09:37:12 +01:00
Sanne Raymaekers
f1141ec698 src: add RHEL 8.9 2023-11-16 14:44:21 +01:00
Sanne Raymaekers
6e737c59a9 src: add rhel-93 2023-11-13 17:32:32 +01:00
regexowl
1fd8deec1a ImagesTable: Add expiring/expired status to OCI images
Pre-authenticated requests for the OCI images expire 7 days after creation. This adds "Expires in <x> days" and "Expired" as possible statuses for the OCI images.
2023-11-07 11:13:28 +01:00
regexowl
7ec87dfa58 fixtures: Add OCI images to the mock fixtures
This adds an expired mock OCI image with an ID "0c1ec8d8-be39-47f2-9bd4-a3fff8244fce" and an expiring mock OCI image with an ID "ea23cfd6-fd8b-43ed-adfc-9f76bb8487ef".
2023-11-07 11:13:28 +01:00
regexowl
b8372eeaf5 ImagesTable: Add OCI images
This adds a row for OCI images in the ImagesTable. Details about the images show UUID of the image and the Object Storage URL which is needed to deploy the image.

"Image link" button in the Instance column contains instrucion on how to run an OCI image built by Image Builder in Oracle Cloud. The documentation link in the popover is just a placeholder for now as the documentation is being prepared.

Until the build is finished the "Image link" button is disabled as it would be missing the Object Storage URL which is creating on upload.
2023-11-07 11:13:28 +01:00
regexowl
6a19aae96c ImagesTable: Fix padding of disabled download links
This fixes an uneven padding for disabled "Download (....)" links.
2023-11-02 12:33:42 +01:00
mgold1234
d91727bf38 ImageTable: THEEDGE-3450 - add ignoreImageType to getComposes endpoint
this commit adds filter for image_type to the getComposes endpoint,
enhancing the functionality of the Image Builder frontend table, which comprises two tabs: RPM and OSTree.
With this enhancement, users can now filter OSTree images from the RPM tab, preventing duplication.
2023-10-26 15:53:31 +02:00
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