Getting access to filterManager in Kibana 7.8

I wrote a plugin for Kibana 7.5 and I'm porting it to Kibana 7.8. I need access to the filterManager from within my visualization file. Is there an example of how to do this in Kibana 7.8? In 7.5 I was able to do the following:

import { start as data } from "../../../../src/legacy/core_plugins/data/public/legacy";

and then

this.filterManager = data.filter.filterManager;
this.filterWatcher = this.filterManager.getUpdates$().subscribe(this.inheritFilters.bind(this));

From my research, I think I need to import DataPublicPluginSetup to get access to the filterManager, but when I import that value, it is always "undefined". Is there a example somewhere of how to access the filterManager in Kibana 7.8?

Are you attempting to migrate to the Kibana platform when doing this? If you have a kibana.json file, then that's the case and you need to pass the filter manager instance down from the setup method of your plugin class.

Yes. I've created a basic 7.8 plugin and now I'm trying to add my code from my 7.5 plugin into the 7.8 plugin. We are in the process of moving from 7.5 to 7.8. So I do have a kibana.json file. After posting this question, I did find that I'll have to add "data" to my requiredPlugins section of the kibana.json file to get access to DataPublicPluginSetup. Things like that is what I need to know because that is total different than how it was setup in 7.5. Can you point me to an example of how to pass that information on from my setup method? Here's my current setup method:

public setup(core: CoreSetup, setupDeps: SetupDependencies) {
         name: PLUGIN_NAME,
         title: PLUGIN_TITLE,
         icon: visIcon,
         description: 'My Plugin',
         visConfig: {
            component: Visualization,
            defaults: {
         editorConfig: {
            optionsTemplate: Editor,
         requestHandler: defaultRequestHandler,
         responseHandler: defaultResponseHandler

Where my Visualization and Editor components are loaded like this:

import Visualization from './components/visualization';
import Editor from './components/editor';

I see, it's a little more tricky in that case. You can store the reference to data passed into your setup/start methods in a module your import from in your actual visualization.

Check out how the reference to the format service is passed down in the metric visualization:

You can do the exact same thing with the field formatter

Thank you! Those examples help a lot.

7.8 is a hard target for plugin development because a lot of things are in flux due to the migration to Kibana platform. Putting together better documentation and other material to write plugins is an important task on the roadmap/

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