Commit graph

57 commits

Author SHA1 Message Date
lucasgarfield
e99b7b7d0b CreateImageWizard: Make target environments keyboard selectable
The AWS, Google, and Azure tiles on the image output step can now be
selected/deselected using SPACE and/or ENTER.
2022-03-25 15:47:48 +01:00
lucasgarfield
e649e5c385 CreateImageWizard: Override Data Driven Form Enter behavior
Resolves #466. The default behavior for the DDF Wizard is to either advance to
the next step or submit the form when the ENTER is pressed.

This is inappropriate for complex forms that contain many different
types of elements that are typically interacted with using ENTER. For
instance, the default behavior when a link is focused and ENTER is pressed
is not to open the link in a browser but to advance or submit the form.

This commit overrides the default behavior by passing an onKeyDown prop
to the wizard which calls a custom onKeyDown function. The new custom
function does not define any behavior for when ENTER is pressed,
but does recreate DDF's default ESCAPE behavior, which is to close the
modal.
2022-03-25 15:47:48 +01:00
lucasgarfield
c28e0d15b6 CreateImageWizard: Make steps autofocus on first input upon render
The default behavior of Data Driven Forms when moving to the previous or
next step is to maintain focus on the previous or next button,
respectively.

This commit makes the UI more friendly to keyboard users by focusing
on the first input element of a given step when it is rendered.

Whenever possible, autofocus is achieved by passing components the
autoFocus prop. When this is not possible, then useRef and useEffect hooks
are used to set focus.

