Commit graph

69 commits

Author SHA1 Message Date
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
Jacob Kozol
2f5f6dcc46 CreateImageWizard: move name image step to end
The Details step is renamed to Name Image and moved to the last step
before Review. Also, the validation is removed since all utf-8
characters are supported for image names.
2022-04-19 14:07:46 +02:00
Sanne Raymaekers
1b471b762d test: Wait for rendering to finish in keyboard accessability test
Waits for components to finish rendering before continuing. This gets
rid of the test warnings.
2022-04-12 13:07:50 +02:00
Sanne Raymaekers
ed12903519 Revert "CreateImageWizard: Disable vmware and installer images"
This reverts commit 8e4b4ff6d5.
2022-04-06 11:30:09 +01:00
Gianluca Zuccarelli
78123bff0e CreateImageWizard: target env validation
Validation is not enforced on the image output step
when selecting and then deselecting an image type. This
is because the only validation which is set is `Required`.
However, after deselecting an image type the input becomes
a key-value object with all the values set to false. This
commit adds a custom validator to check that at least one
value in the object is set to true. Fixes #575
2022-04-04 15:11:45 +02:00
Sanne Raymaekers
5643a142d1 CreateImageWizard: Add customTitle to step template
This is used by substeps.
2022-03-29 16:13:14 +02:00
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