[ResponseOps] [Rule Form] Move rule form steps to hook with progress tracking #205944
+516
−86
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Part of #195211
In preparation for the horizontal rule form layout, move the generation of the rule form steps into three hooks:
useCommonRuleFormSteps
: private hook that generates a series of objects specifying the rule form steps, how to display them, and what order to display them inuseRuleFormSteps
: hook that callsuseCommonRuleFormSteps
and transforms them into data for the standard verticalEuiSteps
, along with progress tracking based ononBlur
eventsuseRuleFormHorizontalSteps
: hook that calls hook that callsuseCommonRuleFormSteps
and transforms them into data forEuiStepsHorizontal
, plus navigation functions. These will be used in the smaller rule form flyout in a second PRBecause
EuiStepsHorizontal
rely more heavily on theEuiSteps
status
property, I took this opportunity to improve progress tracking in the standard vertical steps. Most rule types will load the create page with Step 1: Rule Definition already being in adanger
state, because an incomplete rule definition component immediately sends errors, and the error API doesn't distinguish between invalid data or incomplete data.This PR wraps each step in a
reportOnBlur
higher-order component, which will report the first time a step triggers anonBlur
event. Steps with errors will now reportincomplete
until they first trigger anonBlur
. The result:incomplete
danger
.This is inelegant compared to an error API that can actually distinguish between an incomplete form and an invalid form, but it's an improvement for now.