Advanced settings component registry ⇒ kibana platform plugin#55940
Advanced settings component registry ⇒ kibana platform plugin#55940mattkime merged 27 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
|
|
||
| registerDefaultComponents(); | ||
|
|
||
| export const componentRegistry = { |
|
@elasticmachine merge upstream |
|
I’ll review tomorrow! |
legrego
left a comment
There was a problem hiding this comment.
Spaces changes LGTM! Tested locally
|
@elasticmachine merge upstream |
1 similar comment
|
@elasticmachine merge upstream |
x-pack/legacy/plugins/spaces/public/advanced_settings/advanced_settings_service.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/advanced_settings/public/component_registry/index.ts
Outdated
Show resolved
Hide resolved
| export interface AdvancedSettingsSetup { | ||
| componentRegistry: typeof componentRegistry; | ||
| } | ||
| export interface AdvancedSettingsStart { | ||
| componentRegistry: typeof componentRegistry; | ||
| } |
There was a problem hiding this comment.
We probably don't want these interfaces to be the same since it is a registry, right?
i.e. on Setup maybe only register should be available, and on Start only get, so that nobody is trying to register after setup
There was a problem hiding this comment.
It looks like its sufficient to provide register access in the setup lifecycle although it doesn't seem necessary to me - but I might be missing something. That said, I'm a little uncertain how this relates to legacy code - I'd be using register after setup is complete, correct?
There was a problem hiding this comment.
The reasoning behind doing it this way in other registries has been that, if you only allow registering in the setup lifecycle, by the time you get to start you can guaranteed that all items that are going to be registered are already present, and can then safely use get to retrieve anything from the registry.
This avoids the scenario where you may try to do something with the items in a registry which has not been fully populated yet.
It's a little weird in this case because I believe the only place the registry is being read from is in the advanced settings UI itself, which means new registry items will likely just re-render in React if they come in late. So I'm not sure if it would have a material impact in this particular plugin or not; I'm mostly bringing it up for the sake of consistency with how we've dealt with registries in other plugins. Examples of places where we've done this are expressions, inspector, management.
There was a problem hiding this comment.
Hm, what about license changes? How does that play with the setup / start, register / get pattern?
| componentType: { | ||
| PAGE_TITLE_COMPONENT, | ||
| PAGE_SUBTITLE_COMPONENT, | ||
| PAGE_FOOTER_COMPONENT, | ||
| }, |
There was a problem hiding this comment.
It feels like these should be static exports instead of part of the runtime contract, WDYT?
Perhaps in public/index.ts as:
export const component = {
PAGE_TITLE_COMPONENT,
PAGE_SUBTITLE_COMPONENT,
PAGE_FOOTER_COMPONENT,
};There was a problem hiding this comment.
Seems like thats likely one more import. Changed to an enum which seems to make code a little more compact. Past that I don't have a strong opinion.
...ins/kibana/public/management/sections/settings/__snapshots__/advanced_settings.test.tsx.snap
Outdated
Show resolved
Hide resolved
I assume that would be the desired behavior for a scenario where someone makes a license change though, right? I'd assume the available advanced settings reconfigure themselves immediately after that change. Both of the observable-based suggestions make sense to me and seem like a nice way to handle it. In particular I think the second approach is a nice experience because you don't have to track enabled/disabled, and users who aren't concerned about license changes don't have to know anything about the observables implementation. |
That makes sense if one person is using Kibana, but what if there are a number of people using it? |
…ttkime/kibana into adv_settings_componenet_reg_to_plugin
|
The license is still for the entire Kibana / stack installation... so if an administrator changes the license, the license observable should be emitting an update to anybody who is looking at Kibana advanced settings, and their UI would adjust accordingly, no? Edit: or perhaps in that scenario a page refresh would be required for other users to see the changes |
|
I'm curious if this specific registry really needs the ability to respond to license updates. As far as I'm aware, this registry is used by two consumers:
Telemetry is now part of OSS, so there are no license considerations there...it will always be available, unless the plugin itself is disabled. Disabling the plugin requires a restart anyway, so the UI wouldn't need to update itself dynamically in this case. Spaces is part of X-Pack, but it is always available under the Basic license. Like telemetry, the only way to remove it is to disable the plugin entirely, which requires a restart. If we aren't aware of any future consumers who need this functionality, then is it something we actually need to solve for here? |
Heh, good point. No. |
|
@elasticmachine merge upstream |
…ttkime/kibana into adv_settings_componenet_reg_to_plugin
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
lukeelmers
left a comment
There was a problem hiding this comment.
Changes all LGTM! And @legrego raises a great point on licensing. Definitely not an issue that needs to block this PR given the limited usage of this particular service.
…c#55940) * advanced settings component registry to new platform
…c#55940) * advanced settings component registry to new platform
#56808) * advanced settings component registry to new platform
* master: (23 commits) Properly handle password change for users authenticated with provider other than `basic`. (elastic#55206) Improve pull request template proposal (elastic#56756) Only change handlers as the element changes (elastic#56782) [SIEM][Detection Engine] Final final rule changes (elastic#56806) [SIEM][Detection Engine] critical blocker, wrong ilm policy, need to match beats ilm policy Move ui/agg_types in to shim data plugin (elastic#56353) [SIEM] Fixes Signals count spinner (elastic#56797) [docs] Update upgrade version path (elastic#56658) [Canvas] Use unique Id for Canvas Embeddables (elastic#56783) [Rollups] Adjust max width for job detail panel (elastic#56674) Prevent http client from converting our form data (elastic#56772) Disable creating alerts client instances when ESO plugin is using an ephemeral encryption key (elastic#56676) Bumps terser-webpack-plugin to 2.3.4 (elastic#56662) Advanced settings component registry ⇒ kibana platform plugin (elastic#55940) [Endpoint] EMT-67: add kql support for endpoint list (elastic#56328) Implement UI for Create Alert form (elastic#55232) Fix: Filter pill base coloring (elastic#56761) fix open close signal on detail page (elastic#56757) [Search service] Move loadingCount to sync search strategy (elastic#56335) Rollup TSVB integration: Add test and fix warning text (elastic#56639) ...
Summary
Move advanced settings component registry to kibana platform plugin.
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[ ] Documentation was added for features that require explanation or tutorials[ ] This was checked for keyboard-only and screenreader accessibilityFor maintainers
[ ] This was checked for breaking API changes and was labeled appropriately[ ] This includes a feature addition or change that requires a release note and was labeled appropriately