New Platform - is it possible to use modules from the legacy platform?

I want to migrate my plugin to the new platform and I generated the skeleton using

I have encountered two anomalies:

  • On 7.7.0, after inserting visualizations in the requiredPlugins entry in kibana.json, visualizations does not work, resulting in "undefined" (I tried to use it in plugin.ts, both in setup and in start). The same plugin instead works on 7.8.0.
  • On 7.8.0, after inserting visualizations in the requiredPlugins entry in kibana.json, this works, I can do everything, only that the visualization type "region_map" is not in the list of all visualizations (visualizations.all ()), this should because of the "region_map" migration to the New Platform occurred in 7.9.0 (see link).

The question then is: can I import the legacy "visualizations" plugin into a Kibana New Platform plugin?

Thanks, I remain available for clarification

Unfortunately, no there is no way to do this from a new plugin. We've been careful to keep the new plugins free of any legacy code, so it's possible for legacy plugins to access new plugins (via importing from ui/new_platform) but not the other way around.

You can use the services in ui/new_platform to emulate a new plugin from within a legacy plugin, but it requires some manual steps:

  • You should load your plugin via a "hacks" uiExport to ensure your plugin is always loaded
  • You must run the "setup" and "start" functions of your plugin yourself
  • There are some limitations, for example, while legacy plugins can "depend on" any other new plugin via the ui/new_platform exports, these dependencies are not programmatically enforced. So you must handle the case where your dependency has been disabled. For custom development, this may not be a concern, but if your plugin is shared with others, it may be.

The vis_type_metric plugin on the 7.7 branch is a good example of this pattern. You'll notice in the index.js file there is a "hack" that points to the "public/legacy" file. This file handles setting up and starting the plugin manually.

The other option would be to wait for the 7.9 release in which all of the visualizations have been migrated. I don't have any timeline on when this will be released, but you can start developing against the 7.9 branch today.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.