Skip to content

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

@flash1293

Description

@flash1293

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.

Metadata

Metadata

Assignees

Labels

Feature:NP MigrationTeam:VisualizationsTeam label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t//

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions