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.
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.
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.
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.
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.
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".
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.
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.
The `<LaunchWizard>` architecture prop was specified incorrectly,
which caused the Instance dropdown in the Launch wizard to fail to load
instance types.
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.
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.
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.
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.
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.
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.
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.
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.
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.