Commit graph

6 commits

Author SHA1 Message Date
mgold1234
a0a08ff5e8 app: useEffect warning fixes
This commit addresses warnings related to the react-hooks/exhaustive-deps rule.
It resolves these warnings by adding the missing dependencies to the useEffect hook.
2024-01-09 14:23:10 +01:00
lucasgarfield
1894a9dcb2 API: Add programatically generated Image Builder API slice definitions
These definitions were generated using the RTKQ code generation tool and
will replace the existing definitions.
2023-07-28 15:05:08 +02:00
lucasgarfield
eb3a702c68 Wizard: Prefetch data for external API calls
This makes the wizard feel much 'faster' for a better user experience.
The implementation uses RTK Query for prefetching. For most API
requests, prefetching is done when the 'next' button is hovered over on
the previous step.
2023-05-05 09:17:59 +02: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
Sanne Raymaekers
39ec63b0c3 CreateImageWizard: custom buttons for each step
This adds custom buttons for each step, where each button has an id
taking the format `$step-(next|previous|cancel)-button`.
2022-12-01 16:31:53 +01: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