Commit graph

112 commits

Author SHA1 Message Date
regexowl
608ca157eb test/fixtures: Update compose fixture and migrate it to TypeScript
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.
2023-08-07 10:20:44 +02:00
regexowl
e2ffc1705c test/fixtures: Migrate the packages fixture to TypeScript
This migrates the `packages` fixture to TypeScript and adds needed types to `index.ts`
2023-08-07 10:01:40 +02:00
regexowl
1456861e63 test: Move button clicking functions to testUtils
This moves the `clickBack`, `clickCancel`, `clickNext`, `getNextButton` and `verifyCancelButton` functions from the tests to `testUtils`.
2023-08-01 13:32:20 +02:00
mgold1234
7cb3f2d0b6 Wizard: add description field to Details steps 2023-07-28 12:24:25 +02:00
mgold1234
ca2f2f7ba3 Wizard: change the image name
fixes #1196
this commit update the wording on image name step
when user create new image.
2023-07-17 17:05:03 +02:00
regexowl
c4f616763d Wizard: Image name validation
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.
2023-07-11 10:39:32 +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
8f021105b4 test: Move mock json blobs to fixtures
This moves all mock json blobs from the Mock Service Worker handlers and component tests into one central location under `/fixtures`.
2023-05-30 10:41:51 +02:00
Sanne Raymaekers
d0024a8d48 src/test/CreateImageWizard: increase timeout 2023-05-09 20:12:13 +02:00
lucasgarfield
7bca4c7438 LandingPage/ImagesTable/Wizard: Remove all insights global calls
This commit replaces all calls to the insights.chrome global with calls
to the useChrome() hook (or the useGetEnvironment() custom hook that
wraps useChrome()).
2023-04-28 17:07:31 +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
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
regexowl
e5a9f0eaf9 Wizard: Add "refine search" warning to Packages step
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.
2023-04-14 18:27:10 +02:00
regexowl
5f99bc79cf Wizard: Migrate activation keys calls to RTK Query
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.
2023-04-14 16:52:47 +02:00
lucasgarfield
4c2a410dd7 Wizard: Expose beta features in qa environment
The QE team has requested that all beta features be exposed in the
ephemeral environment (insights.chrome.getEnvironment() === 'qa').
2023-03-28 09:26:13 +02:00
regexowl
254ba7afac Wizard: Update the Review step to have expandable sections
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.
2023-03-27 10:35:17 +02:00
regexowl
f92cae1fc2 DevDeps: Bump @testing-library/user-event from 13.5.0 to 14.4.3
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
2023-03-24 15:09:51 +01:00
Sanne Raymaekers
9e6d951641 CreateImageWizard: rhc support 2023-03-08 16:45:31 +01:00
regexowl
753afa197d Wizard: Get distribution repositories from an api endpoint
Previously the base repository links for each distribution were read from `repos.js` file. This gets the needed information
from a call to api endpoint `architectures/{distribution}`. The data is fetched via RTK Query and is then filtered by an
architecture. For now the x86_64 architecture is hardcoded, this will change when multiple architectures get available.
2023-03-07 08:34:03 +01:00
lucasgarfield
4000b8d5e5 ESLint: Add prefer-const rule
Require const declarations for variables that are never reassigned after
being declared. If a variable is never reassigned, using the const
declaration is better. const declaration tells readers, “this variable
is never reassigned,” reducing cognitive load and improving
maintainability.
2023-02-10 11:37:06 +01:00
Sanne Raymaekers
1fa0466676 src/test: use stage tests for prod-beta tests
Content sources is now available in prod-beta, so let's test simulating
the production env, but split on beta/non-beta.
2023-01-25 16:15:51 +01:00
regexowl
cbd6b1e4cb Wizard: Update the File system step
Fixes #911. Fixes #912.

This updates the File system step. The changes are:
- changed the toggle group for selecting the mode of partitioning to radio select and updated information for each radio button as mentioned in #911
- added information to the "automatic" option of the file system configuration as mentioned in #912
- updated information for the "manual" option of the configuration as mentioned in mocks
2023-01-19 16:07:58 +01:00
Martin Maroši
aa0a21301c Do not append extra / in resolveRelPath 2023-01-12 15:41:26 +01:00
lucasgarfield
772aca36fa build(deps): bump @redhat-cloud-services/frontend-components-utilities from 3.2.16 to 3.3.11
Moving to @redhat-cloud-services/frontend-component utilities broke
several tests, this commit fixes those tests.

Additionally, this commit bumps @patternfly/react-core and
@patternfly/react-table to versions 4.267.6 and 4.112.6, respectively.
2023-01-09 12:40:27 +01:00
lucasgarfield
eb2f5be66d Wizard: Remove clear handler from Release select on Image Output step
This commit fixes #893 by removing the ability to clear the release
select on the image output step (this is the select where the user
chooses from RHEL 8, RHEL 9, CentOS 8 or 9, etc...).

Originally the ability to clear the select was added so that the default
state (where CentOS options are hidden behind a 'speedbump') could be
returned to but this seems unnecessary in retrospect and introduces
opportunities for bugs (as seen with the validation in #893) so it seems
wise to simply remove the ability to clear altogether.
2023-01-03 11:47:06 +01:00
lucasgarfield
5adc0e7d4a Wizard: Add 3rd Party Repositories
Adds support for 3rd party repositories using the Red Hat Insights
Repositories app on console.redhat.com.

The packages step has been refactored heavily to reduce the bug surface
area and improve its reusability (it is now used in two Wizard steps).

New features related to the Repositories app are currently only exposed
in stage. Because stage and production are quite divergent (they have
different steps, for instance) there are separate test suites for the
production and stage versions of the Wizard. When these features are
moved into production, the two test suites can be merged into one.
2023-01-03 10:05:39 +01:00
Sanne Raymaekers
cb8ab9347e CreateImageWizard: use non-deprecated image type aliases
'ami' was deprecated a while ago, and is kept around as an alias of
'aws'. Same with 'vhd' and 'azure', and 'vhd' and 'gcp'.

This maintains support for the old aliases where necessary.
2022-12-06 15:14:53 +01:00
regexowl
ab1a7f4aab ESLint: Use --fix with updated rules to order imports
This applies the updated sorting rules to the files by running `npm run lint:js:fix`
2022-12-02 16:29:58 +01:00
regexowl
b2a6c403bf Wizard: Add additional information for an activation key in Review step
Fixes #822. This adds component `ActivationKeyInformation` with additional information for an activation key on a Registration tab of Review step.
The added fields are:
- Name
- Role
- SLA
- Usage
- Additional repositories

Organization ID is added to the Activation key popover.

Function `getActivationKey` was added to `api` to get an additional information about activation key from RHSM api based on the name of the key.
2022-12-01 12:35:07 +01:00
regexowl
6d789da727 Wizard: Update Review step
Fixes #774. This matches the Review step with the updated mocks as per SPUR.

The changes are following:
1. Target environment tab:
	- value of AWS `Account ID` aligned with GCP and Azure values
2. Registration tab:
	- `Subscription` changed to `Registration type`
	- `Organization ID` removed, will be added in a different place so it's clearer it's associated with an activation key
3. System configuration:
	- updated column name `Type` to `File system type` in partitions popover
	- updated the width of the column to accommodate the change
	- unified line spacing of `Image size` with the other rows
	- changes `Packages` to `Additional packages`
2022-11-07 16:36:50 +01:00
Sanne Raymaekers
06d47e5428 CreateImageWizard: fix typo in aws step 2022-11-07 12:26:08 +01:00
Sanne Raymaekers
03421acc74 src/Router: use release as a basename in BrowserRouter
The insights platform is moving to react router v6, meaning router
contexts can no longer be nested. As a result all applications will end
up sharing the same `BrowserRouter`.

Switch to using the release (`/` or `/beta/`) as a basename for the
BrowserRouter, and offload the full path (`/insights/$appname`) to the
individual routes. This makes it easier to drop the BrowserRouter in
image builder for the platform one in future.
2022-10-17 15:53:21 +02:00
lucasgarfield
2cac343b2f Wizard: Add test for file system configuration buttons
This commit adds a test that checks the new behavior of the file system
configuration buttons by adding duplicate mount points and verifying
that errors do not appear until the next button is clicked.
2022-09-23 18:11:35 +02:00
regexowl
69c29e4336 Wizard: Update tests
Related to #778. This replaces `verifyButtons()` function with `getBackButton()`, `getNextButton()` and `getCancelButton()`.

The functions run `getByRole` query before a button is clicked allowing detection and use of custom buttons.

Test `Click through all steps › with valid values` was updated to reflect changes in functionality of the `File system configuration` step.
2022-09-23 18:11:35 +02:00
regexowl
a3afc562c8 Wizard: Update tests
Related to #773. This updates tests to reflect changes in the description of the Packages step.
2022-09-19 16:19:30 +02:00
regexowl
0bced556a9 ESLint: Use --fix with new rules to order import declarations
Related to #795. This applies the new sorting rules in ESLint to the files by running `npm run lint:js:fix`
2022-09-14 13:24:38 +02:00
lucasgarfield
a977f4b72b Redux: Add Redux Toolkit
This commit adds Redux Toolkit as a dependency. Adding Redux Toolkit is
beneficial because it will allow us to use the current best-practice Redux
development patterns and tools as well as reduce the number of
dependencies. Redux Toolkit is backwards compatible with existing Redux code,
and therefore works with all of the current actions and reducers.

The store is now created using Redux Toolkit's configureStore(). Previously, a
custom store creator developed by Red Hat Insights was used. However,
this is actually not required for Insights apps, and creating the store using
configureStore() is necessary to take advantage of Redux Toolkit. For
instance, the store can now be inspected using the Redux devtools in the
browser.

This commit removes the redux-logger middleware. It is no longer
necessary, as the Redux development tools can now be used to easily inspect and
reason about the redux store and its state.

The Thunk middleware dependency has also been removed, as Thunks are already
included in Redux Toolkit.

The redux-promise-middleware dependency has been left in place for now,
but its functionality is also available in Redux Toolkit and it may be
considered for removal in the future.

Using Redux Toolkit will also allow us to move to the `Slice` pattern when
defining actions/reducers in the future if we wish. This will make
writing, reasoning about, and debugging the code related to the Redux
store much easier.
2022-09-06 11:01:25 +02:00
lucasgarfield
1d6a92a7f9 Wizard: CentOS acknowledgement text updated for production 2022-09-02 17:01:12 +02:00
lucasgarfield
489d6a334f CreateImageWizard: Add CentOS acknowledgement
Adds a PF4 info <Alert> that informs users that CentOS is intended only
for development of RHEL-Next if CentOS is the selected distro in the
Image Output step.
2022-07-08 11:17:10 +02:00
lucasgarfield
f6a98d2dca CreateImageWizard: Add CentOS speedbump
When selecting a distribution during the Image Output step, only RHEL
distributions are shown initially. A button at the bottom of the list of
distributions can be clicked to expand the list and display all
distributions, which at the moment adds CentOS-8 and CentOS-9 to the
list.

Implemented by passing a PF4 SelectViewMoreObject as the LoadingVariant
prop to the <Select>.

This feature (and therefore the ability to build CentOS images) is only
available in beta.
2022-07-08 11:17:10 +02:00
Sanne Raymaekers
1c5542ca81 CreateImageWizard: Use stage candlepin urls on stage consoledot 2022-06-07 14:53:45 +02:00
Jacob Kozol
4fa71cede8 update style across the project
The eslint updates require style changes in all components.
2022-05-23 12:47:20 +02:00
Sanne Raymaekers
e160aec170 test: Add test to check for all the available releases
This obsoletes the 'non-rhel releases on beta' test, as it checks all
releases.
2022-05-18 15:24:04 +02:00
Sanne Raymaekers
2e39b47095 test: Remove commented out image output test 2022-05-18 15:24:04 +02:00
Jacob Kozol
40f7be170c CreateImageWizard: require max image name length of 100 chars 2022-05-13 12:51:48 +02:00
Sanne Raymaekers
294cb08a0f CreateImageWizard: Use 'gcp' image type for gcp
The vhd alias for gcp was dropped, as image-builder includes extra repos
for gcp.
2022-04-25 14:00:54 +02:00
Sanne Raymaekers
445d56273f test: Use userEvent.click for checkboxes 2022-04-22 16:44:48 +02:00
Sanne Raymaekers
4da829ff8f CreateImageWizard: Don't show centos on non-beta
The distinction is made by checking if the distribution contained
'rhel'. This is the same way the review page determins if it should show
a registration tab.
2022-04-22 16:44:48 +02:00
Jacob Kozol
787b0180de CreateImageWizard: fix validation for activation keys
The validators are passed values by the useFieldApi hook. Adding this to
the activation key component allows the `required` validation to work.
2022-04-21 18:36:19 +02:00
lucasgarfield
fa7b0ca553 CreateImageWizard: Package search reset buttons and typeahead filter
Resolves #604. The available and chosen package search inputs now have a
reset button which resets the search and list elements to their default
states. This fixes a cosmetic issue related to the focus-visible width
being smaller than the search input width. This is accomplished by passing
an onClear prop to the search input.

The functions used to add all and selected packages were split from two
functions into four functions. The functions appear similiar but this is only
superficial; the logic is actually quite different and there is very
little code reuse. Four separate functions will be easier to understand and
maintain.

This commit includes several other modifications:
1. The chosen package search is now a typeahead filter. This brings it
   in line with PatternFly dual list selector examples.
2. The available package search button has changed to be in line with
   the PatternFly <SearchInput /> component examples.
3. Package sorting behavior is now consistent. Previously, packages would be
   sorted if 'add all' was used but not if 'add selected' was used. Now
   the default behavior is to always sort the package list.
2022-04-21 16:05:18 +02:00