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

Expose plugin contracts to Legacy platform #37218

Merged
merged 2 commits into from
May 28, 2019

Conversation

mshustov
Copy link
Contributor

@mshustov mshustov commented May 28, 2019

Summary

Expose plugin contracts to Legacy platform and unify LegacyService.setup/start interfaces for server and client parts.

Checklist

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

For maintainers

Dev Docs

If you want to use a New Platform plugin in Legacy Platform you could access them

  • on client
import { getNewPlatform } from 'ui/new_platform';
const plugins: Record<string, unknown> = getNewPlatform().setup.plugins
  • on server
new kibana.Plugin({
  init(server){
    const plugins: Record<string, unknown> = server.newPlatform.setup.plugins;
  }
})

@mshustov mshustov added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:New Platform release_note:skip Skip the PR/issue when compiling release notes v7.3.0 labels May 28, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform

@mshustov mshustov force-pushed the expose-plugin-contracts-to-legacy branch from 671be56 to c8a0c1b Compare May 28, 2019 12:19
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mshustov mshustov marked this pull request as ready for review May 28, 2019 13:18
@mshustov mshustov requested review from a team as code owners May 28, 2019 13:18
Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

LGTM.

@mshustov mshustov added release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. and removed release_note:skip Skip the PR/issue when compiling release notes labels May 28, 2019
Copy link
Member

@mistic mistic left a comment

Choose a reason for hiding this comment

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

The changes within respect to the operations team LGTM

* under the License.
*/

export function mapToObject(map: Map<string, unknown>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer this file to exist in src/core/utils rather than litter the top-level public directory of core.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can move, np. afair we were going to remove this folder. aren't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as for me I'm fine to keep this folder for such env-agnostic utils

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed real quick and decided we're fine with the src/core/utils directory existing for only very generic vanilla JS utilities similar to what you'd find in lodash or a standard library.


export function mapToObject(map: Map<string, unknown>) {
const result: Record<string, unknown> = Object.create(null);
for (const [key, value] of map) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Object.fromEntries(map.entries())?

Copy link
Contributor Author

@mshustov mshustov May 28, 2019

Choose a reason for hiding this comment

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

I tried. but TS told me this is too fresh syntax 😄

another interesting case for you, TS allows me to use [].flatMap, because:

  // tsconfig.ts
  // Node 8 should support everything output by esnext, we override this
  // in webpack with loader-level compiler options
  "target": "esnext",

but it's not implemented in node v10, they added it in v11.
so our TS setup is a bit misleading

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@mshustov mshustov merged commit ab6f0a7 into elastic:master May 28, 2019
@mshustov mshustov deleted the expose-plugin-contracts-to-legacy branch May 28, 2019 19:12
mshustov added a commit to mshustov/kibana that referenced this pull request May 28, 2019
* expose plugin contracts to Legacy platform

* move mapToObject to src/core/utils
mshustov added a commit that referenced this pull request May 29, 2019
* expose plugin contracts to Legacy platform

* move mapToObject to src/core/utils
jkakavas pushed a commit to jkakavas/kibana that referenced this pull request May 30, 2019
* expose plugin contracts to Legacy platform

* move mapToObject to src/core/utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:New Platform release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. review Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v7.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants