Do not use angular debug mode unless in development (#7929)

* fix #7125 - disable angular debug info
This commit is contained in:
Peter Pisljar 2016-10-29 17:12:51 +02:00 committed by GitHub
parent 9b5a96e034
commit 4755a39a7d
5 changed files with 10 additions and 48 deletions

View file

@ -69,6 +69,7 @@ export default async (kbnServer, server, config) => {
buildSha: config.get('pkg.buildSha'),
basePath: config.get('server.basePath'),
serverName: config.get('server.name'),
devMode: config.get('env.dev'),
uiSettings: {
defaults: await server.uiSettings().getDefaults(),
user: {}

View file

@ -10,7 +10,9 @@ describe('Chrome API :: Angular', () => {
getInjected: noop,
addBasePath: noop
};
kbnAngular(chrome, {});
kbnAngular(chrome, {
devMode: true
});
});
it('should return breadcrumbs based on the url', () => {
});

View file

@ -8,7 +8,6 @@ import { UrlOverflowServiceProvider } from '../../error_url_overflow';
const URL_LIMIT_WARN_WITHIN = 1000;
module.exports = function (chrome, internals) {
chrome.getFirstPathSegment = _.noop;
chrome.getBreadcrumbs = _.noop;
@ -33,6 +32,11 @@ module.exports = function (chrome, internals) {
return a.href;
}()))
.config(chrome.$setupXsrfRequestInterceptor)
.config(['$compileProvider', function ($compileProvider) {
if (!internals.devMode) {
$compileProvider.debugInfoEnabled(false);
}
}])
.run(($location, $rootScope, Private) => {
chrome.getFirstPathSegment = () => {
return $location.path().split('/')[1];

View file

@ -24,6 +24,7 @@ const internals = _.defaults(
rootTemplate: null,
showAppsLink: null,
xsrfToken: null,
devMode: true,
brand: null,
nav: [],
applicationClasses: []

View file

@ -110,21 +110,6 @@ export default class Common {
self.debug('returned from get, calling refresh');
return self.remote.refresh();
})
.then(function () {
self.debug('check testStatusPage');
if (testStatusPage !== false) {
self.debug('self.checkForKibanaApp()');
return self.checkForKibanaApp()
.then(function (kibanaLoaded) {
self.debug('kibanaLoaded = ' + kibanaLoaded);
if (!kibanaLoaded) {
var msg = 'Kibana is not loaded, retrying';
self.debug(msg);
throw new Error(msg);
}
});
}
})
.then(function () {
return self.remote.getCurrentUrl();
})
@ -216,37 +201,6 @@ export default class Common {
});
}
getApp() {
var self = this;
return self.remote.setFindTimeout(defaultFindTimeout)
.findByCssSelector('.app-wrapper .application')
.then(function () {
return self.runScript(function () {
var $ = window.$;
var $scope = $('.app-wrapper .application').scope();
return $scope ? $scope.chrome.getApp() : {};
});
});
}
checkForKibanaApp() {
var self = this;
return self.getApp()
.then(function (app) {
var appId = app.id;
self.debug('current application: ' + appId);
return appId === 'kibana';
})
.catch(function (err) {
self.debug('kibana check failed');
self.debug(err);
// not on the kibana app...
return false;
});
}
tryForTime(timeout, block) {
return Try.tryForTime(timeout, block);
}