Skip to content

Comments

introduce StartServicesAccessor type for CoreSetup.getStartServices#60748

Merged
pgayvallet merged 8 commits intoelastic:masterfrom
pgayvallet:kbn-add-start-service-accessor-type
Mar 24, 2020
Merged

introduce StartServicesAccessor type for CoreSetup.getStartServices#60748
pgayvallet merged 8 commits intoelastic:masterfrom
pgayvallet:kbn-add-start-service-accessor-type

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 Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// 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)

| [register(app)](./kibana-plugin-core-public.applicationsetup.register.md) | Register an mountable application to the system. |
| [registerAppUpdater(appUpdater$)](./kibana-plugin-core-public.applicationsetup.registerappupdater.md) | Register an application updater that can be used to change the [AppUpdatableFields](./kibana-plugin-core-public.appupdatablefields.md) fields of all applications at runtime.<!-- -->This is meant to be used by plugins that needs to updates the whole list of applications. To only updates a specific application, use the <code>updater$</code> property of the registered application instead. |
| [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 pgayvallet merged commit babefb5 into elastic:master Mar 24, 2020
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 Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v7.7.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants