Kibana custom plugin breaks the interface

Hello,

I am trying to code a custom visualization on Kibana 6.6.1, however, the plugin registration breaks the interface.

The code is extremely simple since for the moment I only generated the plugin with the plugin generator and tried to register the new visualization.

index.js
import exampleRoute from './server/routes/example';

export default function (kibana) {
  return new kibana.Plugin({
    require: ['elasticsearch'],
    name: 'custom_export',
    uiExports: {
       visTypes: ['plugins/custom_export/vis']
    },

    config(Joi) {
      return Joi.object({
        enabled: Joi.boolean().default(true),
      }).default();
    },

    init(server, options) { // eslint-disable-line no-unused-vars
      // Add server routes and initialize the plugin here
      exampleRoute(server);
    }
  });
}

public/vis.js
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

const CustomExportVis = (Private) => {
  const VisFactory = Private(VisFactoryProvider);

  return  VisFactory.createBaseVisualization({
    name: 'custom_export',
    title: 'Custom export',
    icon: 'fa_tachometer',
    description: 'Custom export button for Kibana',
  });
}
VisTypesRegistryProvider.register(CustomExportVis);

For information removing the line "VisTypesRegistryProvider.register(CustomExportVis);" makes the interface work but not the plugin (obviously). I see no errors in the log output.

Why is the interface reacting this way?

not sure what goes wrong,

could you try copying the metric visualization (src/core_plugins/metric/) and start from there ?
or can you put your whole code somewhere so i can easily test it out ?

thanks

I managed to move the metric_vis plugin, but no way to make my code work from there, I will try again when I have more time...

I put the code here:

Still Is there some basic plugin visualization code provided by the Kibana dev team ? Because I find the plugin development documentation confusing for new Kibana plugin developers

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