Commit graph

417 commits

Author SHA1 Message Date
Sanne Raymaekers
808d8b8452 CreateImageWizard/Registration: remove extra rhc/insights vars
They just complicated the logic, might as well rely on the form api
value.
2023-03-13 13:48:43 +01:00
Sanne Raymaekers
9d0448979d CreateImageWizard: fix plain list styling
The list styling should only apply to unordered lists (present on the
review page).
2023-03-13 13:48:43 +01:00
Sanne Raymaekers
7635bda168 CreateImageWizard/Registration: refine tooltip texts 2023-03-13 13:48:43 +01:00
Alexander Todorov
0b3d6a2b01 Specify ouiaId to use as selector for testing
see release_select for ImageOutputReleaseSelect for example
2023-03-09 12:27:21 +01:00
regexowl
a7d915dad7 Wizard: Ensure only one scrollbar on the Packages step
Fixes #914.

This adds a maximum height limit to the dual list selector on the Packages step.
That way the Wizard doesn't become scrollable when the Packages search returns more results.
2023-03-09 11:13:37 +01:00
Sanne Raymaekers
724668a3a4 CreateImageWizard: add org id in activation key popover 2023-03-08 16:45:31 +01:00
Sanne Raymaekers
62421e3670 CreateImageWizard: update register later text 2023-03-08 16:45:31 +01:00
Sanne Raymaekers
9e6d951641 CreateImageWizard: rhc support 2023-03-08 16:45:31 +01:00
lucasgarfield
f0ae99b31e ClonesTable: Ensure source exists before reading its account_id property
If a clone is created using a source, and the source is then deleted,
the source will be undefined. Attempting to read the account_id from
undefined causes the app to crash. Optional chaining fixes this.
2023-03-08 10:53:39 +01:00
Sanne Raymaekers
b729edf152 CreateImageWizard: handle SearchInput api change 2023-03-07 18:20:00 +01:00
lucasgarfield
39af9bddeb ImagesTable: Only show Launch link for images using sources
The Launch service wizard should only be used to launch AWS images that
were created using share_with_sources (and not share_with_accounts) in
their request.

The Launch service only supports a single source at the moment, as does
the Image Builder Frontend. Therefore, we do not pass the entire
share_with_sources array - only the 0th element, which should be the
`only` source for images created using the front-end. We do not expect
full compatibility between images created using the API (which could
theoretically have multiple sources in share_with_sources) and Image
Builder Frontend.
2023-03-07 16:28:38 +01:00
lucasgarfield
5d4e365ef8 ImagesTable: Display AWS account number when image uses sources
This commit displays the AWS account number in the `Account` column in
the AWS clones table.
2023-03-07 15:07:25 +01:00
lucasgarfield
deae5438a1 ShareImageModal: Add support for sources
This commit allows sharing (cloning) composes that use the sources
service to resolve the AWS account ID.
2023-03-07 15:07:25 +01:00
regexowl
050808b181 Wizard: Fix disabled search input on the Additional custom packages step
The search input on the Packages step is disabled until needed data is fetched. This was causing a problem on the Additional custom packages step which uses the same component.

A check of the current step was added so the search input gets disabled only for the Packages step.
2023-03-07 14:00:28 +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
b861b3dde8 Wizard: Update activation keys link text and URI
This commit updates the link on the registration step so users are
directed to the exact place where they can manage keys.

Because managing keys through the customer portal will soon become
deprecated (keys will be managed through the keys service on insights)
the text was also changed to be more general.
2023-03-06 15:51:34 +01:00
Simon Steinbeiss
47436e6933 Landingpage: Switch to CodeBranchIcon
Use the CodeBranchIcon instead of just CodeIcon for the Open Source
Services popover button.
COMPOSER-1899
2023-03-01 16:44:31 +01:00
lucasgarfield
5bd9756a45 Tests/Wizard: Add tests for AWS sources
This commit adds tests for the new AWS sources feature.
2023-03-01 11:25:28 +01:00
lucasgarfield
3ff80a7398 Tests/Wizard: Fix tests broken by AWS sources
This commit fixes the tests broken by adding the AWS sources feature. No
new tests have been added in this commit.
2023-03-01 11:25:28 +01:00
lucasgarfield
51bcae3233 Mock Service Worker: Update provisioning/sources handlers
This commit adds mock service worker handlers for the
/provisioning/sources and /provisioning/${ID}/account_identity
endpoints. These API mocks are necessary as requests to these endpoints are
now made by the new aws sources feature.
2023-03-01 11:25:28 +01:00
lucasgarfield
53ce67ab47 Wizard: Add beta flag for AWS sources
This commit makes the new AWS sources feature only available in beta.

Note that the RTKQ hooks related to AWS sources are called in several
places outside of the AWS Target step (a prefetch on the Image Output
step and useQuery hook on the review step) but have not been hidden
behind beta flags - this should not present any problems and will make
exposing this feature in stable much easier when the time comes.
2023-03-01 11:25:28 +01:00
lucasgarfield
a474163343 Wizard: Add ability to specify AWS target using sources
This commit adds the ability to specify AWS targets using the sources
service on insights.

This is the first commit to the codebase that makes use of the new RTK
Query endpoints, so I will provide a bit of additional context here:

The sources are obtained by calling the `useGetAWSSourcesQuery()` hook.
This hook can be called in any component where information about the
sources is needed.

A few tricks are used to make the user experience as responsive as
possible.

The `prefetch()` hook provided by RTK Query is called when the user
clicks on the AWS button on the image output step. This triggers the
initial request for the sources, which will then (hopefully) be ready by the
time the user clicks to the next step (the AWS target environment step)
where they are needed.

Because we anticipate a common user workflow to involve using the Create
image wizard in one browser tab and the sources service in another tab,
sources are also refetched every time the source dropdown is opened.
This means that if a user adds a source while in the middle of using the
wizard, they will be able to see it in the wizard's sources dropdown
without refreshing their browser.

Finally, because of the `Recreate image` feature, the
`useGetAWSSourcesQuery` hook also needs to be called on the review step.
2023-03-01 11:25:28 +01:00
lucasgarfield
7768c44630 RTK Query: Update provisioning/sources endpoint
This commit replaces the `getSources` endpoint with an AWS specific
endpoint, `getAWSSources`.

This is necessary because the provisioning/sources endpoint was recently
updated and now has an optional query parameter, ?provider, that allows
requesting sources from a specific provider (aws, azure, etc...).

Unfortunately, the response from /provisioning/sources?provider=aws does
not include the associated aws account id, which has to be requested
from a different endpoint.

The new `getAWSSources` endpoint combines these two requests - first it
requests the list of aws sources, then it requests the associated aws
account id for each source.

Combining these two requests into a single RTK Query endpoint is
advantageous because all relevant information can be retreived with a
single call to the `useGetAWSSourcesQuery` hook.
2023-03-01 11:25:28 +01:00
Simon Steinbeiss
d66c141e8d Remove unused variable 2023-02-27 16:54:29 +01:00
Simon Steinbeiss
35c7d6ff29 LandingPage: Show 'Open Service' badge and popover
This commit moves the reference to our source code out of the help
popover to its own.
COMPOSER-1899
2023-02-27 16:54:29 +01:00
regexowl
a0ed7cd37e App: Disable the global filter
This disables the global filter on the top of the page. So later when an option to filter images by name is added,
there won't be multiple filters which could lead to confusion.
2023-02-22 12:45:04 +01:00
Jacob Kozol
d05e9da3d7 ImagesTable: support additional image type labels
If image types are created that do not have a descriptive label then
default to using the image type.
2023-02-17 09:48:49 +01:00
Amir Fefer
acb0991ed4 feat(HMS-776): Add provider to provisioning wizard 2023-02-16 17:33:14 +01:00
Sanne Raymaekers
b5833ca976 src/repos: Fix urls
These URLs are used for package searching with the content-service.

- Remove the google cloud repos, these are added only for gcp
- Fix centos 9 URLs
2023-02-16 14:10:32 +01:00
lucasgarfield
131559b351 MSW: Add mock definition for /provisioning/v1/sources end point
This commit adds the necessarily handler, resolver, and server to use
MSW for mocking the /provisioning/v1/sources endpoint.

