When the user clicks on the "create an image" button, the image wizard
shows up replacing the landing page. This allows to keep the quickstart
guides to the right of the wizard while the user is interacting with it.
The compliance step is now tested with two new tests:
- One to test that upon creation, if a user selects a profile, then the
customizations are applied to the file system and package steps
- One to test that upon recreation, the file system and packages
customizations are still present.
HMS-2077
Adding GCP image sharing option according to the discussion on slack(https://redhat-internal.slack.com/archives/C03AZ0264LW/p1692789579814619) and mocks(https://issues.redhat.com/browse/HMS-2352).
In summary, within our GCP sources, we store the project ID. Images cannot be shared directly with a project ID, but they can be shared with a service account or a Google account. Consequently, to launch instances in GCP, users are not required to provide their Google account; instead, the images should be shared with the provisioning service account. This ensures that the provisioning team has access to the necessary images, as sharing them with individual users would not allow that.
After a thorough discussion, we have collectively decided to introduce an option. This option allows users to exclusively utilize the Launch service without the need to share the image with a Google account.
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.
This updates the Repositories and Review step as per [mocks](https://www.sketch.com/s/d7aa6d29-fca0-4283-a846-09cc5fd10612/a/MyEbDz7).
Repositories with the unavailable or invalid status have a popover that allows for further inspection. The time of the last introspection and the counter of failed attempts was added to the popover, together with the "Go to Repositories" button.
On Recreate the payload repositories are checked against "freshly" fetched list of repositories. In case any of the previously checked repositories is no longer available in content sources an Alert is rendered on both Repositories and Review steps. The unavailable repository is checked, but the checkbox is disabled and the information is dashed out. Since the information about the repository is stored in the Repository type, the only information available to be rendered is the baseurl.
Create image button is also disabled when recreating an image with unavailable repositories.
The "Step Image output - clicking Next loads Upload to AWS" and "Step Upload to Azure - clicking Next loads Registration" were sometimes returning the "Warning: An update to <element> inside a test was not wrapped in act(...)" error.
This seems to have been caused by an early exit in the `setUp()` function in the first `describe` block.
Safeguards were put in place to fix this behaviour.
As this error didn't occur every time, testing the updates was not easy. This current fix passed the threshold of ten successful runs of `npm run test`.
Test `component renders error state correctly` was outputting errors for both AWS and Azure tests.
This was caused by calling `server.use()` after the wizard was already rendered.
Fixed by moving the one time server mock response to the very beginning of the unit test. Also added `server.resetHandlers()` to be run after each of the unit tests.
Thanks to this fix, azure tests could be merged again. Which means no more splitting into `CreateImageWizard.azure.test.js` and `CreateImageWizard.azure.2.test.js`
This updates following test suites after bumping react and testing-library:
- CreateImageWizard.azure.test.js
- CreateImageWizard.azure.2.test.js
- CreateImageWizard.content.test.js
- CreateImageWizard.test.js
Fixes HMS-1492
This changes all occurences of "rhc" and "remote host configuration" from capitalized to lowercase.
In cases where the sentence started with "rhc" this was changed to "remote host configuration" to avoid
starting the sentence with "Rhc".
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.
This migrates following fixtures to TypeScript:
- architectures
- customizations
- sources
Typing and explicit returns were added.
The extensions of `composes` and `packages` fixtures were also updated from .tsx to .ts
A weird error occurs because when the tests are executing together. To
avoid that, as a temporary measure, separate the last test in a separate
file to ensure insolation from its peers.
Brute force approach to fix the act errors in the Wizard tests. It's not
ideal but allows to move on toward activating strict mode on the test
suite ASAP
Brute force approach to fix the act errors in the Wizard tests. It's not
ideal but allows to move on toward activating strict mode on the test
suite ASAP.
This adds `request` to a reponse from the `composes/{composeId}` endpoint and `meta` to a response from the `/composes/{composeId}/clones` endpoint as per API documentation.
The incomplete responses were causing problems when fetching data from the endpoints mentioned above.
The fixture was also migrated to TypeScript.
This disables adding of repositories that do not have 'Valid' status.
Status column was also added to the Repositories table to make the reason why the checkbox is disabled visible.
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.
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.
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.
This commit replaces all calls to the insights.chrome global with calls
to the useChrome() hook (or the useGetEnvironment() custom hook that
wraps useChrome()).
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.
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.
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.
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.
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.
This bumps user-event library by a major release and resolves the breaking changes.
Direct invocation of `userEvent` APIs (such as `userEvent.click()`and `userEvent.type()`) was replaced by calling the methods returned by `userEvent.setup()` as described here:
https://testing-library.com/docs/user-event/intro