Commit graph

83 commits

Author SHA1 Message Date
jkozol
414dff3ed7 api: use content-sources api for package search on stage beta
The Content Sources service can now be used for handling package info and
search. The api call to this service requires a list of repo urls. The
`repos.json` file tracks the supported repositories for each distro.
This is then mapped into a url array for whichever distro we are
searching for packages. The response body is similar to what existed in
image-builder but the key `package_name` needs to be mapped to just
`name`. Also, there is no pagination in Content Sources for `/rpms/names`
so we can currently only fetch a limit of 20 packages.
2022-11-02 17:32:51 +01:00
Thomas Lavocat
affd7ccbca wizard: adding a popover for the activation key
This commit addresses the first part of the issue #774.
2022-10-25 18:07:03 +02:00
lucasgarfield
de4e9bea07 Wizard: Improve file system configuration error messaging
This commit improves the file system configuration step's error handling
by performing validation only when the next button is clicked. This
allows an invalid state to temporarily exist while the user is modifying
the mountpoints without bothersome error messages needlessly appearing.

Broadly speaking there were two options for the implementation: (1)
delay the validation, performing validation only upon clicking the next
button -or- (2) perform validation immediately as normal but hide error
messages until the next button is clicked. Option (1) proved to be
untenable - Data Driven Forms does provide `pauseValidation()` and
`resumeValidation()` functions from React Final Form which theoretically
would make this option possible... However, we need to call
`resumeValidation()` in the next button's click handler and then
immediately make a decision based on the validation results either to
remain on the step and display the errors or move to the next step.
When we tried implmenting this we found that `resumeValidation()` does
not immediately peform validation - validation only resumes after
exiting the handler. Therefore, this approach was not considered and
option (2) was used.

In order to gain control over the behavior of the next button, custom
buttons are implemented for this step. Sharing state between the custom
buttons and the form was a challenge. With pure React it would have been
as simple as moving the relevant state to the parent component, but that
was not possible due to Data Driven Forms. Instead, state is shared
using the form state. A new property,
`'file-system-config-show-errors'`, in the form state is used to
determine whether or not error messages should be displayed.

In order to cause a re-render upon a change in
`'file-system-config-show-errors'`, the file system configuration
component is wrapped in a `<FormSpy>` component.
2022-09-23 18:11:35 +02:00
Sanne Raymaekers
b86a9b712d CreateImageWizard: Drop isBeta() check for centos
The accompanying text allows us to enable this for non-beta.
2022-09-14 14:19:35 +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
1d6a92a7f9 Wizard: CentOS acknowledgement text updated for production 2022-09-02 17:01:12 +02:00
regexowl
c9c75da7ba Wizard: Fix UI issues for Microsoft Azure Target environment
Fixes #772. This updates description of the step according to recent SPUR.
The `Authorizing an Azure account` expandable was removed (both from the step and `ImageCreator.js`) as well as `Destination` heading. Size of the Oauth 2.0 link was changed from small to default.
2022-09-02 10:37:08 +02:00
regexowl
130e8a0532 Wizard: Display file extensions on Image output step
Fixes #769. This adds file extensions for private cloud and other target environments in Image output step as per recent SPUR.
2022-08-25 10:09:13 +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
lucasgarfield
480c754b37 CreateImageWizard: Add /tmp mountpoint
/tmp was added to the list of valid mountpoints in the filesystem
customization step.

No validation is necessary at this time because rhel-86, centos-8, and
centos-9 all support a /tmp mountpoint.
2022-05-19 11:50:53 +02:00
Sanne Raymaekers
cfaa8a463d CreateImageWizard: RHEL 9
Expose rhel-90, it has reached GA.
2022-05-18 15:24:04 +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
Sanne Raymaekers
bbd3623414 CreateImageWizard/FileSystem: Default to 0 if size input is NaN
This gets rid of prop warnings during tests.
2022-04-12 13:07:50 +02:00
Sanne Raymaekers
f6aa58e3e3 CreateImageWizard: Single css file
All css applies to the entire page. To make it clearer having a single
css file for the entire wizard.
2022-04-11 17:49:16 +02:00
Chloe Kaubisch
10f774a8c5 CreateImageWizard: fix label spacing
Decrease the spacing below labels from 8px to 4px in accordance with the mocks.
Fixes #597
2022-04-08 14:08:48 +02:00
Sanne Raymaekers
ed12903519 Revert "CreateImageWizard: Disable vmware and installer images"
This reverts commit 8e4b4ff6d5.
2022-04-06 11:30:09 +01:00
Sanne Raymaekers
787e1ba5ce FileSystemConfiguration: Remove redundant dragging state changes
This is covered by onDragEnd, which always gets called when onDrop gets
called.
2022-04-04 15:06:29 +02:00
Sanne Raymaekers
7d6ede8dc6 FileSystemConfiguration: Don't stop onDragOver if element matches
Rely on the index matching instead. During a drag, if onDragOver is
fired the index the item will be dragged to (the target index) will be
set. If the target index doesn't match the source index, the new
tempItemOrder is made and the new target index is set.

Initially this index is null, so even if the target index is the
same as the current index, the tempItemOrder and target index will be
set once.

By not shorting this event based on the visual layout, the drag state
gets initialized correctly every time.

Fixes #679
2022-04-04 15:06:29 +02:00
Sanne Raymaekers
d12bdb1075 CreateImageWizard: Change valid prefixes to match composer
Adds all valid prefixes defined in composer, removes invalid ones, and
disables the TextInput for the root partition. This makes customized
filesystems less error prone.

https://bugzilla.redhat.com/show_bug.cgi?id=2070761
2022-04-01 12:56:32 +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
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
c3c7888610 CreateImageWizard: use activation key in form state as init value 2022-03-23 12:30:42 +01:00
Jacob Kozol
7aaedd67ab CreateImageWizard: rename google to gcp in form state 2022-03-23 12:30:42 +01:00
Jacob Kozol
9b4144176a CreateImageWizard: remove unsafe optional chaining
Optional chaining can return undefined. So, we should not use `of` on
getState()?.values?.['file-system-configuration']. But, since we already
check for the existance of this variable we do not need to optionally
chain.
2022-03-03 17:46:14 +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
02fbdf5e88 CreateImageWizard: remove act warning on Review step
When we load the organization id but do not use or display it we can
have an act warning because we unmount the component without handling
the response.
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
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
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
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
Jacob Kozol
8c3a60a7ed CreateImageWizard: only display upload review for selected destinations 2021-11-30 12:45:14 +01:00
Jacob Kozol
28a76a6dcb CreateImageWizard: redo package search default message
Having the available packages list be either undefined, empty, or with
elements requires complicated logic. Instead, initialize
packagesAvailable to an empty array. In order to display an error state
when the packages search returned no packages, now use a boolean flag if
available packages were found. This check also sets us up in case we
want to provdie further feedback on failed package searches.
2021-11-29 20:35:23 +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
Katerina Koukiou
292d14e36f CreateImageWizard: Show "no package results are found" when no packages are found
Fixes #463
2021-11-28 18:16:51 +01:00