The server can be used in tests like so:
```javascript
// src/setupTests.js
import { server } from './mocks/server.js'
// Establish API mocking before all tests.
beforeAll(() => server.listen())

// Reset any request handlers that we may add during the tests,
// so they don't affect other tests.
afterEach(() => server.resetHandlers())

// Clean up after the tests are finished.
afterAll(() => server.close())
```
2023-02-15 09:23:24 +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
3207afce90
config: remove module name in webpack config (#959)
Due to merging the openshift and chrome plugin systems there's
additional requirements on the format of the module name.

Camelcase is the default, so the values can just be removed from the
config.
2023-02-09 12:17:27 +01:00
Ondrej Ezr
ceec580981 Hide Launch button until image is built
Refs HMSPROV-377
2023-02-09 09:14:10 +01:00
Ondrej Ezr
7e89e74813 Do not show Launch button on copied images 2023-02-09 09:14:10 +01:00
lucasgarfield
d4eb5f78f0 Redux: Add RTK Query + /provisioning/v1/sources endpoint
This commit adds the /provisioning/v1/sources endpoint via a new
apiSlice.js which uses RTK Query's createApi method.

RTK Query allows us to query the /provisioning/v1/sources endpoint using an
automatically generated React hook, `useGetSourcesQuery`. The usage is
something like this (from within a React component):
`const { data: sources, isLoading, isSuccess, isError, error } =
useGetSourcesQuery()`.

This will make it much easier for us to manage data caching and just as
importantly manage loading and error states properly.

Future PRs will migrate data fetching in the other slices (clones, composes,
repositories) to the apiSlice.

For more info on RTK Query, see:
https://redux.js.org/tutorials/essentials/part-7-rtk-query-basics
2023-01-26 11:00:58 +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
Sanne Raymaekers
a25ec459d8 CreateImageWizard: use content sources in production beta
Enables package searching and custom repositories.
2023-01-25 16:15:51 +01:00
regexowl
6131dafe48 Wizard: Update order of releases on the Image output step
Fixes #909. Fixes #918.

This updates the order of the releases on the Image output step to sort from newest to oldest. The RELEASES Object was converted to Map which remembers insertion order.

The color of the `Show options for further development of RHEL` option in the Release dropdown select was also changed to blue.
2023-01-25 14:21:18 +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
Ondrej Ezr
224df6de17 Enable provisioning wizard in Ephemeral environment 2023-01-13 09:47:54 +01:00
Martin Maroši
88240aa757 Allow modals to be rendered on top of landing table. 2023-01-12 15:41:26 +01:00
Martin Maroši
0f89ced2a0 Change routing to consume chrome history context. 2023-01-12 15:41:26 +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
670f1c106f ImagesTable: Fix status bug
Fixes #899. The status of images (parent images and clones) in the
clones table was displayed incorrectly - the 'highest priority'
(e.g. failure > success) was displayed for all images.

This was due to a bug in a conditional in the ImageBuildStatus
component. In the main images table, rows for AWS images should display
the highest priority status of *all* images. A single failed clone
should cause the status of the row in the main images table to be
failure, even if the parent compose status is successful.

This logic was incorrectly being applied to *all* statuses. This commit
fixes this - from now on, this logic is only used for rows in the main
images table.
2023-01-06 14:20:06 +01:00
Jakub Rusz
03b22647c5 Wizard: add ouiaId to release select
This will help QE with testing the app by having a specific locator for
this element.
2023-01-06 13:26:35 +01:00
lucasgarfield
d4c8d71bd1 Wizard: Clarify variable names and comments in requestToState()
This commit clarifies variable names and comments that were found to be
confusing during the review of 5adc0e.
2023-01-06 10:29:27 +01:00
lucasgarfield
280c11c824 Wizard: Change '3rd party repositories' to 'Custom repositories'
All instances of '3rd party repositories' (and its variations) have been
changed to 'Custom repositories'. This is in better agreement with the
content sources app on consoledot, which generally is called either
'Custom Repositories' or 'Repositories'. Additionally, it is possible to
add and manage Red Hat repositories via content sources, which makes
'3rd party' confusing.
2023-01-04 16:16:25 +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