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

Switch Home/Discover/Dashboard/Visualize/Lens/Dev Tools to core application service #61304

Closed
flash1293 opened this issue Mar 25, 2020 · 1 comment · Fixed by #63443
Closed
Assignees
Labels
Feature:NP Migration Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@flash1293
Copy link
Contributor

flash1293 commented Mar 25, 2020

Currently home, discover, dashboard, visualize, lens and dev tools are registering itself with the kibana_legacy plugin instead of the core application service. This happens to be able to render within the legacy platform because not everything is migrated yet.

Switch to core application service

Once all of the apps are moved to the new platform (#60097), it's possible to switch these registrations to the actual core.applications service. By rendering in the new platform directly, it will be possible to switch between individual apps without a page reload (including solution apps).

Current:

    plugins.kibanaLegacy.registerLegacyApp({
      id: 'discover',
      title: 'Discover',
      updater$: this.appStateUpdater.asObservable(),
      navLinkId: 'kibana:discover',
      // ...

After switch:

    core.applications.register({
      id: 'discover',
      title: 'Discover',
      updater$: this.appStateUpdater.asObservable(),
      // navLinkId is not required anymore, this is just necessary for the legacy app renderer
      // ...

Redirect old urls

However this also means the URL structure changes, because e.g. discover will be rendered under app/discover instead of app/kibana#/discover. To keep old URLs (e.g. from short urls or bookmarks) working, kibana_legacy should make sure to redirect them properly to their new target. In the hash path, the app name prefix can be removed, e.g. app/kibana#/discover should redirect to app/discover#/

To implement this, the already existing forwardApp method of kibana_legacy can be extended to cover existing use cases. The only existing usages so far (src/legacy/core_plugins/kibana/public/kibana.js) should be moved to the discover plugin.

Dashboard URL structure

The dashboard app is currently in a weird state because it uses both dashboards and dashboard as prefix. In the new platform, there should be only app/dashboard, redirecting everything else like described here: #49060

Fix existing URL builders

In several places URLs to these apps are built locally (e.g. x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js, x-pack/plugins/searchprofiler/public/plugin.ts, x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx, ... - not complete).

As this is inherently brittle, all apps once registered under their new location should register an url generator (https://github.com/elastic/kibana/tree/master/src/plugins/share/public/url_generators) in the share plugin which is consumed by the plugins currently building URLs manually.

For dashboard that's already done, in this case the existing generator has to be adjusted: https://github.com/elastic/kibana/blob/master/src/plugins/dashboard/public/plugin.tsx#L94

In case this task takes too long, it can also be solved after the cutover, but it would be better to fix it in the same release to avoid unnecessary page reloads.

Removal of kibanaLegacy.registerLegacyApp

The kibana_legacy application service currently also renders the management app and all individual sections. When everything in the legacy kibana plugin is completely migrated, it can be removed and the NP kibana_legacy platform can take over the kibana app id to continue to redirect legacy URLs. This is tracked in #61308.

Blockers

  • Currently the core application appUpdater$ interface does not allow updating the nav link, this is tracked here: Allow AppUpdater to change URL for app in Nav #56027
  • All visualizations and all four applications have to be moved to the platform before this can be implemented (because the legacy platform won't be loaded if the current app is rendered via core application service).
  • The maps application (or at least the visTypeAlias definition) has to be moved to the new platform for it to show up in the vis modal.
@flash1293 flash1293 added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:NP Migration labels Mar 25, 2020
@elasticmachine
Copy link
Contributor

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

@flash1293 flash1293 changed the title Switch Discover/Dashboard/Visualize/Dev Tools to core application service Switch Discover/Dashboard/Visualize/Lens/Dev Tools to core application service Mar 26, 2020
@flash1293 flash1293 changed the title Switch Discover/Dashboard/Visualize/Lens/Dev Tools to core application service Switch Home/Discover/Dashboard/Visualize/Lens/Dev Tools to core application service Apr 6, 2020
@flash1293 flash1293 self-assigned this Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:NP Migration Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants