prevent failure when kibana is included outside of its normal environment
This commit is contained in:
parent
7671fc689a
commit
cdb5df7b54
|
@ -4,14 +4,18 @@ require('plugins/kibana/dashboard/index');
|
|||
require('plugins/kibana/settings/index');
|
||||
require('plugins/kibana/doc/index');
|
||||
|
||||
var chrome = require('ui/chrome');
|
||||
var routes = require('ui/routes');
|
||||
var modules = require('ui/modules');
|
||||
|
||||
var kibanaLogoUrl = require('ui/images/kibana.png');
|
||||
|
||||
require('ui/routes')
|
||||
routes
|
||||
.otherwise({
|
||||
redirectTo: '/discover'
|
||||
});
|
||||
|
||||
require('ui/chrome')
|
||||
chrome
|
||||
.setBrand({
|
||||
'logo': 'url(' + kibanaLogoUrl + ') left no-repeat',
|
||||
'smallLogo': 'url(' + kibanaLogoUrl + ') left no-repeat'
|
||||
|
@ -50,10 +54,10 @@ require('ui/chrome')
|
|||
});
|
||||
});
|
||||
|
||||
var vars = require('ui/chrome').getInjectedVars();
|
||||
require('ui/modules').get('kibana')
|
||||
.constant('kbnIndex', vars.kbnIndex)
|
||||
.constant('esShardTimeout', vars.esShardTimeout)
|
||||
modules
|
||||
.get('kibana')
|
||||
.constant('kbnIndex', chrome.getInjected('kbnIndex'))
|
||||
.constant('esShardTimeout', chrome.getInjected('kbnIndex'))
|
||||
.constant('esUrl', (function () {
|
||||
var a = document.createElement('a');
|
||||
a.href = '/elasticsearch';
|
||||
|
|
|
@ -31,8 +31,9 @@ module.exports = function (chrome, internals) {
|
|||
return internals.app.id;
|
||||
};
|
||||
|
||||
chrome.getInjectedVars = function () {
|
||||
return internals.vars;
|
||||
chrome.getInjected = function (name, def) {
|
||||
if (name == null) return _.clone(internals.vars) || {};
|
||||
return _.get(internals.vars, name, def);
|
||||
};
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue