Skip to content

Commit

Permalink
[autoload] support autoload without breaking bwc
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Feb 2, 2016
1 parent a2b4a87 commit 2510b30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@
var path = require('path');

module.exports = function (kibana) {
var mainFile = 'plugins/timelion/app';
if (Object.getOwnPropertyDescriptor(kibana.constructor.prototype, 'autoload').get) {
// the autoload list has been replaced with a getter that complains about
// improper access, bypass that getter by seeing if it is defined
mainFile = 'plugins/timelion/app_with_autoload';
}

return new kibana.Plugin({
require: ['kibana', 'elasticsearch'],
uiExports: {
app: {
title: 'Timelion',
description: 'Time series expressions for everything',
icon: 'plugins/timelion/icon.svg',
main: 'plugins/timelion/app',
main: mainFile,
injectVars: function (server, options) {
var config = server.config();
return {
Expand Down Expand Up @@ -51,4 +58,4 @@ module.exports = function (kibana) {
},
init: require('./init.js'),
});
};;
};
2 changes: 2 additions & 0 deletions public/app_with_autoload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require('ui/autoload/all');
require('./app');

0 comments on commit 2510b30

Please sign in to comment.