27 December 2018 Engineering

Kibana Plugin API Changes in 6.6

By Raya Fratkina

Removal of lab stage for visualizations

We removed the lab stage for visualizations. The experimental stage is now the only non production stage available, and the one affected by the advanced setting to disable experimental visualizations.

Please just change a stage: 'lab' in your custom vis type to stage: 'experimental', to mark it as non production-ready/experimental.

via #25702

Visualization Categories

With introduction of the new visualization type selection we removed the category key from visualizations. All you need to do is to remove the category key from your visualization registration.

If you used CATEGORY.HIDDEN as a value to hide the type from the visualization wizard, just use the new hidden: true property instead.

via #23833

Upgraded Hapi framework for plugin backend endpoints

The Hapi framework has been upgraded from v14.2.0 to v17.5.3. There are a number of breaking changes affecting plugins that register custom bacekend routes. This does not affect plugins that do not have backend routes.

The reply callback interface for supplying responses has been replaced with an async/await interface and a “response toolkit”.
For example:

Up to 6.5

server.route({
  path: '/myroute',
  handler(req, reply) {
    getSomeData().then((data) => reply(data));
  }
});

server.route({
  path: '/myredirect',
  handler(req, reply) {
    reply.redirect('/otherroute');
  }
});

6.6 and later

server.route({
  path: '/myroute',
  async handler(req, h) {
    return await getSomeData();
  }
});

server.route({
  path: '/myredirect',
  handler(req, h) {
    return h.redirect('/otherroute');
  }
});

More details can be found in the Hapi upgrade guide.

via #21707