feat(app): disable Angular debug information on release (#867)

pull/870/head
Anthony Lapenna 2017-05-19 17:48:03 +02:00 committed by GitHub
parent 782df54570
commit 2ef1c90248
3 changed files with 131 additions and 99 deletions

View File

@ -51,9 +51,14 @@ angular.module('portainer', [
'user',
'users',
'volumes'])
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', '$uibTooltipProvider', function ($stateProvider, $urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider, $uibTooltipProvider) {
.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'localStorageServiceProvider', 'jwtOptionsProvider', 'AnalyticsProvider', '$uibTooltipProvider', '$compileProvider', function ($stateProvider, $urlRouterProvider, $httpProvider, localStorageServiceProvider, jwtOptionsProvider, AnalyticsProvider, $uibTooltipProvider, $compileProvider) {
'use strict';
var environment = '@@ENVIRONMENT';
if (environment === 'production') {
$compileProvider.debugInfoEnabled(false);
}
localStorageServiceProvider
.setStorageType('sessionStorage')
.setPrefix('portainer');
@ -100,7 +105,7 @@ angular.module('portainer', [
error: ''
},
views: {
"content@": {
'content@': {
templateUrl: 'app/components/auth/auth.html',
controller: 'AuthenticationController'
}
@ -113,63 +118,63 @@ angular.module('portainer', [
parent: 'root',
url: '/containers/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/containers/containers.html',
controller: 'ContainersController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('container', {
url: "^/containers/:id",
url: '^/containers/:id',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/container/container.html',
controller: 'ContainerController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('stats', {
url: "^/containers/:id/stats",
url: '^/containers/:id/stats',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/stats/stats.html',
controller: 'StatsController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('logs', {
url: "^/containers/:id/logs",
url: '^/containers/:id/logs',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/containerLogs/containerlogs.html',
controller: 'ContainerLogsController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('console', {
url: "^/containers/:id/console",
url: '^/containers/:id/console',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/containerConsole/containerConsole.html',
controller: 'ContainerConsoleController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -179,11 +184,11 @@ angular.module('portainer', [
parent: 'root',
url: '/dashboard',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/dashboard/dashboard.html',
controller: 'DashboardController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -191,75 +196,75 @@ angular.module('portainer', [
})
.state('actions', {
abstract: true,
url: "/actions",
url: '/actions',
views: {
"content@": {
'content@': {
template: '<div ui-view="content@"></div>'
},
"sidebar@": {
template: '<div ui-view="sidebar@"></div>'
'sidebar@': {
template: '<div ui-view"sidebar@"></div>'
}
}
})
.state('actions.create', {
abstract: true,
url: "/create",
url: '/create',
views: {
"content@": {
'content@': {
template: '<div ui-view="content@"></div>'
},
"sidebar@": {
template: '<div ui-view="sidebar@"></div>'
'sidebar@': {
template: '<div ui-view"sidebar@"></div>'
}
}
})
.state('actions.create.container', {
url: "/container",
url: '/container',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/createContainer/createcontainer.html',
controller: 'CreateContainerController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('actions.create.network', {
url: "/network",
url: '/network',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/createNetwork/createnetwork.html',
controller: 'CreateNetworkController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('actions.create.service', {
url: "/service",
url: '/service',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/createService/createservice.html',
controller: 'CreateServiceController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
}
})
.state('actions.create.volume', {
url: "/volume",
url: '/volume',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/createVolume/createvolume.html',
controller: 'CreateVolumeController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -268,11 +273,11 @@ angular.module('portainer', [
.state('docker', {
url: '/docker/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/docker/docker.html',
controller: 'DockerController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -281,11 +286,11 @@ angular.module('portainer', [
.state('endpoints', {
url: '/endpoints/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/endpoints/endpoints.html',
controller: 'EndpointsController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -294,11 +299,11 @@ angular.module('portainer', [
.state('endpoint', {
url: '^/endpoints/:id',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/endpoint/endpoint.html',
controller: 'EndpointController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -307,11 +312,11 @@ angular.module('portainer', [
.state('endpoint.access', {
url: '^/endpoints/:id/access',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/endpointAccess/endpointAccess.html',
controller: 'EndpointAccessController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -320,7 +325,7 @@ angular.module('portainer', [
.state('endpointInit', {
url: '/init/endpoint',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/endpointInit/endpointInit.html',
controller: 'EndpointInitController'
}
@ -329,11 +334,11 @@ angular.module('portainer', [
.state('events', {
url: '/events/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/events/events.html',
controller: 'EventsController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -342,11 +347,11 @@ angular.module('portainer', [
.state('images', {
url: '/images/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/images/images.html',
controller: 'ImagesController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -355,11 +360,11 @@ angular.module('portainer', [
.state('image', {
url: '^/images/:id/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/image/image.html',
controller: 'ImageController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -368,11 +373,11 @@ angular.module('portainer', [
.state('networks', {
url: '/networks/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/networks/networks.html',
controller: 'NetworksController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -381,11 +386,11 @@ angular.module('portainer', [
.state('network', {
url: '^/networks/:id/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/network/network.html',
controller: 'NetworkController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -394,11 +399,11 @@ angular.module('portainer', [
.state('node', {
url: '^/nodes/:id/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/node/node.html',
controller: 'NodeController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -407,11 +412,11 @@ angular.module('portainer', [
.state('services', {
url: '/services/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/services/services.html',
controller: 'ServicesController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -420,11 +425,11 @@ angular.module('portainer', [
.state('service', {
url: '^/service/:id/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/service/service.html',
controller: 'ServiceController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -433,11 +438,11 @@ angular.module('portainer', [
.state('settings', {
url: '/settings/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/settings/settings.html',
controller: 'SettingsController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -446,11 +451,11 @@ angular.module('portainer', [
.state('task', {
url: '^/task/:id',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/task/task.html',
controller: 'TaskController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -463,11 +468,11 @@ angular.module('portainer', [
hide_descriptions: false
},
views: {
"content@": {
'content@': {
templateUrl: 'app/components/templates/templates.html',
controller: 'TemplatesController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -480,11 +485,11 @@ angular.module('portainer', [
hide_descriptions: true
},
views: {
"content@": {
'content@': {
templateUrl: 'app/components/templates/templates.html',
controller: 'TemplatesController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -493,11 +498,11 @@ angular.module('portainer', [
.state('volumes', {
url: '/volumes/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/volumes/volumes.html',
controller: 'VolumesController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -506,11 +511,11 @@ angular.module('portainer', [
.state('users', {
url: '/users/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/users/users.html',
controller: 'UsersController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -519,11 +524,11 @@ angular.module('portainer', [
.state('user', {
url: '^/users/:id',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/user/user.html',
controller: 'UserController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -532,11 +537,11 @@ angular.module('portainer', [
.state('swarm', {
url: '/swarm/',
views: {
"content@": {
'content@': {
templateUrl: 'app/components/swarm/swarm.html',
controller: 'SwarmController'
},
"sidebar@": {
'sidebar@': {
templateUrl: 'app/components/sidebar/sidebar.html',
controller: 'SidebarController'
}
@ -564,7 +569,7 @@ angular.module('portainer', [
});
}
}, function error(err) {
Notifications.error("Failure", err, 'Unable to retrieve application settings');
Notifications.error('Failure', err, 'Unable to retrieve application settings');
});
$rootScope.$state = $state;

View File

@ -14,10 +14,12 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-usemin');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-config');
// Default task.
grunt.registerTask('default', ['eslint', 'build']);
grunt.registerTask('build', [
'config:dev',
'clean:app',
'if:unixBinaryNotExist',
'html2js',
@ -25,12 +27,14 @@ module.exports = function (grunt) {
'recess:build',
'concat',
'clean:tmpl',
'replace',
'copy',
'filerev',
'usemin',
'clean:tmp'
]);
grunt.registerTask('release', [
'config:prod',
'clean:all',
'if:unixBinaryNotExist',
'html2js',
@ -39,76 +43,80 @@ module.exports = function (grunt) {
'concat',
'clean:tmpl',
'cssmin',
'replace',
'uglify',
'copy:assets',
'filerev',
'usemin',
'clean:tmp',
'replace'
'clean:tmp'
]);
grunt.registerTask('release-win', [
'config:prod',
'clean:all',
'if:windowsBinaryNotExist',
'html2js',
'useminPrepare',
'useminPrepare:release',
'recess:build',
'concat',
'clean:tmpl',
'cssmin',
'replace',
'uglify',
'copy',
'filerev',
'usemin',
'clean:tmp',
'replace'
'clean:tmp'
]);
grunt.registerTask('release-arm', [
'config:prod',
'clean:all',
'if:unixArmBinaryNotExist',
'html2js',
'useminPrepare',
'useminPrepare:release',
'recess:build',
'concat',
'clean:tmpl',
'cssmin',
'replace',
'uglify',
'copy',
'filerev',
'usemin',
'clean:tmp',
'replace'
'clean:tmp'
]);
grunt.registerTask('release-arm64', [
'config:prod',
'clean:all',
'if:unixArm64BinaryNotExist',
'html2js',
'useminPrepare',
'useminPrepare:release',
'recess:build',
'concat',
'clean:tmpl',
'cssmin',
'replace',
'uglify',
'copy',
'filerev',
'usemin',
'clean:tmp',
'replace'
'clean:tmp'
]);
grunt.registerTask('release-macos', [
'config:prod',
'clean:all',
'if:darwinBinaryNotExist',
'html2js',
'useminPrepare',
'useminPrepare:release',
'recess:build',
'concat',
'clean:tmpl',
'cssmin',
'replace',
'uglify',
'copy',
'filerev',
'usemin',
'clean:tmp',
'replace'
'clean:tmp'
]);
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('run', ['if:unixBinaryNotExist', 'build', 'shell:buildImage', 'shell:run']);
@ -127,6 +135,22 @@ module.exports = function (grunt) {
grunt.initConfig({
distdir: 'dist',
pkg: grunt.file.readJSON('package.json'),
config: {
dev: {
options: {
variables: {
'environment': 'development'
}
}
},
prod: {
options: {
variables: {
'environment': 'production'
}
}
}
},
src: {
js: ['app/**/*.js', '!app/**/*.spec.js'],
jsTpl: ['<%= distdir %>/templates/**/*.js'],
@ -268,8 +292,6 @@ module.exports = function (grunt) {
},
uglify: {
dist: {
// options: {
// },
src: ['<%= src.js %>', '<%= src.jsTpl %>'],
dest: '<%= distdir %>/js/<%= pkg.name %>.js'
},
@ -450,9 +472,13 @@ module.exports = function (grunt) {
}
},
replace: {
dist: {
concat: {
options: {
patterns: [
{
match: 'ENVIRONMENT',
replacement: '<%= grunt.config.get("environment") %>'
},
{
match: 'CONFIG_GA_ID',
replacement: '<%= pkg.config.GA_ID %>'
@ -463,8 +489,8 @@ module.exports = function (grunt) {
{
expand: true,
flatten: true,
src: ['dist/js/**.js'],
dest: 'dist/js/'
src: ['.tmp/concat/js/app.js'],
dest: '.tmp/concat/js'
}
]
}

View File

@ -27,6 +27,7 @@
"bower": "^1.5.2",
"eslint": "^3.19.0",
"grunt": "~0.4.0",
"grunt-config": "^1.0.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-copy": "~0.4.0",