diff --git a/Gruntfile.js b/Gruntfile.js index e0ca10d..739b623 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -62,6 +62,7 @@ module.exports = function (grunt) { directives: { node: true, nomen: true, + unparam: true, predef: [ // Global variables 'document', '$', '$get', 'angular', 'inject', 'JustGage', @@ -111,72 +112,74 @@ module.exports = function (grunt) { '<%= project.app %>/dashboard/dashboard.js', '<%= project.app %>/hosts/hosts.js', '<%= project.app %>/services/services.js', - '<%= project.app %>/custom_views/custom_views.js', - ], + '<%= project.app %>/custom_views/custom_views.js' + ] }], options: { mangle: true } }, dev: { - files: [{ - '<%= project.build %>/app.js': '<%= project.app %>/app.js', - '<%= project.build %>/components/config/config.js':'<%= project.app %>/components/config/config.js', - '<%= project.build %>/components/live/live.js': '<%= project.app %>/components/live/live.js', - '<%= project.build %>/components/live/notifications.js': '<%= project.app %>/components/live/notifications.js', - '<%= project.build %>/components/live/get_services.js': '<%= project.app %>/components/live/get_services.js', - '<%= project.build %>/components/ng-justgage/ng-justgage.js': '<%= project.app %>/components/ng-justgage/ng-justgage.js', - '<%= project.build %>/components/filters/filters.js': '<%= project.app %>/components/filters/filters.js', - '<%= project.build %>/components/sidebar/sidebar.js': '<%= project.app %>/components/sidebar/sidebar.js', - '<%= project.build %>/components/topbar/topbar.js': '<%= project.app %>/components/topbar/topbar.js', - '<%= project.build %>/components/tactical/tactical.js': '<%= project.app %>/components/tactical/tactical.js', - '<%= project.build %>/components/tactical/status_overview/status_overview.js': '<%= project.app %>/components/tactical/status_overview/status_overview.js', - '<%= project.build %>/components/tactical/current_health/current_health.js': '<%= project.app %>/components/tactical/current_health/current_health.js', - '<%= project.build %>/components/tactical/top_alert_producers/top_alert_producers.js': '<%= project.app %>/components/tactical/top_alert_producers/top_alert_producers.js', - '<%= project.build %>/components/table/actionbar/actionbar.js': '<%= project.app %>/components/table/actionbar/actionbar.js', - '<%= project.build %>/components/table/table.js': '<%= project.app %>/components/table/table.js', - '<%= project.build %>/components/table/cell_duration/cell_duration.js': '<%= project.app %>/components/table/cell_duration/cell_duration.js', - '<%= project.build %>/components/table/cell_host/cell_host.js': '<%= project.app %>/components/table/cell_host/cell_host.js', - '<%= project.build %>/components/table/cell_last_check/cell_last_check.js': '<%= project.app %>/components/table/cell_last_check/cell_last_check.js', - '<%= project.build %>/components/table/cell_service_check/cell_service_check.js': '<%= project.app %>/components/table/cell_service_check/cell_service_check.js', - '<%= project.build %>/components/table/cell_hosts_host/cell_hosts_host.js': '<%= project.app %>/components/table/cell_hosts_host/cell_hosts_host.js', - '<%= project.build %>/components/table/cell_host_address/cell_host_address.js': '<%= project.app %>/components/table/cell_host_address/cell_host_address.js', - '<%= project.build %>/components/table/cell_host_status/cell_host_status.js': '<%= project.app %>/components/table/cell_host_status/cell_host_status.js', - '<%= project.build %>/dashboard/dashboard.js': '<%= project.app %>/dashboard/dashboard.js', - '<%= project.build %>/hosts/hosts.js': '<%= project.app %>/hosts/hosts.js', - '<%= project.build %>/services/services.js': '<%= project.app %>/services/services.js', - '<%= project.build %>/custom_views/custom_views.js' : '<%= project.app %>/custom_views/custom_views.js' - }, - { - '<%= project.build %>/js/adagios.min.js' : [ - '<%= project.build %>/app.js', - '<%= project.build %>/components/config/config.js', - '<%= project.build %>/components/live/live.js', - '<%= project.build %>/components/live/notifications.js', - '<%= project.build %>/components/live/get_services.js', - '<%= project.build %>/components/ng-justgage/ng-justgage.js', - '<%= project.build %>/components/filters/filters.js', - '<%= project.build %>/components/sidebar/sidebar.js', - '<%= project.build %>/components/topbar/topbar.js', - '<%= project.build %>/components/tactical/tactical.js', - '<%= project.build %>/components/tactical/status_overview/status_overview.js', - '<%= project.build %>/components/tactical/current_health/current_health.js', - '<%= project.build %>/components/tactical/top_alert_producers/top_alert_producers.js', - '<%= project.build %>/components/table/actionbar/actionbar.js', - '<%= project.build %>/components/table/table.js', - '<%= project.build %>/components/table/cell_duration/cell_duration.js', - '<%= project.build %>/components/table/cell_host/cell_host.js', - '<%= project.build %>/components/table/cell_last_check/cell_last_check.js', - '<%= project.build %>/components/table/cell_service_check/cell_service_check.js', - '<%= project.build %>/components/table/cell_hosts_host/cell_hosts_host.js', - '<%= project.build %>/components/table/cell_host_address/cell_host_address.js', - '<%= project.build %>/components/table/cell_host_status/cell_host_status.js', - '<%= project.build %>/dashboard/dashboard.js', - '<%= project.build %>/hosts/hosts.js', - '<%= project.build %>/services/services.js', - '<%= project.build %>/custom_views/custom_views.js' - ] - }], + files: [ + { + '<%= project.build %>/app.js': '<%= project.app %>/app.js', + '<%= project.build %>/components/config/config.js': '<%= project.app %>/components/config/config.js', + '<%= project.build %>/components/live/live.js': '<%= project.app %>/components/live/live.js', + '<%= project.build %>/components/live/notifications.js': '<%= project.app %>/components/live/notifications.js', + '<%= project.build %>/components/live/get_services.js': '<%= project.app %>/components/live/get_services.js', + '<%= project.build %>/components/ng-justgage/ng-justgage.js': '<%= project.app %>/components/ng-justgage/ng-justgage.js', + '<%= project.build %>/components/filters/filters.js': '<%= project.app %>/components/filters/filters.js', + '<%= project.build %>/components/sidebar/sidebar.js': '<%= project.app %>/components/sidebar/sidebar.js', + '<%= project.build %>/components/topbar/topbar.js': '<%= project.app %>/components/topbar/topbar.js', + '<%= project.build %>/components/tactical/tactical.js': '<%= project.app %>/components/tactical/tactical.js', + '<%= project.build %>/components/tactical/status_overview/status_overview.js': '<%= project.app %>/components/tactical/status_overview/status_overview.js', + '<%= project.build %>/components/tactical/current_health/current_health.js': '<%= project.app %>/components/tactical/current_health/current_health.js', + '<%= project.build %>/components/tactical/top_alert_producers/top_alert_producers.js': '<%= project.app %>/components/tactical/top_alert_producers/top_alert_producers.js', + '<%= project.build %>/components/table/actionbar/actionbar.js': '<%= project.app %>/components/table/actionbar/actionbar.js', + '<%= project.build %>/components/table/table.js': '<%= project.app %>/components/table/table.js', + '<%= project.build %>/components/table/cell_duration/cell_duration.js': '<%= project.app %>/components/table/cell_duration/cell_duration.js', + '<%= project.build %>/components/table/cell_host/cell_host.js': '<%= project.app %>/components/table/cell_host/cell_host.js', + '<%= project.build %>/components/table/cell_last_check/cell_last_check.js': '<%= project.app %>/components/table/cell_last_check/cell_last_check.js', + '<%= project.build %>/components/table/cell_service_check/cell_service_check.js': '<%= project.app %>/components/table/cell_service_check/cell_service_check.js', + '<%= project.build %>/components/table/cell_hosts_host/cell_hosts_host.js': '<%= project.app %>/components/table/cell_hosts_host/cell_hosts_host.js', + '<%= project.build %>/components/table/cell_host_address/cell_host_address.js': '<%= project.app %>/components/table/cell_host_address/cell_host_address.js', + '<%= project.build %>/components/table/cell_host_status/cell_host_status.js': '<%= project.app %>/components/table/cell_host_status/cell_host_status.js', + '<%= project.build %>/dashboard/dashboard.js': '<%= project.app %>/dashboard/dashboard.js', + '<%= project.build %>/hosts/hosts.js': '<%= project.app %>/hosts/hosts.js', + '<%= project.build %>/services/services.js': '<%= project.app %>/services/services.js', + '<%= project.build %>/custom_views/custom_views.js' : '<%= project.app %>/custom_views/custom_views.js' + }, + { + '<%= project.build %>/js/adagios.min.js' : [ + '<%= project.build %>/app.js', + '<%= project.build %>/components/config/config.js', + '<%= project.build %>/components/live/live.js', + '<%= project.build %>/components/live/notifications.js', + '<%= project.build %>/components/live/get_services.js', + '<%= project.build %>/components/ng-justgage/ng-justgage.js', + '<%= project.build %>/components/filters/filters.js', + '<%= project.build %>/components/sidebar/sidebar.js', + '<%= project.build %>/components/topbar/topbar.js', + '<%= project.build %>/components/tactical/tactical.js', + '<%= project.build %>/components/tactical/status_overview/status_overview.js', + '<%= project.build %>/components/tactical/current_health/current_health.js', + '<%= project.build %>/components/tactical/top_alert_producers/top_alert_producers.js', + '<%= project.build %>/components/table/actionbar/actionbar.js', + '<%= project.build %>/components/table/table.js', + '<%= project.build %>/components/table/cell_duration/cell_duration.js', + '<%= project.build %>/components/table/cell_host/cell_host.js', + '<%= project.build %>/components/table/cell_last_check/cell_last_check.js', + '<%= project.build %>/components/table/cell_service_check/cell_service_check.js', + '<%= project.build %>/components/table/cell_hosts_host/cell_hosts_host.js', + '<%= project.build %>/components/table/cell_host_address/cell_host_address.js', + '<%= project.build %>/components/table/cell_host_status/cell_host_status.js', + '<%= project.build %>/dashboard/dashboard.js', + '<%= project.build %>/hosts/hosts.js', + '<%= project.build %>/services/services.js', + '<%= project.build %>/custom_views/custom_views.js' + ] + } + ], options: { mangle: false, beautify: true @@ -190,5 +193,5 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-jslint'); - grunt.registerTask('default', [ 'watch', 'jslint', 'uglify']); + grunt.registerTask('default', ['watch', 'jslint', 'uglify']); }; diff --git a/app/components/sidebar/sidebar.js b/app/components/sidebar/sidebar.js index 854dc83..35e9989 100644 --- a/app/components/sidebar/sidebar.js +++ b/app/components/sidebar/sidebar.js @@ -3,13 +3,15 @@ angular.module('adagios.sidebar', []) .controller('SideBarCtrl', ['$scope', '$location', function ($scope, $location) { - $scope.getClass = function(path) { - if ($location.path().substr(0, path.length) == path) { - return "state--current" - } else { - return "" + $scope.getClass = function (path) { + var class_name = ""; + + if ($location.path().substr(0, path.length) === path) { + class_name = "state--current"; } - } + + return class_name; + }; }]) .directive('adgSidebar', function () { diff --git a/app/components/table/actionbar/actionbar.js b/app/components/table/actionbar/actionbar.js index 5d46904..af6022a 100644 --- a/app/components/table/actionbar/actionbar.js +++ b/app/components/table/actionbar/actionbar.js @@ -1,3 +1,5 @@ +'use strict'; + angular.module('adagios.table.actionbar', []) .controller('TableActionbarCtrl', [function () { diff --git a/app/components/table/cell_hosts_host/cell_hosts_host.js b/app/components/table/cell_hosts_host/cell_hosts_host.js index 70d4b34..0be8a79 100644 --- a/app/components/table/cell_hosts_host/cell_hosts_host.js +++ b/app/components/table/cell_hosts_host/cell_hosts_host.js @@ -7,7 +7,7 @@ angular.module('adagios.table.cell_hosts_host', ['adagios.table']) $scope.state = 'state--ok'; } else if ($scope.entry.state === 1) { $scope.state = 'state--warning'; - } else if ($scope.entry.state == "") { + } else if ($scope.entry.state === "") { $scope.state = ''; } else { $scope.state = 'state--error';