At the moment, it is not possible to autofocus the image output step's
release selector or the file system configuration step's toggle using the
above methods. This is because these PatternFly components do not
currently pass props to the appropriate child component and do not
support ref forwarding. The best option for autofocus in these cases is
currently being investigated.
2022-03-25 15:47:48 +01:00
Jacob Kozol
4b9e98bff3 test: able to recreate image
Verify that clicking recreate will pass the expected compose request to
the CreateImageWizard. Also, verify that if passed a composeRequest and
initialStep of 'review', the wizard will display the review page with
all info filled.
2022-03-23 12:30:42 +01:00
Jacob Kozol
80918f97e4 CreateImageWizard: only display Image name review field when it exists 2022-03-03 17:17:03 +01:00
Jacob Kozol
c257eec540 CreateImageWizard: add image name field
Add a details step where the user can enter a descriptive image name.
This name is displayed in the review step above the Release. Both these
fields are now horizontal to save vertical space.
2022-03-02 16:24:35 +01:00
Sanne Raymaekers
350acbd21b CreateImageWizard: File system configuration 2022-02-28 15:27:09 +01:00
Jacob Kozol
f278f049a9 CreateImageWizard: Add expandable section for azure description
The azure step's descriptive text under the `Authorizing an Azure
account` title text is now expandable. Clicking the title shows or
hides it.
2022-02-25 14:30:57 +01:00
lucasgarfield
5e0ce52742 CreateImageWizard: Show empty available state on failed search
Resolves issue #588. 'No packages found' is now correctly displayed
after a failed search that follows a successful search.
2022-02-24 17:01:50 +01:00
lucasgarfield
1630f30448 CreateImageWizard: Sort packages alphabetically
Search results are now converted to lower case before sorting. This
ensures that results appear in alphabetical order in a case insensitive
fashion.
2022-02-24 17:01:50 +01:00
lucasgarfield
e8e7329bf6 CreateImageWizard: Get all matching packages from package search
When searching for a package, all matching packages are now returned. First an
attempt is made using the api's default limit and if there are more
matching packages than the default limit a second request is made with
an increased limit. To facilitate this, api.getPackages() now accepts an
optional limit parameter. Retrieving all matching packages is necessary
because of the sorting logic.
2022-02-24 17:01:50 +01:00
Jacob Kozol
92f963c49a CreateImageWizard: add activation keys to registration
The registration step now provides users with a type ahead input so they
can select from all activation keys associated with their accounts.

The testing for this requires that we wait for the mocked api response.
2022-02-14 16:31:19 +01:00
Jacob Kozol
fc9735371f tests: remove useless tests
The click through all steps with invalid and missing values are
unneccessary tests. They do not actually check the validation
and instead they just click through all steps.
2022-02-14 16:31:19 +01:00
Sanne Raymaekers
8e4b4ff6d5 CreateImageWizard: Disable vmware and installer images
These images need either user customization or a default user.
2022-02-03 15:42:34 +00:00
Jacob Kozol
f51e9fd9b2 CreateImageWizard: update review step for new subscription strings
The review page and its test now contains the organization id and
additional strings for whether the image is subscribed to insights or
not.
2022-01-21 11:57:04 +01:00
Jacob Kozol
e48e2ca659 CreateImageWizard: redesign registration step
Update the registration options to include registering without insights.
Also, improve the text info in the step.

The org id is also removed from the registration step since we no
longer display the id in this step.
2022-01-21 11:57:04 +01:00
Chloe Kaubisch
3571c969ce CreateImageWizard: conditionally render Registration tab
At the final review step, only render the Registration tab
if the user has selected RHEL 8 as the release. Add a test to
ensure that if the user selects CentOS as the release, there
are only two tabs at the review step.
2022-01-20 15:30:13 +01:00
Jacob Kozol
6d66ab3228 test: add centos setup
In the review step we want to test if the Registration tab is hidden.
This requires selecting CentOS as the distro type since CentOS does not
support RHEL subscription activation.
2022-01-20 15:30:13 +01:00
Jacob Kozol
f1f3c0cd66 CreateImageWizard: add new image types
The image types 'vsphere', 'guest-image', and 'image-installer' are now
supported by the CreateImageWizard. They require no additional
customizations and support the current registration and packages
customizations.
2022-01-14 22:23:50 +01:00
Jacob Kozol
e1f6ae1cca test: fix testing-library/no-render-in-setup error
In order to avoid unnexpected sideeffects and to be more specific in our
tests the components should be rendered in each test and not in the
beforeAll. This will improve the testing libraries ability to run
cleanup. Moving the render into a setUp function is okay because it is
still called from within each test and won't cause sideefects for the
cleanup.
2022-01-05 11:51:55 -05:00
Jacob Kozol
e43c41a143 test: move scrollTo to beforeAll
This call occurs before each test because scrollTo is not imlemented in
jsdom. Instead of calling it in each beforeEach we declare it once in
the beforeAll. This simplifies the beforeEach calls.
2022-01-05 11:51:55 -05:00
Jacob Kozol
d1cd05aca7 test: fix testing-library/render-result-naming-convention 2022-01-05 11:51:55 -05:00
Jacob Kozol
6713d279ef test: fix testing-library/no-wait-for-multiple-assertions error
Simplify the waitFor calls to only wait for the asynchronously updating
components.
2022-01-05 11:51:55 -05:00
Jacob Kozol
20d3928744 test: fix testing-library/no-node-access error
We should avoid using native html methods for dom traversal. Our goal
should be to visually test what users would see as much as possible and
accessing 'children' doesn't specifically check for visual elements as
much as checking for text or roles
2022-01-05 11:51:55 -05:00
Jacob Kozol
c7bbe1d9b7 test: fix testing-library/prefer-screen-queries error
Using queries built into the screen object is preferable since
destructuring them makes maintainabilty more complex.
2022-01-05 11:51:55 -05:00
Jacob Kozol
5f5476c83e test: fix testing-library/no-unnecessary-act error
We should avoid wrapping Testing Library util calls in 'act'. Most of
the Testing Library's functions are alread wrapped in an act so it is
unneccesary to double wrap them. Also remove unneccesarily setting
the activation key when clicking through steps since this will trigger
an async state update which causes react to complain about not being
wrapped in an act.
2022-01-05 11:51:55 -05:00
Jacob Kozol
919919173d CreateImageWizard: move org id to custom component
Loading the organization ID is now done in the registration step. This
prevents the entire wizard from waiting on the org id and prevents the
wizard from remounting when the async getUser() completes.
2022-01-05 11:51:55 -05:00
Sanne Raymaekers
6567323ef6 Router: Replace landing with catch-all route
This also mitigates the issue where clicking the image-builder nav link
would redirect you to `image-builder/image-builder` if image-builder was
already opened. And `/` didn't catch that path.
2021-11-30 16:12:43 +01:00
Jacob Kozol
4d987eb05e CreateImageWizard: filter already added packages
When a user searches for available packages, already chosen packages are
filtered from the available packages list. This prevents the user from
adding duplicate packages.
2021-11-30 15:58:20 +01:00
Jacob Kozol
db6aa5158d CreateImageWizard: display message for invalid chosen packages filter
When the user filters the chosen packages list they may find no packages
containing the entered string. In this case we display a message that no
packages are found. There are now tests for both the available and
chosen packages lists for when packages are not found.
2021-11-30 13:22:01 +01:00
Sanne Raymaekers
a16212ddc3 CreateImageWizard: Fix deselecting selected packages
Deselecting a selected set of package didn't change the state correctly.
2021-11-29 18:15:51 +01:00
Chloe Kaubisch
c6f74efcb3 CreateImageWizard: don't obscure activation key
Activation key was previously obscured by stars, instead just show it
(both in the input and in the review step) as it isn't secret.
2021-11-26 16:27:58 +01:00
Jacob Kozol
24a0f39857 CreateImageWizard: validate the subscription GUID is a valid GUID 2021-11-23 10:47:11 +01:00
Jacob Kozol
2602ff346f CreateImageWizard: improve review step
The review step is improved. The create button now states 'Create
image'. The step description text is updated. The fields to be reviewed
are now split into tabs for 'Target environment', 'Registration',
'System Configuration'. The target environments show the logo of the
environment now. The quantity of packages selected also displays now.
Tests are also updated.
2021-11-19 16:25:23 +00:00
Jacob Kozol
fef6884650 test: update tests for React Router v6
The test Router now takes location and navigator instead of history.
This also means that the history function no longer needs to be mocked
by jest. Instead, the location and pathname can simply be expected.
2021-11-18 19:06:56 +01:00
Jacob Kozol
cd8175fe73 CreateImageWizard: insert new compose on top of images list
The composeAdded action includes a field 'insert'. When set to true
`insert` will place the added compose at the beginning of the images
list. The test is modified so the new composes are added to the
beginning of the list.
2021-11-16 10:14:48 +00:00
Jacob Kozol
0357ed57f9 CreateImageWizard: add default state to package selection 2021-11-12 19:12:17 +01:00
Sanne Raymaekers
b986067079 constants: Introduce RHEL_8 constant
Bump rhel-84 to rhel-85.
2021-11-11 19:13:48 +01:00
Gianluca Zuccarelli
49ac292ca0 CreateImageWizard: sort packages by relevance
Sort the package results in the CreateImageWizard
first by exact matches and then by pacakge results
that start with the same letters as the search term,
otherwise sort alphabetically.
Fixes #256
2021-11-08 11:38:59 +01:00
Jacob Kozol
58f866088e CreateImageWizard: update packages to use custom callbacks
PF4 now allows more control over the DualListSelector. This component is
rewritten to use custom callbacks which allow us to display a more
customized version of the DualListSelector. Currently, the component is
visually identical to the existing implemention except for the addition
of a search button to filter the chosen packages.
2021-10-29 13:39:08 +01:00
Jacob Kozol
38abec12bf test: use userEvent click to fix react 17 test failures
screen.click() was being used but in React 17 the registration fields
will not be loaded into the dom until the user selects the radio option.
So, userEvent.click() must be used instead.
2021-10-21 19:20:17 +01:00
Jacob Kozol
7ac9b27870 test: package selector is now option not button 2021-10-21 15:33:50 +02:00
Jacob Kozol
913cd9a785 CreateImageWizard: update azure text and field order
The info text is updated and the authorize button is moved below tenant
ID. The tenant ID is now validated as a valid GUID and if is not valid
the authorize button is disabled. This tenant id is now used to validate
image builder on azure because the authorize url containing the tenant
id will authorize for any microsoft account type. Tests are also
updated.
2021-10-18 18:27:40 +02:00
Jacob Kozol
c56ae8328b package.json: update eslint-plugin-jest-dom
Also, add @testing-library/dom because this is needed by the newer
user-event. Fix tests for new style standards.
2021-10-14 15:18:11 +02:00
Gianluca Zuccarelli
28f415e292 CreateImageWizard: add gcp email validation
Add email address input validation to GCP
step in CreateImageWizard.
Closes #260
2021-10-14 12:27:41 +02:00
Sanne Raymaekers
6449111c5d CreateImageWizard: Use rhel minor versions everywhere
Fallout from switching to minor versions everywhere.
2021-09-03 17:11:57 +02:00
Karel Hala
ace808943f Remove old implementation of create image wizard
We don't need the old implementation anymore, this PR fully covers what the previous steps did
2021-06-30 14:15:01 +02:00
Karel Hala
a67e014dbe Fix failing tests
DDF requires a bit altered tests to click trough the wizard so the tests won't fail
2021-06-30 14:15:01 +02:00
Karel Hala
9bf30059f6 Fix rendering of wizard by wrapping it in act
Tests were failing because we are now calling getUser when wizard is shown. This call is asynchronous and requires wrapping the wizard in act to wait for it to be fulfilled
2021-06-30 14:15:01 +02:00
Sanne Raymaekers
e86b210a22 src: Use rhel-84 instead of rhel-8 2021-06-16 11:35:05 +02:00