Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding "plugins" : proposed pull request #344

Closed
ghost opened this issue Aug 8, 2013 · 4 comments
Closed

Adding "plugins" : proposed pull request #344

ghost opened this issue Aug 8, 2013 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 8, 2013

I have extended Kibana with a simple "plugin" mechanism modeled after the existing panel mechanism. The purpose is to support injecting new modules in a way that only has to touch config.js, rather than having to modify app.js . Since the intent is to support arbitrary modules, "panels" did not seem appropriate, but usage is the same.

As part of this, in order to allow plugins to register to handle routes without dashboard loading, I am also proposing to replace the "$routeChangeSuccess" listener in the services.js/dashboard with a proper controller.

The changes preserve all existing behavior, including the loading of the default dashboard if a nonsense fragment is entered. The difference is that I can also now add my own module that registers new routes with the $routeProvider, and I won't always get the dash loading behavior (since this is implemented in a "global" event listener).

The essential changes are below, but if you are favorable I'll submit a pull request so you can see the complete changes.

services.js: remove
$rootScope.$on('$routeChangeSuccess',function(){
// Clear the current dashboard to prevent reloading
self.current = {};
self.indices = [];
route();
});

controllers.js: add

_.each(config.plugins, function(v) {
labjs = labjs.script('plugins/'+v+'/module.js');
modules.push('kibana.'+v);
});

...

.controller('DashRouteCtrl', function (dashboard) {
// Invoked whenever the route changes in order to load the correct dashboard
dashboard.current = {};
dashboard.indices = [];
dashboard.route();
})

app.js: change

  var route = { templateUrl: 'partials/dashboard.html', controller: 'DashRouteCtrl' };

  $routeProvider
    .when('/dashboard', route)
    .when('/dashboard/:type/:id', route)
    .when('/dashboard/:type/:id/:params', route)
    .otherwise({
      redirectTo: 'dashboard'
    });
@ghost
Copy link
Author

ghost commented Aug 8, 2013

See description of changes here:
https://github.com/packetvideo/kibana-dj/commit/0dec84b024dfc3f458b8e4bdc5aaca910dd6582f

(Ignore the '[dj]' plugin, this should be an empty list)

@rashidkpc
Copy link
Contributor

Given that this doesn't modify any existing behavior, I think its probably a good idea. Might also make sense to change 'modules' to 'panels' in the config and document the different.

What sort of new routes are you thinking of adding?

@ghost
Copy link
Author

ghost commented Aug 14, 2013

Thanks for the reply, Rashid.

The markdown in the original ticket got munged; the comment I added afterward links to a commit that makes the change clearer.

In my fork, if Kibana gets a route of #/dj/(id) rather than #/dashboard/(type)/(id), then my controller constructs a dashboard model using a particular JSON format. I added some documentation to my fork’s README:
https://github.com/packetvideo/kibana-dj/blob/master/README.md

The module implementation is here, still a work in progress:
https://github.com/packetvideo/kibana-dj/blob/master/plugins/dj/module.js
In essence the dashboard in DJ JSON format is loaded and manipulated into the model Kibana is expecting.

--Andy

From: Rashid Khan [mailto:notifications@github.com]
Sent: Tuesday, August 13, 2013 8:10 PM
To: elasticsearch/kibana
Cc: Andy Jenkins
Subject: Re: [kibana] Adding "plugins" : proposed pull request (#344)

Given that this doesn't modify any existing behavior, I think its probably a good idea. Might also make sense to change 'modules' to 'panels' in the config and document the different.

What sort of new routes are you thinking of adding?


Reply to this email directly or view it on GitHubhttps://github.com//issues/344#issuecomment-22607011.

@rashidkpc
Copy link
Contributor

Closing this, we're heading down a different path for being able to inject other applications besides the dashboard.

spalger pushed a commit that referenced this issue Oct 6, 2014
spalger pushed a commit to spalger/kibana that referenced this issue Mar 3, 2016
harper-carroll pushed a commit to harper-carroll/kibana that referenced this issue Jul 11, 2016
Moved config protos to package; added UX protos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@rashidkpc and others