Is it possible to have a hidden plugin with UI?


#1

Kibana 6.2.4

I created a hidden plugin (there is no icon in the left navbar). But I can't access a UI route.
When I put this URL in browser http://localhost:5601/ncz/app/alert, I get

{"statusCode":404,"error":"Not Found","message":"Unknown app alert"}

Though, I see my app server log among Kibana logs

server    log   [11:37:47.023] [info][alert] starting...

How can I add the UI route?


The app code on GitHub https://github.com/sergibondarenko/alert
Install instructions:

git clone git@github.com:sergibondarenko/alert.git
cd alert
npm install && npm install -g gulp
gulp sync --kibanahomepath=/path/to/kibana

Plugin index.js

module.exports = function (kibana) {
  return new kibana.Plugin({
    name: 'alert',
    require: [
      'kibana',
      'elasticsearch',
      'investigate_core',
      'saved_objects_api',
    ],
    uiExports: {
      navbarExtensions: ['plugins/alert/navbar_extensions/dashboard_button/dashboard_button'],
      apps: [{
        title: 'alert',
        id: 'alert',
        description: 'It is an extension',
        hidden: true,
        main: 'plugins/alert/app.js',
      }]
    },
    init: require('./server/init')
  });
};

init.js

import { once } from 'lodash';

const init = once(function (server) {
  server.log(['info', 'alert'], 'starting...');
});

export default function (server, options) {
  if (server.plugins.elasticsearch.status.state === 'green') {
    init(server);
  } else {
    server.plugins.elasticsearch.status.on('change', () => {
      if (server.plugins.elasticsearch.status.state === 'green') {
        init(server);
      }
    });
  }
};

Public app.js

import uiModules from 'ui/modules';
import uiRoutes from 'ui/routes';

import rootTemplate from './templates/root_template.html';

uiRoutes.enable();
uiRoutes
.when('/', {
  template: rootTemplate,
  controller: 'RootController',
});

const app = uiModules.get('apps/alert', []);
app.controller('RootController', function ($scope) {
  $scope.description = 'alert';
});

(Thomas Neirynck) #2

Corresponding github issue here: https://github.com/elastic/kibana/issues/24907


(Lovely Sidhu) #3

This was indeed a great post buddy, I would love to come back and see more such post in near future. :heart_eyes::heart_eyes:


(system) #4

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