Hi,
I am creating a custom plugin for Kibana, and I am running into an issue with the plugin registration feature in this documentation: https://www.elastic.co/guide/en/kibana/current/development-plugin-feature-registration.html
When I try to look at the plugin after I installed I get the error:
TypeError: Cannot read property 'myPlugin' of undefined
I have added to my code the registration code:
init(server) {
const xpackMainPlugin = server.plugins.xpack_main;
xpackMainPlugin.registerFeature({
id: 'myPlugin',
name: 'My Plugin',
icon: 'merge',
navLinkId: 'myPlugin',
app: ['myPlugin', 'kibana'],
catalogue: ['myPlugin'],
privileges: {
all: {
savedObject: {
all: [],
read: [],
},
ui: ['show'],
},
read: {
savedObject: {
all: [],
read: [],
},
ui: ['show'],
},
},
});
}
and the code to utilize the boolean to show a feature or not:
import { uiCapabilities } from 'ui/capabilities';
const show = uiCapabilities.myPlugin.show;
if (show) {
// show feature
}
Is there some setup or configuration that I am missing in order to use uiCapabilities and have it defined?