Skip to content
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

Advanced settings component registry ⇒ kibana platform plugin #55940

Merged

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Jan 25, 2020

Summary

Move advanced settings component registry to kibana platform plugin.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@mattkime mattkime changed the title advanced settings component registry to new platform Advanced settings component registry ⇒ new platform Jan 25, 2020
@mattkime mattkime changed the title Advanced settings component registry ⇒ new platform Advanced settings component registry ⇒ kibana platform plugin Jan 25, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@mattkime mattkime added the release_note:skip Skip the PR/issue when compiling release notes label Jan 25, 2020

registerDefaultComponents();

export const componentRegistry = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API right here

@mattkime mattkime marked this pull request as ready for review January 25, 2020 06:20
@mattkime mattkime requested review from a team as code owners January 25, 2020 06:20
@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@legrego
Copy link
Member

legrego commented Jan 27, 2020

I’ll review tomorrow!

Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces changes LGTM! Tested locally

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

1 similar comment
@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

Comment on lines 22 to 27
export interface AdvancedSettingsSetup {
componentRegistry: typeof componentRegistry;
}
export interface AdvancedSettingsStart {
componentRegistry: typeof componentRegistry;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, what about license changes? How does that play with the setup / start, register / get pattern?

Comment on lines 33 to 37
componentType: {
PAGE_TITLE_COMPONENT,
PAGE_SUBTITLE_COMPONENT,
PAGE_FOOTER_COMPONENT,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

src/plugins/advanced_settings/public/plugin.ts Outdated Show resolved Hide resolved
@lukeelmers
Copy link
Member

lukeelmers commented Jan 31, 2020

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

@legrego
Copy link
Member

legrego commented Feb 3, 2020

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
  • Spaces

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?

@legrego legrego mentioned this pull request Feb 3, 2020
@mattkime
Copy link
Contributor Author

mattkime commented Feb 3, 2020

@legrego

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.

@mattkime
Copy link
Contributor Author

mattkime commented Feb 4, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mattkime mattkime merged commit 16d412f into elastic:master Feb 4, 2020
mattkime added a commit to mattkime/kibana that referenced this pull request Feb 4, 2020
…c#55940)

* advanced settings component registry to new platform
mattkime added a commit to mattkime/kibana that referenced this pull request Feb 4, 2020
…c#55940)

* advanced settings component registry to new platform
mattkime added a commit that referenced this pull request Feb 5, 2020
#56808)

* advanced settings component registry to new platform
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 5, 2020
* 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)
  ...
majagrubic pushed a commit to majagrubic/kibana that referenced this pull request Feb 10, 2020
…c#55940)

* advanced settings component registry to new platform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants