Add explicit save / revert buttons in search & ingest forms #361
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.
Description
This PR reverts the autosave functionality due to its ambiguity on when cluster resources are updated. To handle saving, this adds an explicit save button, and corresponding undo, to revert to the last saved state. Buttons are enabled/disabled based on the form state. Under the hood, when users click save, it runs the update workflow API with
reprovision=false
. Only the config is saved, but not the underlying workflow template or any associated resources. For full updates, users still have the ingest/search buttons. Updated text to more explicitly state what is happening when those are executed, which is actually building out the resources and running ingest/search. When users click the revert button, the form and transient UI config is reverted to the saved/indexed config.Details on the different form states:
formik
to detect value changes, when values are touched, etc.setUiConfig
param to components, so it can be triggered on these particular actions. Because we can't listen on formik value changes for this part, we need standalone hooks to listen on when the current uiConfig has updated.Implementation details:
unsavedIngestProcessors
/unsavedSearchProcessors
flags to persist when there are form changes related to adding/removing ingest/search processorsunsavedIngestProcessors
/unsavedSearchProcessors
updateWorkflowUiConfig()
fn to update the UI config only, without any template or resource updates. Used in the newSave
buttonDemo video, showing the new buttons functionality for ingest/search:
screen-capture.16.webm
Check List
--signoff
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.