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

introduce StartServicesAccessor type for CoreSetup.getStartServices #60748

Merged

Conversation

pgayvallet
Copy link
Contributor

Summary

  • Introduce a new StartServicesAccessor type to avoid referencing it by CoreSetup['getStartServices'] in plugin code. This is done both in public and server
  • Update existing usages

@pgayvallet pgayvallet added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.7.0 labels Mar 20, 2020
@pgayvallet pgayvallet requested review from a team as code owners March 20, 2020 13:04
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices()](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
| [registerMountContext(contextName, provider)](./kibana-plugin-core-public.applicationsetup.registermountcontext.md) | Register a context provider for application mounting. Will only be available to applications that depend on the plugin that registered this context. Deprecated, use [CoreSetup.getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md)<!-- -->. |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using a type makes the doc generator to consider it a property instead of a function and therefor generated a lot of () diff...

Comment on lines +220 to +222
export type StartServicesAccessor<TPluginsStart extends object = object> = () => Promise<
[CoreStart, TPluginsStart]
>;
Copy link
Contributor Author

@pgayvallet pgayvallet Mar 20, 2020

Choose a reason for hiding this comment

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

  • StartServicesAccessor or CoreStartServicesAccessor ? Also open to other naming suggestion

  • I used <TPluginsStart extends object = object> to be consistent with CoreSetup<TPluginsStart extends object = object>, but maybe we want <TPluginsStart extends object = {}> instead?

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.

security/spaces changes LGTM

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

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

Great idea, code looks good.

@joshdover
Copy link
Contributor

Though I am a bit sad it's having to be used this much 🙁

@pgayvallet
Copy link
Contributor Author

Though I am a bit sad it's having to be used this much

Yea, I was a little surprise of the number of usages myself. PR still make sense, but we might want to take this PR's plugins code diff as a start to see if we can improve anything in our setup/start 'communication'

@rudolf
Copy link
Contributor

rudolf commented Mar 23, 2020

Though I am a bit sad it's having to be used this much 🙁

I agree and we'll probably see more usage of this server-side with Elasticsearch moving to setup.

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

Code owner changes LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

pgayvallet added a commit to pgayvallet/kibana that referenced this pull request Mar 24, 2020
…elastic#60748)

* create StartServicesAccessor type

* update generated doc

* update usages to use new type

* add missing public annotation
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 24, 2020
* master:
  Updating our direct usage of https-proxy-agent to 5.0.0 (elastic#58296)
  allow users to unset the throttle of an alert (elastic#60964)
  [Lens] Fix bug in metric config panel (elastic#60982)
  [SearchProfiler] Minor fixes (elastic#60919)
  [ML] Renaming ML setup and start contracts (elastic#60980)
  introduce StartServicesAccessor type for `CoreSetup.getStartServices` (elastic#60748)
  [SIEM][Detection Engine] Add rule's notification alert type (elastic#60832)
  [APM] Re-revert "Collect telemetry about data/API performance" (elastic#61030)
  [NP] Graph: get rid of saved objects class wrapper (elastic#59917)
  [EPM] merge duplicate fields when creating index patterns (elastic#60957)
  [Uptime] Ml detection of duration anomalies (elastic#59785)
  [Alerting] removes unimplemented buttons from Alert Details page (elastic#60934)
  [skip-ci] Fix CODEOWNERS paths for the Pulse team (elastic#60944)
  [APM] Threshold alerts (elastic#59566)
  [ML] Add support for percentiles aggregation to Transform wizard (elastic#60763)
  Cahgen save object duplicate message (elastic#60901)
pgayvallet added a commit that referenced this pull request Mar 24, 2020
…#60748) (#61070)

* create StartServicesAccessor type

* update generated doc

* update usages to use new type

* add missing public annotation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants