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.
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.
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.
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.
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`.
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.
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.
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>
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.
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.