-
Notifications
You must be signed in to change notification settings - Fork 8.5k
UI settings move to NP #47590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI settings move to NP #47590
Conversation
|
Pinging @elastic/kibana-platform (Team:Platform) |
...ore/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why it was done in this manner. Probably for the sake of consistency with other accessing methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a misleading comment. The platform calculates values once https://github.com/restrry/kibana/blob/b7114c7df6a547fbab769079589b5f755dc709bf/src/legacy/ui/ui_settings/ui_settings_mixin.js#L31
Dynamic behavior removed in c65da14#diff-a23948121f4bc50ced65723c687f343d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found only savedObjectsClient passed as a parameter in the plugins code
💔 Build Failed
|
💔 Build Failed
|
💚 Build Succeeded |
eliperelman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple minor notes.
...ore/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts
Outdated
Show resolved
Hide resolved
| * Sets the parameters with default values for the uiSettings. | ||
| * @param values | ||
| */ | ||
| setDefaults(values: Record<string, UiSettingsParams>): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me 👍
|
|
||
| return { | ||
| setDefaults: this.setDefaults.bind(this), | ||
| asScopedToClient: (savedObjectsClient: SavedObjectsClientContract) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an arrow function, you can use an implicit return:
asScopedToClient: (savedObjectsClient: SavedObjectsClientContract) =>
new UiSettingsClient({
type: 'config',
id: version,
buildNum,
savedObjectsClient,
defaults: mapToObject(this.uiSettingsDefaults),
overrides,
log: this.log,
}),
sorenlouv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apm changes lgtm
|
@elasticmachine merge upstream |
💚 Build Succeeded
|
...ore/server/ui_settings/create_or_upgrade_saved_config/create_or_upgrade_saved_config.test.ts
Outdated
Show resolved
Hide resolved
joshdover
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple docs suggestions 👍
02d9657 to
1090981
Compare
walterra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ML changes LGTM
💔 Build Failed |
💚 Build Succeeded |
* add tests for logWithMetadata in LP * allow passing metadata to log in NP & LP * move ui_settings_client to NP * add ui_settings config * add ui_settings_service * switch to NP logging * export types * bootstrap uiSettings service in NP * pass NP uiSettings to LP * move ui_settings mock to NP * add test for mixin and switch to NP logger * make UiSettingsClient.getDefaults sync as it is * ui_settings_client uses private fields * ui_settings_client uses private methods * keep uiSettings config validation in NP only * update mocks * core context should know it is mocked * add tests for ui_settings_service * remove unused code from ui_settings_mixin test * improve types in ui_settings_mixin test * gen docs * test moved to NP * set pkg version in tests explicitly * update mocks in tests * UiSettingsServiceSetup --> InternalUiSettingsServiceSetup * add links to types * address eli comment * regen docs * remove unused types
* add tests for logWithMetadata in LP * allow passing metadata to log in NP & LP * move ui_settings_client to NP * add ui_settings config * add ui_settings_service * switch to NP logging * export types * bootstrap uiSettings service in NP * pass NP uiSettings to LP * move ui_settings mock to NP * add test for mixin and switch to NP logger * make UiSettingsClient.getDefaults sync as it is * ui_settings_client uses private fields * ui_settings_client uses private methods * keep uiSettings config validation in NP only * update mocks * core context should know it is mocked * add tests for ui_settings_service * remove unused code from ui_settings_mixin test * improve types in ui_settings_mixin test * gen docs * test moved to NP * set pkg version in tests explicitly * update mocks in tests * UiSettingsServiceSetup --> InternalUiSettingsServiceSetup * add links to types * address eli comment * regen docs * remove unused types
Summary
This PR moves UiSettingsClient creation to the NP API. We don't expose this API to the plugins, the only Legacy platform uses it under the hood.
If SavedObjectsClient is not available in the NP we can work around it and use one from LP. As suggested here.
That unblocks exposing UiSettings client via
RequestHandlerContext.Objections @elastic/kibana-platform ?
I'm going to move uiSettings routes to NP in the following PR
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.[ ] This was checked for cross-browser compatibility, including a check against IE11[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers