[WIP][management] Integrate a settings view into serverless projects#166319
Closed
clintandrewhall wants to merge 2 commits intoelastic:mainfrom
Closed
[WIP][management] Integrate a settings view into serverless projects#166319clintandrewhall wants to merge 2 commits intoelastic:mainfrom
clintandrewhall wants to merge 2 commits intoelastic:mainfrom
Conversation
2e24d11 to
6770beb
Compare
a7646e9 to
f1de794
Compare
9 tasks
d899ed4 to
3cd4aed
Compare
clintandrewhall
added a commit
that referenced
this pull request
Sep 19, 2023
> **Caveat**: the functional flow logic we've adopted for these components is not one I would encourage, specifically, using "drilled" `onChange` handlers and utilizing a composing-component-based store. Ideally, we'd use a `redux` store, or, at the very least a React `reducer`. > > In the interest of time and compatibility, we've opted to use the pattern from the original components in `advancedSettings`. We plan to revisit the state management and prop-drilling when `advancedSettings` is refactored with these components. > This PR is a prerequisite to #166319 and to completing the Advanced Settings page in Serverless. > **Note**: Github appears to be a bit confused in the diff comparison, due to the addition to `React.forwardRef`... apologies for the noise. ## Summary While working on #166319 I found a number of bugs when working against actual UI settings stored in Kibana. This PR addresses those issues without waiting for the Settings page to be complete: - Refactors `input` components to have cleaner APIs, including `unsavedChange` and `field` "all the way down". - This cleans up confusing logic, and sets us up for Redux actions. - Creates a `normalizeSettings` function. - Settings returned from the `UiSettingsService` in an actual deployment of Kibana are drastically unpredictable. In some cases, `type` is missing, but `value` is there... or `value` is missing entirely, but a `userValue` is there. - This function "normalizes" the data, deriving missing parts where possible. - Changes the `onChangeFn` to accept `undefined` to indicate an unsaved change has been reverted, rather than relying on the _value_ in the unsaved change. - This fixes a number of issues around resets and reverts. - Alters the `unsavedChange` prop to be undefined, (to indicate the lack of an unsaved change), rather than an undefined value. - Fixes an issue where the `ImageFieldInput` wasn't removing a file that had been set when resetting to default; - Adds an imperative ref to `FieldInput` components to reset a field's input beyond resetting the value, (if necessary). - Fixes the Storybook `common` setups to allow for changes to the `onChange` types. - Fixed a bug where the `FieldRow` was indexing an unsaved change by `name`, rather than by `id`. - Fixed an issue where the reset link wasn't always clearing a change to the default value. - Fixes an issue with the aria label not being derived properly using the `query`. - Splits the utility functions into their respective namespaces: `settings` and `fields`. - Adds a few more tests to the utility functions to catch logic errors.
3cd4aed to
dc2da74
Compare
dc2da74 to
2fd336d
Compare
⏳ Build in-progress, with failuresFailed CI Steps
Test Failures
History
To update your PR or re-run it, just comment with: cc @ElenaStoeva |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This is a draft, WIP pull request that integrates the components from #165286 into a view in Serverless. It's currently meant as a demonstration/test harness while the form is being built.
Rendering each field row per setting
Added a quick-and-dirty card to the management page
WIP Caveats
The field rows in this view do not function. They need state management from a form (which @ElenaStoeva has begun to build)Recordto hold the changes.