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

Reverse dependency of home plugin and apm/ml/cloud #52883

Merged
merged 25 commits into from
Jan 15, 2020

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Dec 12, 2019

Currently the home plugin depends on several x-pack plugins to be available. This PR reverses the dependency by providing a function to set the environment the home app is rendering via the setup contract of the home app. Now the x-pack plugins have an optional dependency of the home app instead of the other way around.

This approach is still not 100% clean because the home app implicitly knows about these x-pack plugins, but it solves the problem of explicit dependency. If this portion of the home app is re-done in the future, the API should be replaced by display-specific extension points (e.g. registerPanel) instead of explicit knowledge of the x-pack functionality. Till then I marked these APIs as deprecated to discourage extension.

@flash1293
Copy link
Contributor Author

Jenkins, test this.

@kibanamachine
Copy link
Contributor

💔 Build Failed

History

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

@elastic elastic deleted a comment from elasticmachine Dec 30, 2019
@flash1293 flash1293 added Feature:Home Kibana home application Feature:NP Migration Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.6.0 v8.0.0 labels Jan 7, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@flash1293 flash1293 added the release_note:skip Skip the PR/issue when compiling release notes label Jan 7, 2020
@flash1293 flash1293 marked this pull request as ready for review January 7, 2020 13:41
@flash1293 flash1293 requested a review from a team as a code owner January 7, 2020 13:41
@flash1293 flash1293 requested a review from a team January 7, 2020 13:41
@flash1293 flash1293 requested a review from a team as a code owner January 7, 2020 13:41
Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

ML changes LGTM

@kertal
Copy link
Member

kertal commented Jan 13, 2020

@elasticmachine merge upstream

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

Code LGTM, minor comment regarding a missing 'expect'. This was done because of the way it work with the 'cloud' plugin, am I right?

test('allows multiple update calls', () => {
const setup = new EnvironmentService().setup();
setup.update({ ml: true });
setup.update({ apmUi: true });
Copy link
Member

Choose a reason for hiding this comment

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

There's an expect missing in this test, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sort of, the test is that this doesn't throw. I added an explicit expect(...).not.toThrow()

@@ -93,7 +92,6 @@ export class ApmPlugin

// Take the DOM element as the constructor, so we can mount the app.
public setup(_core: CoreSetup, plugins: ApmPluginSetupDeps) {
plugins.home.featureCatalogue.register(featureCatalogueEntry);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is in here for the NP plugin to register itself, and will run both as a shim and when we move it to a pure NP plugin. The legacy_register_feature.ts above is only run in the legacy plugin.

We would only be removing this here if the featureCatalog.register is not wanted in the NP plugin. Is that the case?

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 is wanted, but currently it's registered twice because the legacy_register_feature file is pulled into the apm bundle as well. I traced back the change and this happens because the home ui export is a dependency of visualize which is loaded everywhere. It seems like this is not necessary and removing the import there also fixes this problem.

@@ -23,7 +23,6 @@ import 'uiExports/docViews';
import 'uiExports/embeddableActions';
import 'uiExports/fieldFormatEditors';
import 'uiExports/fieldFormats';
import 'uiExports/home';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maryia-lapata this caused all home ui export entrypoints to be included in all bundles (because the visualize embeddable is loaded as a "hack" entrypoint). Could you confirm that it's not actually needed to render visualizations?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that I'm a right person to confirm that. I just removed these exports during centralizing dependancies and then returned it back during Visualize shimming.

I also found that these exports were introduced in https://github.com/elastic/kibana/pull/39126/files#diff-53ca92fe2de1ead9193e8c05dc91d415R29. Maybe it helps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, just looked one level deep in the git blame :) @stacey-gammon is there a dependency of the visualize embeddable code to the home exports you know of? I'm only seeing feature registrations but maybe I'm missing something.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's needed, I was probably over-zealous in my copy/pasting that ended that line up here.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

👍 on APM changes. Thanks!

@flash1293 flash1293 merged commit b9a0f95 into elastic:master Jan 15, 2020
flash1293 added a commit to flash1293/kibana that referenced this pull request Jan 15, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 15, 2020
* upstream/master: (72 commits)
  [ML] Calculate model memory limit API integration tests (elastic#54557)
  Skip flakey index template component integration tests. (elastic#54878)
  Add label and icon to nested fields in the doc table (elastic#54199)
  Reverse dependency of home plugin and apm/ml/cloud (elastic#52883)
  [SIEM][Detection Engine] Order JSON keys, fix scripts, update pre-packaged rules
  update invalid snapshot
  add readme note about alerting / manage_api_key cluster privilege (elastic#54639)
  [SIEM] New Overview Page (elastic#54783)
  [Uptime] Feature/refactor context initialization (elastic#54494)
  Upgrade EUI to v18.2.0 (elastic#54786)
  [SIEM] [Detection engine] from signals to timeline (elastic#54769)
  [Index Management] Add Mappings Editor to Index Template Wizard (elastic#47562)
  [SIEM][Detection Engine] Removes deprecated filter from mapping
  [Maps] Add categorical styling (elastic#54408)
  Add mapbox-gl-rtl-text library (elastic#54842)
  [SIEM][Detection Engine] Adds actions to Rule Details (elastic#54828)
  Lexicographically sort location tags (elastic#54832)
  [Maps] expand extent filter to tile boundaries (elastic#54276)
  [Maps] Use v7.6 Elastic Maps Service API (elastic#54399)
  [DOCS] Adds monitoring setting (elastic#54819)
  ...
jkelastic pushed a commit to jkelastic/kibana that referenced this pull request Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Home Kibana home application Feature:NP Migration release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants