I am creating a Kibana plugin, and I want to add a new plugin, so I need to add a button on the top navbar of the visualization pages. I have two questions:
1- how do I add the button?
2- how can I access the data/request in the visualzition using also my plugin (like when I click the new button)?
For the first question, I did this:
import { NavigationPublicPluginSetup } from '../../../src/plugins/navigation/public/types';
interface PluginSetupDeps {
navigation: NavigationPublicPluginSetup;
}
export class MyPlugin implements Plugin<MyPluginSetup, MyPluginStart> {
public setup(core: CoreSetup, { navigation }: PluginSetupDeps) {
const customExtension = {
id: 'plugin-prop',
label: 'Click Me', // [optional] label to use, otherwise it uses whatever you put in 'key'
run: () => {
alert('hi');
},
};
navigation.registerMenuItem(customExtension);
return {};
}
public start(core: CoreStart) {
return {};
}
public stop() {}
}
but the 'navigation' was undefined. Is 'NavigationPublicPluginSetup ' right? or what is the wrong?
Thanks.