Skip to content

Commit

Permalink
Do not use angular debug mode unless in development (#7929)
Browse files Browse the repository at this point in the history
* fix #7125 - disable angular debug info
  • Loading branch information
ppisljar authored Oct 29, 2016
1 parent 9b5a96e commit 4755a39
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 48 deletions.
1 change: 1 addition & 0 deletions src/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down
4 changes: 3 additions & 1 deletion src/ui/public/chrome/api/__tests__/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
});
Expand Down
6 changes: 5 additions & 1 deletion src/ui/public/chrome/api/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/ui/public/chrome/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const internals = _.defaults(
rootTemplate: null,
showAppsLink: null,
xsrfToken: null,
devMode: true,
brand: null,
nav: [],
applicationClasses: []
Expand Down
46 changes: 0 additions & 46 deletions test/support/page_objects/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
})
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 4755a39

Please sign in to comment.