diff --git a/glances/outputs/static/js/app.js b/glances/outputs/static/js/app.js index 6ff863fd..12018c50 100644 --- a/glances/outputs/static/js/app.js +++ b/glances/outputs/static/js/app.js @@ -11,5 +11,9 @@ var glancesApp = angular.module('glancesApp', ['glances.config', 'cfp.hotkeys']) .run(function($rootScope, GlancesStats) { $rootScope.title = "Glances"; + $rootScope.$on('data_refreshed', function(event, data) { + $rootScope.title = data.stats.system.hostname + ' - Glances'; + }); + GlancesStats.init(); }); diff --git a/glances/outputs/static/js/services/stats.js b/glances/outputs/static/js/services/stats.js index 77cf1884..54b39810 100644 --- a/glances/outputs/static/js/services/stats.js +++ b/glances/outputs/static/js/services/stats.js @@ -22,9 +22,7 @@ glancesApp.service('GlancesStats', function($http, $q, $rootScope, $timeout, Gla 'isWindows': results[0]['system']['os_name'] === 'Windows' }; - $rootScope.title = _data.stats.system.hostname + ' - Glances'; $rootScope.$broadcast('data_refreshed', _data); - nextLoad(); }, function() { $rootScope.$broadcast('is_disconnected'); diff --git a/glances/outputs/static/public/js/main.min.js b/glances/outputs/static/public/js/main.min.js index 50f6acee..c89a23d5 100644 --- a/glances/outputs/static/public/js/main.min.js +++ b/glances/outputs/static/public/js/main.min.js @@ -11,6 +11,10 @@ var glancesApp = angular.module('glancesApp', ['glances.config', 'cfp.hotkeys']) .run(["$rootScope", "GlancesStats", function($rootScope, GlancesStats) { $rootScope.title = "Glances"; + $rootScope.$on('data_refreshed', function(event, data) { + $rootScope.title = data.stats.system.hostname + ' - Glances'; + }); + GlancesStats.init(); }]); @@ -246,9 +250,7 @@ glancesApp.service('GlancesStats', ["$http", "$q", "$rootScope", "$timeout", "Gl 'isWindows': results[0]['system']['os_name'] === 'Windows' }; - $rootScope.title = _data.stats.system.hostname + ' - Glances'; $rootScope.$broadcast('data_refreshed', _data); - nextLoad(); }, function() { $rootScope.$broadcast('is_disconnected'); @@ -295,24 +297,6 @@ glancesApp.service('GlancesStats', ["$http", "$q", "$rootScope", "$timeout", "Gl 'use strict'; -glancesApp.component('glancesHelp', { - controller: GlancesHelpController, - controllerAs: 'vm', - templateUrl: 'components/help/view.html' -}); - -'use strict'; - -function GlancesHelpController($http) { - var vm = this; - - $http.get('api/2/help').then(function (response) { - vm.help = response.data; - }); -} - -'use strict'; - glancesApp.component('glances', { controller: GlancesController, controllerAs: 'vm', @@ -538,55 +522,20 @@ function GlancesController($scope, GlancesStats, hotkeys, ARGUMENTS) { 'use strict'; -glancesApp.component('glancesPluginAmps', { - controller: GlancesPluginAmpsController, +glancesApp.component('glancesHelp', { + controller: GlancesHelpController, controllerAs: 'vm', - templateUrl: 'components/plugin-amps/view.html' + templateUrl: 'components/help/view.html' }); 'use strict'; -function GlancesPluginAmpsController($scope, GlancesStats, favicoService) { +function GlancesHelpController($http) { var vm = this; - vm.processes = []; - vm.$onInit = function() { - loadData(GlancesStats.getData()); - }; - - $scope.$on('data_refreshed', function(event, data) { - loadData(data); + $http.get('api/2/help').then(function (response) { + vm.help = response.data; }); - - var loadData = function(data) { - var processes = data.stats['amps']; - - this.processes = []; - angular.forEach(processes, function(process) { - if (process.result !== null) { - this.processes.push(process); - } - }, this); - } - - vm.getDescriptionDecoration = function(process) { - var count = process.count; - var countMin = process.countmin; - var countMax = process.countmax; - var decoration = "ok"; - - if (count > 0) { - if ((countMin == null || count >= countMin) && (countMax == null || count <= countMax)) { - decoration = 'ok'; - } else { - decoration = 'careful'; - } - } else { - decoration = countMin == null ? 'ok' : 'critical'; - } - - return decoration; - } } 'use strict'; @@ -665,6 +614,59 @@ function GlancesPluginAlertController($scope, favicoService) { 'use strict'; +glancesApp.component('glancesPluginAmps', { + controller: GlancesPluginAmpsController, + controllerAs: 'vm', + templateUrl: 'components/plugin-amps/view.html' +}); + +'use strict'; + +function GlancesPluginAmpsController($scope, GlancesStats, favicoService) { + var vm = this; + vm.processes = []; + + vm.$onInit = function() { + loadData(GlancesStats.getData()); + }; + + $scope.$on('data_refreshed', function(event, data) { + loadData(data); + }); + + var loadData = function(data) { + var processes = data.stats['amps']; + + this.processes = []; + angular.forEach(processes, function(process) { + if (process.result !== null) { + this.processes.push(process); + } + }, this); + } + + vm.getDescriptionDecoration = function(process) { + var count = process.count; + var countMin = process.countmin; + var countMax = process.countmax; + var decoration = "ok"; + + if (count > 0) { + if ((countMin == null || count >= countMin) && (countMax == null || count <= countMax)) { + decoration = 'ok'; + } else { + decoration = 'careful'; + } + } else { + decoration = countMin == null ? 'ok' : 'critical'; + } + + return decoration; + } +} + +'use strict'; + glancesApp.component('glancesPluginCloud', { controller: GlancesPluginCloudController, controllerAs: 'vm', diff --git a/glances/outputs/static/public/js/templates.min.js b/glances/outputs/static/public/js/templates.min.js index 48d30358..fe90646c 100644 --- a/glances/outputs/static/public/js/templates.min.js +++ b/glances/outputs/static/public/js/templates.min.js @@ -1,7 +1,7 @@ -angular.module('glancesApp').run(['$templateCache', function($templateCache) {$templateCache.put('components/help/view.html','