diff --git a/glances/outputs/static/gulpfile.js b/glances/outputs/static/gulpfile.js
index 615a9c8c..8be5788d 100644
--- a/glances/outputs/static/gulpfile.js
+++ b/glances/outputs/static/gulpfile.js
@@ -41,8 +41,8 @@ gulp.task('build-js', function() {
});
gulp.task('template', function () {
- return gulp.src('./html/plugins/*.html')
- .pipe(templateCache('templates.js', {'root': 'plugins/', 'module': 'glancesApp'}))
+ return gulp.src('./js/components/**/*.html')
+ .pipe(templateCache('templates.js', {'root': 'components/', 'module': 'glancesApp'}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./public/js'));
});
diff --git a/glances/outputs/static/html/plugins/alert.html b/glances/outputs/static/html/plugins/alert.html
deleted file mode 100644
index f4fe2f2f..00000000
--- a/glances/outputs/static/html/plugins/alert.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
+
diff --git a/glances/outputs/static/js/components/plugin-ip/component.js b/glances/outputs/static/js/components/plugin-ip/component.js
new file mode 100644
index 00000000..7cc0684f
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-ip/component.js
@@ -0,0 +1,10 @@
+'use strict';
+
+glancesApp.component('glancesPluginIp', {
+ controller: GlancesPluginIpController,
+ controllerAs: 'vm',
+ bindings: {
+ stats: '<',
+ },
+ templateUrl: 'components/plugin-ip/view.html'
+});
diff --git a/glances/outputs/static/js/components/plugin-ip/controller.js b/glances/outputs/static/js/components/plugin-ip/controller.js
new file mode 100644
index 00000000..d5cbf976
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-ip/controller.js
@@ -0,0 +1,26 @@
+'use strict';
+
+function GlancesPluginIpController() {
+ var vm = this;
+
+ this.address = null;
+ this.gateway = null;
+ this.mask = null;
+ this.maskCidr = null;
+ this.publicAddress = null;
+
+ vm.$onChanges = function (changes) {
+ var stats = changes.stats.currentValue;
+ if (stats === undefined || stats.stats === undefined) {
+ return;
+ }
+
+ var data = stats.stats['ip'];
+
+ vm.address = data.address;
+ vm.gateway = data.gateway;
+ vm.mask = data.mask;
+ vm.maskCidr = data.mask_cidr;
+ vm.publicAddress = data.public_address
+ };
+}
diff --git a/glances/outputs/static/js/components/plugin-ip/view.html b/glances/outputs/static/js/components/plugin-ip/view.html
new file mode 100644
index 00000000..f4a72c0a
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-ip/view.html
@@ -0,0 +1,3 @@
+
+ - IP {{ vm.address }}/{{ vm.maskCidr }} Pub {{ vm.publicAddress }}
+
diff --git a/glances/outputs/static/js/components/plugin-system/component.js b/glances/outputs/static/js/components/plugin-system/component.js
new file mode 100644
index 00000000..1826ce8b
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-system/component.js
@@ -0,0 +1,11 @@
+'use strict';
+
+glancesApp.component('glancesPluginSystem', {
+ controller: GlancesPluginSystemController,
+ controllerAs: 'vm',
+ bindings: {
+ stats: '<',
+ isDisconnected: '<'
+ },
+ templateUrl: 'components/plugin-system/view.html'
+});
diff --git a/glances/outputs/static/js/components/plugin-system/controller.js b/glances/outputs/static/js/components/plugin-system/controller.js
new file mode 100644
index 00000000..2567a02a
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-system/controller.js
@@ -0,0 +1,45 @@
+'use strict';
+
+function GlancesPluginSystemController() {
+ var vm = this;
+ var _pluginName = "system";
+
+ vm.hostname = null;
+ vm.platform = null;
+ vm.humanReadableName = null;
+ vm.os = {
+ 'name': null,
+ 'version': null
+ };
+
+ vm.$onChanges = function (changes) {
+ var stats = changes.stats.currentValue;
+ if (stats === undefined || stats.stats === undefined) {
+ return;
+ }
+
+ var data = stats.stats[_pluginName];
+
+ vm.hostname = data['hostname'];
+ vm.platform = data['platform'];
+ vm.os.name = data['os_name'];
+ vm.os.version = data['os_version'];
+ vm.humanReadableName = data['hr_name'];
+ };
+
+ vm.isBsd = function() {
+ return this.os.name === 'FreeBSD';
+ };
+
+ vm.isLinux = function() {
+ return this.os.name === 'Linux';
+ };
+
+ vm.isMac = function() {
+ return this.os.name === 'Darwin';
+ };
+
+ vm.isWindows = function() {
+ return this.os.name === 'Windows';
+ };
+}
diff --git a/glances/outputs/static/js/components/plugin-system/view.html b/glances/outputs/static/js/components/plugin-system/view.html
new file mode 100644
index 00000000..f1866ae6
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-system/view.html
@@ -0,0 +1,6 @@
+
+ Disconnected from
+ {{ vm.hostname }}
+ ({{ vm.humanReadableName }} / {{ vm.os.name }} {{ vm.os.version }})
+ ({{ vm.os.name }} {{ vm.os.version }} {{ vm.platform }})
+
diff --git a/glances/outputs/static/js/components/plugin-uptime/component.js b/glances/outputs/static/js/components/plugin-uptime/component.js
new file mode 100644
index 00000000..3859054b
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-uptime/component.js
@@ -0,0 +1,10 @@
+'use strict';
+
+glancesApp.component('glancesPluginUptime', {
+ controller: GlancesPluginUptimeController,
+ controllerAs: 'vm',
+ bindings: {
+ stats: '<',
+ },
+ templateUrl: 'components/plugin-uptime/view.html'
+});
diff --git a/glances/outputs/static/js/components/plugin-uptime/controller.js b/glances/outputs/static/js/components/plugin-uptime/controller.js
new file mode 100644
index 00000000..9cdc0850
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-uptime/controller.js
@@ -0,0 +1,16 @@
+'use strict';
+
+function GlancesPluginUptimeController() {
+ var vm = this;
+
+ this.value = null
+
+ vm.$onChanges = function (changes) {
+ var stats = changes.stats.currentValue;
+ if (stats === undefined || stats.stats === undefined) {
+ return;
+ }
+
+ vm.value = stats.stats['uptime'];
+ };
+}
diff --git a/glances/outputs/static/js/components/plugin-uptime/view.html b/glances/outputs/static/js/components/plugin-uptime/view.html
new file mode 100644
index 00000000..3f602d2b
--- /dev/null
+++ b/glances/outputs/static/js/components/plugin-uptime/view.html
@@ -0,0 +1,3 @@
+
+ Uptime: {{ vm.value }}
+
diff --git a/glances/outputs/static/js/controllers.js b/glances/outputs/static/js/controllers.js
index a369c3ba..b1ea157c 100644
--- a/glances/outputs/static/js/controllers.js
+++ b/glances/outputs/static/js/controllers.js
@@ -1,214 +1,5 @@
-glancesApp.controller('statsController', function ($scope, $rootScope, $interval, GlancesStats, help, config, arguments, favicoService) {
+glancesApp.controller('statsController', function ($scope, help, config, arguments) {
$scope.help = help;
+ $scope.config = config;
$scope.arguments = arguments;
-
- $scope.sorter = {
- column: "cpu_percent",
- auto: true,
- isReverseColumn: function (column) {
- return !(column == 'username' || column == 'name');
- },
- getColumnLabel: function (column) {
- if (_.isEqual(column, ['io_read', 'io_write'])) {
- return 'io_counters';
- } else {
- return column;
- }
- }
- };
-
- $scope.dataLoaded = false;
- $scope.refreshData = function () {
- GlancesStats.getData().then(function (data) {
-
- $scope.statsAlert = GlancesStats.getPlugin('alert');
- $scope.statsCloud = GlancesStats.getPlugin('cloud');
- $scope.statsCpu = GlancesStats.getPlugin('cpu');
- $scope.statsDiskio = GlancesStats.getPlugin('diskio');
- $scope.statsIrq = GlancesStats.getPlugin('irq');
- $scope.statsDocker = GlancesStats.getPlugin('docker');
- $scope.statsFs = GlancesStats.getPlugin('fs');
- $scope.statsFolders = GlancesStats.getPlugin('folders');
- $scope.statsGpu = GlancesStats.getPlugin('gpu');
- $scope.statsIp = GlancesStats.getPlugin('ip');
- $scope.statsLoad = GlancesStats.getPlugin('load');
- $scope.statsMem = GlancesStats.getPlugin('mem');
- $scope.statsMemSwap = GlancesStats.getPlugin('memswap');
- $scope.statsAmps = GlancesStats.getPlugin('amps');
- $scope.statsNetwork = GlancesStats.getPlugin('network');
- $scope.statsPerCpu = GlancesStats.getPlugin('percpu');
- $scope.statsProcessCount = GlancesStats.getPlugin('processcount');
- $scope.statsProcessList = GlancesStats.getPlugin('processlist');
- $scope.statsQuicklook = GlancesStats.getPlugin('quicklook');
- $scope.statsRaid = GlancesStats.getPlugin('raid');
- $scope.statsSensors = GlancesStats.getPlugin('sensors');
- $scope.statsSystem = GlancesStats.getPlugin('system');
- $scope.statsUptime = GlancesStats.getPlugin('uptime');
- $scope.statsPorts = GlancesStats.getPlugin('ports');
- $scope.statsWifi = GlancesStats.getPlugin('wifi');
-
- $rootScope.title = $scope.statsSystem.hostname + ' - Glances';
-
- if ($scope.statsAlert.hasOngoingAlerts()) {
- favicoService.badge($scope.statsAlert.countOngoingAlerts());
- } else {
- favicoService.reset();
- }
-
- $scope.is_disconnected = false;
- $scope.dataLoaded = true;
- }, function() {
- $scope.is_disconnected = true;
- });
- };
-
- $scope.refreshData();
- $interval(function () {
- $scope.refreshData();
- }, arguments.time * 1000); // in milliseconds
-
- $scope.onKeyDown = function ($event) {
-
- switch (true) {
- case !$event.shiftKey && $event.keyCode == keycodes.a:
- // a => Sort processes automatically
- $scope.sorter.column = "cpu_percent";
- $scope.sorter.auto = true;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.A:
- // A => Enable/disable AMPs
- $scope.arguments.disable_amps = !$scope.arguments.disable_amps;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.c:
- // c => Sort processes by CPU%
- $scope.sorter.column = "cpu_percent";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.m:
- // m => Sort processes by MEM%
- $scope.sorter.column = "memory_percent";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.u:
- // u => Sort processes by user
- $scope.sorter.column = "username";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.p:
- // p => Sort processes by name
- $scope.sorter.column = "name";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.i:
- // i => Sort processes by I/O rate
- $scope.sorter.column = ['io_read', 'io_write'];
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.t:
- // t => Sort processes by time
- $scope.sorter.column = "timemillis";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.d:
- // d => Show/hide disk I/O stats
- $scope.arguments.disable_diskio = !$scope.arguments.disable_diskio;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.Q:
- // Q => Show/hide IRQ
- $scope.arguments.enable_irq = !$scope.arguments.enable_irq;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.f:
- // f => Show/hide filesystem stats
- $scope.arguments.disable_fs = !$scope.arguments.disable_fs;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.n:
- // n => Show/hide network stats
- $scope.arguments.disable_network = !$scope.arguments.disable_network;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.s:
- // s => Show/hide sensors stats
- $scope.arguments.disable_sensors = !$scope.arguments.disable_sensors;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.TWO:
- // 2 => Show/hide left sidebar
- $scope.arguments.disable_left_sidebar = !$scope.arguments.disable_left_sidebar;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.z:
- // z => Enable/disable processes stats
- $scope.arguments.disable_process = !$scope.arguments.disable_process;
- break;
- case $event.keyCode == keycodes.SLASH:
- // SLASH => Enable/disable short processes name
- $scope.arguments.process_short_name = !$scope.arguments.process_short_name;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.D:
- // D => Enable/disable Docker stats
- $scope.arguments.disable_docker = !$scope.arguments.disable_docker;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.b:
- // b => Bytes or bits for network I/O
- $scope.arguments.byte = !$scope.arguments.byte;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.b:
- // 'B' => Switch between bit/s and IO/s for Disk IO
- $scope.arguments.diskio_iops = !$scope.arguments.diskio_iops;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.l:
- // l => Show/hide alert logs
- $scope.arguments.disable_alert = !$scope.arguments.disable_alert;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.ONE:
- // 1 => Global CPU or per-CPU stats
- $scope.arguments.percpu = !$scope.arguments.percpu;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.h:
- // h => Show/hide this help screen
- $scope.arguments.help_tag = !$scope.arguments.help_tag;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.T:
- // T => View network I/O as combination
- $scope.arguments.network_sum = !$scope.arguments.network_sum;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.u:
- // U => View cumulative network I/O
- $scope.arguments.network_cumul = !$scope.arguments.network_cumul;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.f:
- // F => Show filesystem free space
- $scope.arguments.fs_free_space = !$scope.arguments.fs_free_space;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.THREE:
- // 3 => Enable/disable quick look plugin
- $scope.arguments.disable_quicklook = !$scope.arguments.disable_quicklook;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.SIX:
- // 6 => Enable/disable mean gpu
- $scope.arguments.meangpu = !$scope.arguments.meangpu;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.g:
- // G => Enable/disable gpu
- $scope.arguments.disable_gpu = !$scope.arguments.disable_gpu;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.FIVE:
- $scope.arguments.disable_quicklook = !$scope.arguments.disable_quicklook;
- $scope.arguments.disable_cpu = !$scope.arguments.disable_cpu;
- $scope.arguments.disable_mem = !$scope.arguments.disable_mem;
- $scope.arguments.disable_memswap = !$scope.arguments.disable_memswap;
- $scope.arguments.disable_load = !$scope.arguments.disable_load;
- $scope.arguments.disable_gpu = !$scope.arguments.disable_gpu;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.i:
- // I => Show/hide IP module
- $scope.arguments.disable_ip = !$scope.arguments.disable_ip;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.p:
- // I => Enable/disable ports module
- $scope.arguments.disable_ports = !$scope.arguments.disable_ports;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.w:
- // 'W' > Enable/Disable Wifi plugin
- $scope.arguments.disable_wifi = !$scope.arguments.disable_wifi;
- break;
- }
- };
});
diff --git a/glances/outputs/static/js/services/core/favicon.js b/glances/outputs/static/js/favicon.js
similarity index 100%
rename from glances/outputs/static/js/services/core/favicon.js
rename to glances/outputs/static/js/favicon.js
diff --git a/glances/outputs/static/js/services/core/stats.js b/glances/outputs/static/js/services/core/stats.js
deleted file mode 100644
index 1b63525b..00000000
--- a/glances/outputs/static/js/services/core/stats.js
+++ /dev/null
@@ -1,106 +0,0 @@
-glancesApp.service('GlancesStats', function($http, $injector, $q, GlancesPlugin) {
- var _stats = [], _views = [], _limits = [], _config = {};
-
- var _plugins = {
- 'alert': 'GlancesPluginAlert',
- 'cloud': 'GlancesPluginCloud',
- 'cpu': 'GlancesPluginCpu',
- 'diskio': 'GlancesPluginDiskio',
- 'irq' : 'GlancesPluginIrq',
- 'docker': 'GlancesPluginDocker',
- 'ip': 'GlancesPluginIp',
- 'fs': 'GlancesPluginFs',
- 'folders': 'GlancesPluginFolders',
- 'gpu': 'GlancesPluginGpu',
- 'load': 'GlancesPluginLoad',
- 'mem': 'GlancesPluginMem',
- 'memswap': 'GlancesPluginMemSwap',
- 'amps': 'GlancesPluginAmps',
- 'network': 'GlancesPluginNetwork',
- 'percpu': 'GlancesPluginPerCpu',
- 'processcount': 'GlancesPluginProcessCount',
- 'processlist': 'GlancesPluginProcessList',
- 'quicklook': 'GlancesPluginQuicklook',
- 'raid': 'GlancesPluginRaid',
- 'sensors': 'GlancesPluginSensors',
- 'system': 'GlancesPluginSystem',
- 'uptime': 'GlancesPluginUptime',
- 'ports': 'GlancesPluginPorts',
- 'wifi': 'GlancesPluginWifi'
- };
-
- this.getData = function() {
- return $q.all([
- this.getAllStats(),
- this.getAllViews()
- ]).then(function(results) {
- return {
- 'stats': results[0],
- 'view': results[1]
- };
- });
- };
-
- this.getAllStats = function() {
- return $http.get('/api/2/all').then(function (response) {
- _stats = response.data;
-
- return response.data;
- });
- };
-
- this.getAllLimits = function() {
- return $http.get('/api/2/all/limits').then(function (response) {
- _limits = response.data;
-
- return response.data;
- });
- };
-
- this.getAllViews = function() {
- return $http.get('/api/2/all/views').then(function (response) {
- _views = response.data;
-
- return response.data;
- });
- };
-
- this.getHelp = function() {
- return $http.get('/api/2/help').then(function (response) {
- return response.data;
- });
- };
-
- this.getConfig = function() {
- return $http.get('/api/2/config').then(function (response) {
- _config = response.data;
-
- return _config;
- });
- };
-
- this.getArguments = function() {
- return $http.get('/api/2/args').then(function (response) {
- return response.data;
- });
- };
-
- this.getPlugin = function(name) {
- var plugin = _plugins[name];
-
- if (plugin === undefined) {
- throw "Plugin '" + name + "' not found";
- }
-
- plugin = $injector.get(plugin);
- plugin.setData(_stats, _views, _config);
-
- return plugin;
- };
-
- // load limits to init GlancePlugin helper
- this.getAllLimits().then(function(limits) {
- GlancesPlugin.setLimits(limits);
- });
-
-});
diff --git a/glances/outputs/static/js/services/plugins/alert.js b/glances/outputs/static/js/services/plugins/alert.js
deleted file mode 100644
index 9df6db89..00000000
--- a/glances/outputs/static/js/services/plugins/alert.js
+++ /dev/null
@@ -1,58 +0,0 @@
-glancesApp.service('GlancesPluginAlert', function () {
- var _pluginName = "alert";
- var _alerts = [];
-
- this.setData = function (data, views) {
- data = data[_pluginName];
- _alerts = [];
-
- if(!_.isArray(data)) {
- data = [];
- }
-
- for (var i = 0; i < data.length; i++) {
- var alertData = data[i];
- var alert = {};
-
- alert.name = alertData[3];
- alert.level = alertData[2];
- alert.begin = alertData[0] * 1000;
- alert.end = alertData[1] * 1000;
- alert.ongoing = alertData[1] == -1;
- alert.min = alertData[6];
- alert.mean = alertData[5];
- alert.max = alertData[4];
-
- if (!alert.ongoing) {
- var duration = alert.end - alert.begin;
- var seconds = parseInt((duration / 1000) % 60)
- , minutes = parseInt((duration / (1000 * 60)) % 60)
- , hours = parseInt((duration / (1000 * 60 * 60)) % 24);
-
- alert.duration = _.padStart(hours, 2, '0') + ":" + _.padStart(minutes, 2, '0') + ":" + _.padStart(seconds, 2, '0');
- }
-
- _alerts.push(alert);
- }
- };
-
- this.hasAlerts = function () {
- return _alerts.length > 0;
- };
-
- this.getAlerts = function () {
- return _alerts;
- };
-
- this.count = function () {
- return _alerts.length;
- };
-
- this.hasOngoingAlerts = function () {
- return _.filter(_alerts, { 'ongoing': true }).length > 0;
- };
-
- this.countOngoingAlerts = function () {
- return _.filter(_alerts, { 'ongoing': true }).length;
- }
-});
diff --git a/glances/outputs/static/js/services/plugins/amps.js b/glances/outputs/static/js/services/plugins/amps.js
deleted file mode 100644
index 3d37814e..00000000
--- a/glances/outputs/static/js/services/plugins/amps.js
+++ /dev/null
@@ -1,34 +0,0 @@
-glancesApp.service('GlancesPluginAmps', function() {
- var _pluginName = "amps";
- this.processes = [];
-
- this.setData = function(data, views) {
- var processes = data[_pluginName];
-
- this.processes = [];
- angular.forEach(processes, function(process) {
- if (process.result !== null) {
- this.processes.push(process);
- }
- }, this);
- };
-
- this.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;
- }
-});
diff --git a/glances/outputs/static/js/services/plugins/cloud.js b/glances/outputs/static/js/services/plugins/cloud.js
deleted file mode 100644
index ae6957c3..00000000
--- a/glances/outputs/static/js/services/plugins/cloud.js
+++ /dev/null
@@ -1,22 +0,0 @@
-glancesApp.service('GlancesPluginCloud', function() {
- var _pluginName = "cloud";
- var _provider = null;
- var _instance = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- if (data['ami-id'] !== undefined) {
- _provider = 'AWS EC2';
- _instance = data['instance-type'] + ' instance ' + data['instance-id'] + ' (' + data['region'] + ')';
- }
- }
-
- this.getProvider = function() {
- return _provider;
- }
-
- this.getInstance = function() {
- return _instance;
- }
-});
diff --git a/glances/outputs/static/js/services/plugins/cpu.js b/glances/outputs/static/js/services/plugins/cpu.js
deleted file mode 100644
index 5353a311..00000000
--- a/glances/outputs/static/js/services/plugins/cpu.js
+++ /dev/null
@@ -1,55 +0,0 @@
-glancesApp.service('GlancesPluginCpu', function() {
- var _pluginName = "cpu";
- var _view = {};
-
- this.total = null;
- this.user = null;
- this.system = null;
- this.idle = null;
- this.nice = null;
- this.irq = null;
- this.iowait = null;
- this.steal = null;
- this.ctx_switches = null;
- this.interrupts = null;
- this.soft_interrupts = null;
- this.syscalls = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- this.total = data.total;
- this.user = data.user;
- this.system = data.system;
- this.idle = data.idle;
- this.nice = data.nice;
- this.irq = data.irq;
- this.iowait = data.iowait;
- this.steal = data.steal;
-
- if (data.ctx_switches) {
- this.ctx_switches = Math.floor(data.ctx_switches / data.time_since_update);
- }
-
- if (data.interrupts) {
- this.interrupts = Math.floor(data.interrupts / data.time_since_update);
- }
-
- if (data.soft_interrupts) {
- this.soft_interrupts = Math.floor(data.soft_interrupts / data.time_since_update);
- }
-
- if (data.syscalls) {
- this.syscalls = Math.floor(data.syscalls / data.time_since_update);
- }
- }
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- }
-});
diff --git a/glances/outputs/static/js/services/plugins/diskio.js b/glances/outputs/static/js/services/plugins/diskio.js
deleted file mode 100644
index 5e0aacf2..00000000
--- a/glances/outputs/static/js/services/plugins/diskio.js
+++ /dev/null
@@ -1,30 +0,0 @@
-glancesApp.service('GlancesPluginDiskio', function($filter) {
- var _pluginName = "diskio";
- this.disks = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- data = $filter('orderBy')(data,'disk_name');
- this.disks = [];
-
- for (var i = 0; i < data.length; i++) {
- var diskioData = data[i];
- var timeSinceUpdate = diskioData['time_since_update'];
-
- var diskio = {
- 'name': diskioData['disk_name'],
- 'bitrate': {
- 'txps': $filter('bytes')(diskioData['read_bytes'] / timeSinceUpdate),
- 'rxps': $filter('bytes')(diskioData['write_bytes'] / timeSinceUpdate)
- },
- 'count': {
- 'txps': $filter('bytes')(diskioData['read_count'] / timeSinceUpdate),
- 'rxps': $filter('bytes')(diskioData['write_count'] / timeSinceUpdate)
- },
- 'alias': diskioData['alias'] !== undefined ? diskioData['alias'] : null
- };
-
- this.disks.push(diskio);
- }
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/docker.js b/glances/outputs/static/js/services/plugins/docker.js
deleted file mode 100644
index 06895e68..00000000
--- a/glances/outputs/static/js/services/plugins/docker.js
+++ /dev/null
@@ -1,39 +0,0 @@
-glancesApp.service('GlancesPluginDocker', function(GlancesPlugin) {
-
- var _pluginName = "docker";
- this.containers = [];
- this.version = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.containers = [];
-
- if(_.isEmpty(data)) {
- return;
- }
-
- for (var i = 0; i < data['containers'].length; i++) {
- var containerData = data['containers'][i];
-
- var container = {
- 'id': containerData.Id,
- 'name': containerData.Names[0].split('/').splice(-1)[0],
- 'status': containerData.Status,
- 'cpu': containerData.cpu.total,
- 'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?',
- 'ior': containerData.io.ior != undefined ? containerData.io.ior : '?',
- 'iow': containerData.io.iow != undefined ? containerData.io.iow : '?',
- 'io_time_since_update': containerData.io.time_since_update,
- 'rx': containerData.network.rx != undefined ? containerData.network.rx : '?',
- 'tx': containerData.network.tx != undefined ? containerData.network.tx : '?',
- 'net_time_since_update': containerData.network.time_since_update,
- 'command': containerData.Command,
- 'image': containerData.Image
- };
-
- this.containers.push(container);
- }
-
- this.version = data['version']['Version'];
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/folders.js b/glances/outputs/static/js/services/plugins/folders.js
deleted file mode 100644
index 6b3660c5..00000000
--- a/glances/outputs/static/js/services/plugins/folders.js
+++ /dev/null
@@ -1,40 +0,0 @@
-glancesApp.service('GlancesPluginFolders', function() {
- var _pluginName = "folders";
- this.folders = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.folders = [];
-
- for (var i = 0; i < data.length; i++) {
- var folderData = data[i];
-
- var folder = {
- 'path': folderData['path'],
- 'size': folderData['size'],
- 'careful': folderData['careful'],
- 'warning': folderData['warning'],
- 'critical': folderData['critical']
- };
-
- this.folders.push(folder);
- }
- };
-
- this.getDecoration = function(folder) {
-
- if (!Number.isInteger(folder.size)) {
- return;
- }
-
- if (folder.critical !== null && folder.size > (folder.critical * 1000000)) {
- return 'critical';
- } else if (folder.warning !== null && folder.size > (folder.warning * 1000000)) {
- return 'warning';
- } else if (folder.careful !== null && folder.size > (folder.careful * 1000000)) {
- return 'careful';
- }
-
- return 'ok';
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/fs.js b/glances/outputs/static/js/services/plugins/fs.js
deleted file mode 100644
index 07f9b9e2..00000000
--- a/glances/outputs/static/js/services/plugins/fs.js
+++ /dev/null
@@ -1,40 +0,0 @@
-glancesApp.service('GlancesPluginFs', function() {
- var _pluginName = "fs";
- var _view = {};
- this.fileSystems = [];
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
- this.fileSystems = [];
-
- for (var i = 0; i < data.length; i++) {
- var fsData = data[i];
-
- var shortMountPoint = fsData['mnt_point'];
- if (shortMountPoint.length > 9) {
- shortMountPoint = '_' + fsData['mnt_point'].slice(-8);
- }
-
- var fs = {
- 'name': fsData['device_name'],
- 'mountPoint': fsData['mnt_point'],
- 'shortMountPoint': shortMountPoint,
- 'percent': fsData['percent'],
- 'size': fsData['size'],
- 'used': fsData['used'],
- 'free': fsData['free']
- };
-
- this.fileSystems.push(fs);
- }
- };
-
- this.getDecoration = function(mountPoint, field) {
- if(_view[mountPoint][field] == undefined) {
- return;
- }
-
- return _view[mountPoint][field].decoration.toLowerCase();
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/gpu.js b/glances/outputs/static/js/services/plugins/gpu.js
deleted file mode 100644
index f84fc953..00000000
--- a/glances/outputs/static/js/services/plugins/gpu.js
+++ /dev/null
@@ -1,56 +0,0 @@
-glancesApp.service('GlancesPluginGpu', function() {
- var _pluginName = "gpu";
- var _view = {};
- this.gpus = [];
- this.name = "GPU";
- this.mean = {};
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- if (data.length === 0) {
- return;
- }
-
- this.gpus = [];
- this.name = "GPU";
- this.mean = {
- proc: null,
- mem: null
- };
- var sameName = true;
-
- for (var i = 0; i < data.length; i++) {
- var gpuData = data[i];
-
- var gpu = gpuData;
-
- this.mean.proc += gpu.proc;
- this.mean.mem += gpu.mem;
-
- this.gpus.push(gpu);
- }
-
- if (data.length === 1 ) {
- this.name = data[0].name;
- } else if (sameName) {
- this.name = data.length + ' GPU ' + data[0].name;
- }
-
- this.mean.proc = this.mean.proc / data.length;
- this.mean.mem = this.mean.mem / data.length;
- };
-
- this.getDecoration = function(gpuId, value) {
- if(_view[gpuId][value] == undefined) {
- return;
- }
-
- return _view[gpuId][value].decoration.toLowerCase();
- };
-
- this.getMeanDecoration = function(value) {
- return this.getDecoration(0, value);
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/ip.js b/glances/outputs/static/js/services/plugins/ip.js
deleted file mode 100644
index a13add6c..00000000
--- a/glances/outputs/static/js/services/plugins/ip.js
+++ /dev/null
@@ -1,19 +0,0 @@
-glancesApp.service('GlancesPluginIp', function() {
- var _pluginName = "ip";
-
- this.address = null;
- this.gateway = null;
- this.mask = null;
- this.maskCidr = null;
- this.publicAddress = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- this.address = data.address;
- this.gateway = data.gateway;
- this.mask = data.mask;
- this.maskCidr = data.mask_cidr;
- this.publicAddress = data.public_address
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/irq.js b/glances/outputs/static/js/services/plugins/irq.js
deleted file mode 100644
index 8e71c8ed..00000000
--- a/glances/outputs/static/js/services/plugins/irq.js
+++ /dev/null
@@ -1,21 +0,0 @@
-glancesApp.service('GlancesPluginIrq', function() {
- var _pluginName = "irq";
- this.irqs = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.irqs = [];
-
- for (var i = 0; i < data.length; i++) {
- var IrqData = data[i];
- var timeSinceUpdate = IrqData['time_since_update'];
-
- var irq = {
- 'irq_line': IrqData['irq_line'],
- 'irq_rate': IrqData['irq_rate']
- };
-
- this.irqs.push(irq);
- }
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/load.js b/glances/outputs/static/js/services/plugins/load.js
deleted file mode 100644
index 7a9993f1..00000000
--- a/glances/outputs/static/js/services/plugins/load.js
+++ /dev/null
@@ -1,27 +0,0 @@
-glancesApp.service('GlancesPluginLoad', function() {
- var _pluginName = "load";
- var _view = {};
-
- this.cpucore = null;
- this.min1 = null;
- this.min5 = null;
- this.min15 = null;
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
-
- this.cpucore = data['cpucore'];
- this.min1 = data['min1'];
- this.min5 = data['min5'];
- this.min15 = data['min15'];
- };
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/mem.js b/glances/outputs/static/js/services/plugins/mem.js
deleted file mode 100644
index 93b0d599..00000000
--- a/glances/outputs/static/js/services/plugins/mem.js
+++ /dev/null
@@ -1,36 +0,0 @@
-glancesApp.service('GlancesPluginMem', function() {
- var _pluginName = "mem";
- var _view = {};
-
- this.percent = null;
- this.total = null;
- this.used = null;
- this.free = null;
- this.version = null;
- this.active = null;
- this.inactive = null;
- this.buffers = null;
- this.cached = null;
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
-
- this.percent = data['percent'];
- this.total = data['total'];
- this.used = data['used'];
- this.free = data['free'];
- this.active = data['active'];
- this.inactive = data['inactive'];
- this.buffers = data['buffers'];
- this.cached = data['cached'];
- };
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/memswap.js b/glances/outputs/static/js/services/plugins/memswap.js
deleted file mode 100644
index 7ac1684b..00000000
--- a/glances/outputs/static/js/services/plugins/memswap.js
+++ /dev/null
@@ -1,27 +0,0 @@
-glancesApp.service('GlancesPluginMemSwap', function() {
- var _pluginName = "memswap";
- var _view = {};
-
- this.percent = null;
- this.total = null;
- this.used = null;
- this.free = null;
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
-
- this.percent = data['percent'];
- this.total = data['total'];
- this.used = data['used'];
- this.free = data['free'];
- };
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/network.js b/glances/outputs/static/js/services/plugins/network.js
deleted file mode 100644
index d52d3c01..00000000
--- a/glances/outputs/static/js/services/plugins/network.js
+++ /dev/null
@@ -1,25 +0,0 @@
-glancesApp.service('GlancesPluginNetwork', function() {
- var _pluginName = "network";
- this.networks = [];
-
- this.setData = function(data, views) {
- this.networks = [];
-
- for (var i = 0; i < data[_pluginName].length; i++) {
- var networkData = data[_pluginName][i];
-
- var network = {
- 'interfaceName': networkData['interface_name'],
- 'rx': networkData['rx'],
- 'tx': networkData['tx'],
- 'cx': networkData['cx'],
- 'time_since_update': networkData['time_since_update'],
- 'cumulativeRx': networkData['cumulative_rx'],
- 'cumulativeTx': networkData['cumulative_tx'],
- 'cumulativeCx': networkData['cumulative_cx']
- };
-
- this.networks.push(network);
- }
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/percpu.js b/glances/outputs/static/js/services/plugins/percpu.js
deleted file mode 100644
index 83b28f6a..00000000
--- a/glances/outputs/static/js/services/plugins/percpu.js
+++ /dev/null
@@ -1,30 +0,0 @@
-glancesApp.service('GlancesPluginPerCpu', function($filter, GlancesPlugin) {
- var _pluginName = "percpu";
- this.cpus = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.cpus = [];
-
- for (var i = 0; i < data.length; i++) {
- var cpuData = data[i];
-
- this.cpus.push({
- 'total': cpuData.total,
- 'user': cpuData.user,
- 'system': cpuData.system,
- 'idle': cpuData.idle,
- 'iowait': cpuData.iowait,
- 'steal': cpuData.steal
- });
- }
- };
-
- this.getUserAlert = function(cpu) {
- return GlancesPlugin.getAlert(_pluginName, 'percpu_user_', cpu.user)
- };
-
- this.getSystemAlert = function(cpu) {
- return GlancesPlugin.getAlert(_pluginName, 'percpu_system_', cpu.system);
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/plugin.js b/glances/outputs/static/js/services/plugins/plugin.js
deleted file mode 100644
index a2fbc91c..00000000
--- a/glances/outputs/static/js/services/plugins/plugin.js
+++ /dev/null
@@ -1,42 +0,0 @@
-glancesApp.service('GlancesPlugin', function () {
-
- var plugin = {
- 'limits': {},
- 'limitSuffix': ['critical', 'careful', 'warning']
- };
-
- plugin.setLimits = function(limits){
- this.limits = limits;
- };
-
- plugin.getAlert = function (pluginName, limitNamePrefix, current, maximum, log) {
- current = current || 0;
- maximum = maximum || 100;
- log = log || false;
-
- var log_str = log ? '_log' : '';
- var value = (current * 100) / maximum;
-
- if (this.limits[pluginName] != undefined) {
- for (var i = 0; i < this.limitSuffix.length; i++) {
- var limitName = limitNamePrefix + this.limitSuffix[i];
- var limit = this.limits[pluginName][limitName];
-
- if (value >= limit) {
- var pos = limitName.lastIndexOf("_");
- var className = limitName.substring(pos + 1);
-
- return className + log_str;
- }
- }
- }
-
- return "ok" + log_str;
- };
-
- plugin.getAlertLog = function (pluginName, limitNamePrefix, current, maximum) {
- return this.getAlert(pluginName, limitNamePrefix, current, maximum, true);
- };
-
- return plugin;
-});
diff --git a/glances/outputs/static/js/services/plugins/ports.js b/glances/outputs/static/js/services/plugins/ports.js
deleted file mode 100644
index 96fd57e5..00000000
--- a/glances/outputs/static/js/services/plugins/ports.js
+++ /dev/null
@@ -1,29 +0,0 @@
-glancesApp.service('GlancesPluginPorts', function() {
- var _pluginName = "ports";
- this.ports = [];
-
- this.setData = function(data, views) {
- var ports = data[_pluginName];
- this.ports = [];
-
- angular.forEach(ports, function(port) {
- this.ports.push(port);
- }, this);
- };
-
- this.getDecoration = function(port) {
- if (port.status === null) {
- return 'careful';
- }
-
- if (port.status === false) {
- return 'critical';
- }
-
- if (port.rtt_warning !== null && port.status > port.rtt_warning) {
- return 'warning';
- }
-
- return 'ok';
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/processcount.js b/glances/outputs/static/js/services/plugins/processcount.js
deleted file mode 100644
index 163f6b49..00000000
--- a/glances/outputs/static/js/services/plugins/processcount.js
+++ /dev/null
@@ -1,19 +0,0 @@
-glancesApp.service('GlancesPluginProcessCount', function() {
- var _pluginName = "processcount";
-
- this.total = null;
- this.running = null;
- this.sleeping = null;
- this.stopped = null;
- this.thread = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- this.total = data['total'] || 0;
- this.running = data['running'] || 0;
- this.sleeping = data['sleeping'] || 0;
- this.stopped = data['stopped'] || 0;
- this.thread = data['thread'] || 0;
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/quicklook.js b/glances/outputs/static/js/services/plugins/quicklook.js
deleted file mode 100644
index 37345b52..00000000
--- a/glances/outputs/static/js/services/plugins/quicklook.js
+++ /dev/null
@@ -1,40 +0,0 @@
-glancesApp.service('GlancesPluginQuicklook', function() {
- var _pluginName = "quicklook";
- var _view = {};
-
- this.mem = null;
- this.cpu = null;
- this.cpu_name = null;
- this.cpu_hz_current = null;
- this.cpu_hz = null;
- this.swap = null;
- this.percpus = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- this.mem = data.mem;
- this.cpu = data.cpu;
- this.cpu_name = data.cpu_name;
- this.cpu_hz_current = data.cpu_hz_current;
- this.cpu_hz = data.cpu_hz;
- this.swap = data.swap;
- this.percpus = [];
-
- angular.forEach(data.percpu, function(cpu) {
- this.percpus.push({
- 'number': cpu.cpu_number,
- 'total': cpu.total
- });
- }, this);
- }
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- }
-});
diff --git a/glances/outputs/static/js/services/plugins/raid.js b/glances/outputs/static/js/services/plugins/raid.js
deleted file mode 100644
index 900b2a5d..00000000
--- a/glances/outputs/static/js/services/plugins/raid.js
+++ /dev/null
@@ -1,50 +0,0 @@
-glancesApp.service('GlancesPluginRaid', function () {
- var _pluginName = "raid";
- this.disks = [];
-
- this.setData = function (data, views) {
- var disks = [];
- data = data[_pluginName];
-
- _.forIn(data, function(diskData, diskKey) {
- var disk = {
- 'name': diskKey,
- 'type': diskData.type == null ? 'UNKNOWN' : diskData.type,
- 'used': diskData.used,
- 'available': diskData.available,
- 'status': diskData.status,
- 'degraded': diskData.used < diskData.available,
- 'config': diskData.config == null ? '' : diskData.config.replace('_', 'A'),
- 'inactive': diskData.status == 'inactive',
- 'components': []
- };
-
- _.forEach(diskData.components, function(number, name) {
- disk.components.push({
- 'number': number,
- 'name': name
- });
- });
-
- disks.push(disk);
- });
-
- this.disks = disks;
- };
-
- this.hasDisks = function() {
- return this.disks.length > 0;
- }
-
- this.getAlert = function(disk) {
- if (disk.inactive) {
- return 'critical';
- }
-
- if (disk.degraded) {
- return 'warning';
- }
-
- return 'ok'
- }
-});
diff --git a/glances/outputs/static/js/services/plugins/sensors.js b/glances/outputs/static/js/services/plugins/sensors.js
deleted file mode 100644
index e553505a..00000000
--- a/glances/outputs/static/js/services/plugins/sensors.js
+++ /dev/null
@@ -1,21 +0,0 @@
-glancesApp.service('GlancesPluginSensors', function(GlancesPlugin) {
-
- var _pluginName = "sensors";
- this.sensors = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- _.remove(data, function(sensor) {
- return (_.isArray(sensor.value) && _.isEmpty(sensor.value)) || sensor.value === 0;
- });
-
- this.sensors = data;
- };
-
- this.getAlert = function(sensor) {
- var current = sensor.type == 'battery' ? 100 - sensor.value : sensor.value;
-
- return GlancesPlugin.getAlert(_pluginName, 'sensors_' + sensor.type + '_', current);
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/system.js b/glances/outputs/static/js/services/plugins/system.js
deleted file mode 100644
index ecf4f0f8..00000000
--- a/glances/outputs/static/js/services/plugins/system.js
+++ /dev/null
@@ -1,37 +0,0 @@
-glancesApp.service('GlancesPluginSystem', function() {
- var _pluginName = "system";
-
- this.hostname = null;
- this.platform = null;
- this.humanReadableName = null;
- this.os = {
- 'name': null,
- 'version': null
- };
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- this.hostname = data['hostname'];
- this.platform = data['platform'];
- this.os.name = data['os_name'];
- this.os.version = data['os_version'];
- this.humanReadableName = data['hr_name'];
- };
-
- this.isBsd = function() {
- return this.os.name === 'FreeBSD';
- };
-
- this.isLinux = function() {
- return this.os.name === 'Linux';
- };
-
- this.isMac = function() {
- return this.os.name === 'Darwin';
- };
-
- this.isWindows = function() {
- return this.os.name === 'Windows';
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/uptime.js b/glances/outputs/static/js/services/plugins/uptime.js
deleted file mode 100644
index 4a008bde..00000000
--- a/glances/outputs/static/js/services/plugins/uptime.js
+++ /dev/null
@@ -1,7 +0,0 @@
-glancesApp.service('GlancesPluginUptime', function() {
- this.uptime = null;
-
- this.setData = function(data, views) {
- this.uptime = data['uptime'];
- };
-});
diff --git a/glances/outputs/static/js/services/plugins/wifi.js b/glances/outputs/static/js/services/plugins/wifi.js
deleted file mode 100644
index 2defd931..00000000
--- a/glances/outputs/static/js/services/plugins/wifi.js
+++ /dev/null
@@ -1,36 +0,0 @@
-glancesApp.service('GlancesPluginWifi', function() {
- var _pluginName = "wifi";
- var _view = {};
- this.hotspots = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- this.hotspots = [];
- for (var i = 0; i < data.length; i++) {
- var hotspotData = data[i];
-
- if (hotspotData['ssid'] === '') {
- continue;
- }
-
- var hotspot = {
- 'ssid': hotspotData['ssid'],
- 'encrypted': hotspotData['encrypted'],
- 'signal': hotspotData['signal'],
- 'encryption_type': hotspotData['encryption_type'],
- };
-
- this.hotspots.push(hotspot);
- }
- };
-
- this.getDecoration = function(hotpost, field) {
- if(_view[hotpost.ssid][field] == undefined) {
- return;
- }
-
- return _view[hotpost.ssid][field].decoration.toLowerCase();
- };
-});
diff --git a/glances/outputs/static/js/stats.js b/glances/outputs/static/js/stats.js
new file mode 100644
index 00000000..fe2d26cb
--- /dev/null
+++ b/glances/outputs/static/js/stats.js
@@ -0,0 +1,60 @@
+glancesApp.service('GlancesStats', function($http, $q) {
+ var _stats = [], _views = [], _limits = [], _config = {};
+
+ this.getData = function() {
+ return $q.all([
+ this.getAllStats(),
+ this.getAllViews()
+ ]).then(function(results) {
+ return {
+ 'stats': results[0],
+ 'view': results[1]
+ };
+ });
+ };
+
+ this.getAllStats = function() {
+ return $http.get('/api/2/all').then(function (response) {
+ _stats = response.data;
+
+ return response.data;
+ });
+ };
+
+ this.getAllLimits = function() {
+ return $http.get('/api/2/all/limits').then(function (response) {
+ _limits = response.data;
+
+ return response.data;
+ });
+ };
+
+ this.getAllViews = function() {
+ return $http.get('/api/2/all/views').then(function (response) {
+ _views = response.data;
+
+ return response.data;
+ });
+ };
+
+ this.getHelp = function() {
+ return $http.get('/api/2/help').then(function (response) {
+ return response.data;
+ });
+ };
+
+ this.getConfig = function() {
+ return $http.get('/api/2/config').then(function (response) {
+ _config = response.data;
+
+ return _config;
+ });
+ };
+
+ this.getArguments = function() {
+ return $http.get('/api/2/args').then(function (response) {
+ return response.data;
+ });
+ };
+
+});
diff --git a/glances/outputs/static/public/js/main.min.js b/glances/outputs/static/public/js/main.min.js
index 03555ecd..b6df56c0 100644
--- a/glances/outputs/static/public/js/main.min.js
+++ b/glances/outputs/static/public/js/main.min.js
@@ -30,219 +30,10 @@ var glancesApp = angular.module('glancesApp', ['ngRoute'])
$rootScope.title = "Glances";
}]);
-glancesApp.controller('statsController', ["$scope", "$rootScope", "$interval", "GlancesStats", "help", "config", "arguments", "favicoService", function ($scope, $rootScope, $interval, GlancesStats, help, config, arguments, favicoService) {
+glancesApp.controller('statsController', ["$scope", "help", "config", "arguments", function ($scope, help, config, arguments) {
$scope.help = help;
+ $scope.config = config;
$scope.arguments = arguments;
-
- $scope.sorter = {
- column: "cpu_percent",
- auto: true,
- isReverseColumn: function (column) {
- return !(column == 'username' || column == 'name');
- },
- getColumnLabel: function (column) {
- if (_.isEqual(column, ['io_read', 'io_write'])) {
- return 'io_counters';
- } else {
- return column;
- }
- }
- };
-
- $scope.dataLoaded = false;
- $scope.refreshData = function () {
- GlancesStats.getData().then(function (data) {
-
- $scope.statsAlert = GlancesStats.getPlugin('alert');
- $scope.statsCloud = GlancesStats.getPlugin('cloud');
- $scope.statsCpu = GlancesStats.getPlugin('cpu');
- $scope.statsDiskio = GlancesStats.getPlugin('diskio');
- $scope.statsIrq = GlancesStats.getPlugin('irq');
- $scope.statsDocker = GlancesStats.getPlugin('docker');
- $scope.statsFs = GlancesStats.getPlugin('fs');
- $scope.statsFolders = GlancesStats.getPlugin('folders');
- $scope.statsGpu = GlancesStats.getPlugin('gpu');
- $scope.statsIp = GlancesStats.getPlugin('ip');
- $scope.statsLoad = GlancesStats.getPlugin('load');
- $scope.statsMem = GlancesStats.getPlugin('mem');
- $scope.statsMemSwap = GlancesStats.getPlugin('memswap');
- $scope.statsAmps = GlancesStats.getPlugin('amps');
- $scope.statsNetwork = GlancesStats.getPlugin('network');
- $scope.statsPerCpu = GlancesStats.getPlugin('percpu');
- $scope.statsProcessCount = GlancesStats.getPlugin('processcount');
- $scope.statsProcessList = GlancesStats.getPlugin('processlist');
- $scope.statsQuicklook = GlancesStats.getPlugin('quicklook');
- $scope.statsRaid = GlancesStats.getPlugin('raid');
- $scope.statsSensors = GlancesStats.getPlugin('sensors');
- $scope.statsSystem = GlancesStats.getPlugin('system');
- $scope.statsUptime = GlancesStats.getPlugin('uptime');
- $scope.statsPorts = GlancesStats.getPlugin('ports');
- $scope.statsWifi = GlancesStats.getPlugin('wifi');
-
- $rootScope.title = $scope.statsSystem.hostname + ' - Glances';
-
- if ($scope.statsAlert.hasOngoingAlerts()) {
- favicoService.badge($scope.statsAlert.countOngoingAlerts());
- } else {
- favicoService.reset();
- }
-
- $scope.is_disconnected = false;
- $scope.dataLoaded = true;
- }, function() {
- $scope.is_disconnected = true;
- });
- };
-
- $scope.refreshData();
- $interval(function () {
- $scope.refreshData();
- }, arguments.time * 1000); // in milliseconds
-
- $scope.onKeyDown = function ($event) {
-
- switch (true) {
- case !$event.shiftKey && $event.keyCode == keycodes.a:
- // a => Sort processes automatically
- $scope.sorter.column = "cpu_percent";
- $scope.sorter.auto = true;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.A:
- // A => Enable/disable AMPs
- $scope.arguments.disable_amps = !$scope.arguments.disable_amps;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.c:
- // c => Sort processes by CPU%
- $scope.sorter.column = "cpu_percent";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.m:
- // m => Sort processes by MEM%
- $scope.sorter.column = "memory_percent";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.u:
- // u => Sort processes by user
- $scope.sorter.column = "username";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.p:
- // p => Sort processes by name
- $scope.sorter.column = "name";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.i:
- // i => Sort processes by I/O rate
- $scope.sorter.column = ['io_read', 'io_write'];
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.t:
- // t => Sort processes by time
- $scope.sorter.column = "timemillis";
- $scope.sorter.auto = false;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.d:
- // d => Show/hide disk I/O stats
- $scope.arguments.disable_diskio = !$scope.arguments.disable_diskio;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.Q:
- // Q => Show/hide IRQ
- $scope.arguments.enable_irq = !$scope.arguments.enable_irq;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.f:
- // f => Show/hide filesystem stats
- $scope.arguments.disable_fs = !$scope.arguments.disable_fs;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.n:
- // n => Show/hide network stats
- $scope.arguments.disable_network = !$scope.arguments.disable_network;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.s:
- // s => Show/hide sensors stats
- $scope.arguments.disable_sensors = !$scope.arguments.disable_sensors;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.TWO:
- // 2 => Show/hide left sidebar
- $scope.arguments.disable_left_sidebar = !$scope.arguments.disable_left_sidebar;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.z:
- // z => Enable/disable processes stats
- $scope.arguments.disable_process = !$scope.arguments.disable_process;
- break;
- case $event.keyCode == keycodes.SLASH:
- // SLASH => Enable/disable short processes name
- $scope.arguments.process_short_name = !$scope.arguments.process_short_name;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.D:
- // D => Enable/disable Docker stats
- $scope.arguments.disable_docker = !$scope.arguments.disable_docker;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.b:
- // b => Bytes or bits for network I/O
- $scope.arguments.byte = !$scope.arguments.byte;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.b:
- // 'B' => Switch between bit/s and IO/s for Disk IO
- $scope.arguments.diskio_iops = !$scope.arguments.diskio_iops;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.l:
- // l => Show/hide alert logs
- $scope.arguments.disable_alert = !$scope.arguments.disable_alert;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.ONE:
- // 1 => Global CPU or per-CPU stats
- $scope.arguments.percpu = !$scope.arguments.percpu;
- break;
- case !$event.shiftKey && $event.keyCode == keycodes.h:
- // h => Show/hide this help screen
- $scope.arguments.help_tag = !$scope.arguments.help_tag;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.T:
- // T => View network I/O as combination
- $scope.arguments.network_sum = !$scope.arguments.network_sum;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.u:
- // U => View cumulative network I/O
- $scope.arguments.network_cumul = !$scope.arguments.network_cumul;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.f:
- // F => Show filesystem free space
- $scope.arguments.fs_free_space = !$scope.arguments.fs_free_space;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.THREE:
- // 3 => Enable/disable quick look plugin
- $scope.arguments.disable_quicklook = !$scope.arguments.disable_quicklook;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.SIX:
- // 6 => Enable/disable mean gpu
- $scope.arguments.meangpu = !$scope.arguments.meangpu;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.g:
- // G => Enable/disable gpu
- $scope.arguments.disable_gpu = !$scope.arguments.disable_gpu;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.FIVE:
- $scope.arguments.disable_quicklook = !$scope.arguments.disable_quicklook;
- $scope.arguments.disable_cpu = !$scope.arguments.disable_cpu;
- $scope.arguments.disable_mem = !$scope.arguments.disable_mem;
- $scope.arguments.disable_memswap = !$scope.arguments.disable_memswap;
- $scope.arguments.disable_load = !$scope.arguments.disable_load;
- $scope.arguments.disable_gpu = !$scope.arguments.disable_gpu;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.i:
- // I => Show/hide IP module
- $scope.arguments.disable_ip = !$scope.arguments.disable_ip;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.p:
- // I => Enable/disable ports module
- $scope.arguments.disable_ports = !$scope.arguments.disable_ports;
- break;
- case $event.shiftKey && $event.keyCode == keycodes.w:
- // 'W' > Enable/Disable Wifi plugin
- $scope.arguments.disable_wifi = !$scope.arguments.disable_wifi;
- break;
- }
- };
}]);
glancesApp.directive("sortableTh", function() {
@@ -284,6 +75,21 @@ glancesApp.directive("sortableTh", function() {
}
};
});
+glancesApp.service('favicoService', function() {
+
+ var favico = new Favico({
+ animation : 'none'
+ });
+
+ this.badge = function(nb) {
+ favico.badge(nb);
+ };
+
+ this.reset = function() {
+ favico.reset();
+ };
+});
+
glancesApp.filter('min_size', function() {
return function(input, max) {
var max = max || 8;
@@ -395,88 +201,9 @@ glancesApp.filter('timedelta', ["$filter", function($filter) {
}
}]);
-var keycodes = {
- 'a' : '65',
- 'c' : '67',
- 'm' : '77',
- 'p' : '80',
- 'i' : '73',
- 't' : '84',
- 'u' : '85',
- 'd' : '68',
- 'f' : '70',
- 'n' : '78',
- 's' : '83',
- 'z' : '90',
- 'e' : '69',
- 'SLASH': '191',
- 'D' : '68',
- 'b' : '66',
- 'l' : '76',
- 'w' : '87',
- 'x' : '88',
- 'ONE': '49',
- 'TWO': '50',
- 'THREE': '51',
- 'FOUR': '52',
- 'FIVE': '53',
- 'SIX': '54',
- 'h' : '72',
- 'T' : '84',
- 'F' : '70',
- 'g' : '71',
- 'r' : '82',
- 'q' : '81',
- 'A' : '65',
- 'Q' : '81'
-}
-
-glancesApp.service('favicoService', function() {
-
- var favico = new Favico({
- animation : 'none'
- });
-
- this.badge = function(nb) {
- favico.badge(nb);
- };
-
- this.reset = function() {
- favico.reset();
- };
-});
-
-glancesApp.service('GlancesStats', ["$http", "$injector", "$q", "GlancesPlugin", function($http, $injector, $q, GlancesPlugin) {
+glancesApp.service('GlancesStats', ["$http", "$q", function($http, $q) {
var _stats = [], _views = [], _limits = [], _config = {};
- var _plugins = {
- 'alert': 'GlancesPluginAlert',
- 'cloud': 'GlancesPluginCloud',
- 'cpu': 'GlancesPluginCpu',
- 'diskio': 'GlancesPluginDiskio',
- 'irq' : 'GlancesPluginIrq',
- 'docker': 'GlancesPluginDocker',
- 'ip': 'GlancesPluginIp',
- 'fs': 'GlancesPluginFs',
- 'folders': 'GlancesPluginFolders',
- 'gpu': 'GlancesPluginGpu',
- 'load': 'GlancesPluginLoad',
- 'mem': 'GlancesPluginMem',
- 'memswap': 'GlancesPluginMemSwap',
- 'amps': 'GlancesPluginAmps',
- 'network': 'GlancesPluginNetwork',
- 'percpu': 'GlancesPluginPerCpu',
- 'processcount': 'GlancesPluginProcessCount',
- 'processlist': 'GlancesPluginProcessList',
- 'quicklook': 'GlancesPluginQuicklook',
- 'raid': 'GlancesPluginRaid',
- 'sensors': 'GlancesPluginSensors',
- 'system': 'GlancesPluginSystem',
- 'uptime': 'GlancesPluginUptime',
- 'ports': 'GlancesPluginPorts',
- 'wifi': 'GlancesPluginWifi'
- };
-
this.getData = function() {
return $q.all([
this.getAllStats(),
@@ -533,411 +260,256 @@ glancesApp.service('GlancesStats', ["$http", "$injector", "$q", "GlancesPlugin",
});
};
- this.getPlugin = function(name) {
- var plugin = _plugins[name];
-
- if (plugin === undefined) {
- throw "Plugin '" + name + "' not found";
- }
-
- plugin = $injector.get(plugin);
- plugin.setData(_stats, _views, _config);
-
- return plugin;
- };
-
- // load limits to init GlancePlugin helper
- this.getAllLimits().then(function(limits) {
- GlancesPlugin.setLimits(limits);
- });
-
}]);
-glancesApp.service('GlancesPluginAlert', function () {
- var _pluginName = "alert";
- var _alerts = [];
+var keycodes = {
+ 'a' : '65',
+ 'c' : '67',
+ 'm' : '77',
+ 'p' : '80',
+ 'i' : '73',
+ 't' : '84',
+ 'u' : '85',
+ 'd' : '68',
+ 'f' : '70',
+ 'n' : '78',
+ 's' : '83',
+ 'z' : '90',
+ 'e' : '69',
+ 'SLASH': '191',
+ 'D' : '68',
+ 'b' : '66',
+ 'l' : '76',
+ 'w' : '87',
+ 'x' : '88',
+ 'ONE': '49',
+ 'TWO': '50',
+ 'THREE': '51',
+ 'FOUR': '52',
+ 'FIVE': '53',
+ 'SIX': '54',
+ 'h' : '72',
+ 'T' : '84',
+ 'F' : '70',
+ 'g' : '71',
+ 'r' : '82',
+ 'q' : '81',
+ 'A' : '65',
+ 'Q' : '81'
+}
- this.setData = function (data, views) {
- data = data[_pluginName];
- _alerts = [];
+'use strict';
- if(!_.isArray(data)) {
- data = [];
- }
-
- for (var i = 0; i < data.length; i++) {
- var alertData = data[i];
- var alert = {};
-
- alert.name = alertData[3];
- alert.level = alertData[2];
- alert.begin = alertData[0] * 1000;
- alert.end = alertData[1] * 1000;
- alert.ongoing = alertData[1] == -1;
- alert.min = alertData[6];
- alert.mean = alertData[5];
- alert.max = alertData[4];
-
- if (!alert.ongoing) {
- var duration = alert.end - alert.begin;
- var seconds = parseInt((duration / 1000) % 60)
- , minutes = parseInt((duration / (1000 * 60)) % 60)
- , hours = parseInt((duration / (1000 * 60 * 60)) % 24);
-
- alert.duration = _.padStart(hours, 2, '0') + ":" + _.padStart(minutes, 2, '0') + ":" + _.padStart(seconds, 2, '0');
- }
-
- _alerts.push(alert);
- }
- };
-
- this.hasAlerts = function () {
- return _alerts.length > 0;
- };
-
- this.getAlerts = function () {
- return _alerts;
- };
-
- this.count = function () {
- return _alerts.length;
- };
-
- this.hasOngoingAlerts = function () {
- return _.filter(_alerts, { 'ongoing': true }).length > 0;
- };
-
- this.countOngoingAlerts = function () {
- return _.filter(_alerts, { 'ongoing': true }).length;
- }
+glancesApp.component('glances', {
+ controller: GlancesController,
+ bindings: {
+ arguments: '<',
+ config: '<',
+ help: '<'
+ },
+ controllerAs: 'vm',
+ templateUrl: 'components/glances/view.html'
});
-glancesApp.service('GlancesPluginAmps', function() {
- var _pluginName = "amps";
- this.processes = [];
+'use strict';
- this.setData = function(data, views) {
- var processes = data[_pluginName];
+function GlancesController($interval, GlancesStats, favicoService) {
+ var vm = this;
- this.processes = [];
- angular.forEach(processes, function(process) {
- if (process.result !== null) {
- this.processes.push(process);
- }
- }, this);
- };
-
- this.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';
+ vm.sorter = {
+ column: "cpu_percent",
+ auto: true,
+ isReverseColumn: function (column) {
+ return !(column == 'username' || column == 'name');
+ },
+ getColumnLabel: function (column) {
+ if (_.isEqual(column, ['io_read', 'io_write'])) {
+ return 'io_counters';
} else {
- decoration = 'careful';
+ return column;
}
- } else {
- decoration = countMin == null ? 'ok' : 'critical';
}
+ };
- return decoration;
- }
+ vm.dataLoaded = false;
+ vm.stats = {};
+ vm.refreshData = function () {
+ GlancesStats.getData().then(function (data) {
+ vm.stats = data;
+ vm.is_disconnected = false;
+ vm.dataLoaded = true;
+ }, function() {
+ vm.is_disconnected = true;
+ });
+ };
+
+ vm.refreshData();
+ var refreshTime = 60; // arguments.time
+ $interval(function () {
+ vm.refreshData();
+ }, refreshTime * 1000); // in milliseconds
+
+ vm.onKeyDown = function ($event) {
+
+ switch (true) {
+ case !$event.shiftKey && $event.keyCode == keycodes.a:
+ // a => Sort processes automatically
+ vm.sorter.column = "cpu_percent";
+ vm.sorter.auto = true;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.A:
+ // A => Enable/disable AMPs
+ vm.arguments.disable_amps = !vm.arguments.disable_amps;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.c:
+ // c => Sort processes by CPU%
+ vm.sorter.column = "cpu_percent";
+ vm.sorter.auto = false;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.m:
+ // m => Sort processes by MEM%
+ vm.sorter.column = "memory_percent";
+ vm.sorter.auto = false;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.u:
+ // u => Sort processes by user
+ vm.sorter.column = "username";
+ vm.sorter.auto = false;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.p:
+ // p => Sort processes by name
+ vm.sorter.column = "name";
+ vm.sorter.auto = false;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.i:
+ // i => Sort processes by I/O rate
+ vm.sorter.column = ['io_read', 'io_write'];
+ vm.sorter.auto = false;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.t:
+ // t => Sort processes by time
+ vm.sorter.column = "timemillis";
+ vm.sorter.auto = false;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.d:
+ // d => Show/hide disk I/O stats
+ vm.arguments.disable_diskio = !vm.arguments.disable_diskio;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.Q:
+ // Q => Show/hide IRQ
+ vm.arguments.enable_irq = !vm.arguments.enable_irq;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.f:
+ // f => Show/hide filesystem stats
+ vm.arguments.disable_fs = !vm.arguments.disable_fs;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.n:
+ // n => Show/hide network stats
+ vm.arguments.disable_network = !vm.arguments.disable_network;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.s:
+ // s => Show/hide sensors stats
+ vm.arguments.disable_sensors = !vm.arguments.disable_sensors;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.TWO:
+ // 2 => Show/hide left sidebar
+ vm.arguments.disable_left_sidebar = !vm.arguments.disable_left_sidebar;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.z:
+ // z => Enable/disable processes stats
+ vm.arguments.disable_process = !vm.arguments.disable_process;
+ break;
+ case $event.keyCode == keycodes.SLASH:
+ // SLASH => Enable/disable short processes name
+ vm.arguments.process_short_name = !vm.arguments.process_short_name;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.D:
+ // D => Enable/disable Docker stats
+ vm.arguments.disable_docker = !vm.arguments.disable_docker;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.b:
+ // b => Bytes or bits for network I/O
+ vm.arguments.byte = !vm.arguments.byte;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.b:
+ // 'B' => Switch between bit/s and IO/s for Disk IO
+ vm.arguments.diskio_iops = !vm.arguments.diskio_iops;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.l:
+ // l => Show/hide alert logs
+ vm.arguments.disable_alert = !vm.arguments.disable_alert;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.ONE:
+ // 1 => Global CPU or per-CPU stats
+ vm.arguments.percpu = !vm.arguments.percpu;
+ break;
+ case !$event.shiftKey && $event.keyCode == keycodes.h:
+ // h => Show/hide this help screen
+ vm.arguments.help_tag = !vm.arguments.help_tag;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.T:
+ // T => View network I/O as combination
+ vm.arguments.network_sum = !vm.arguments.network_sum;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.u:
+ // U => View cumulative network I/O
+ vm.arguments.network_cumul = !vm.arguments.network_cumul;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.f:
+ // F => Show filesystem free space
+ vm.arguments.fs_free_space = !vm.arguments.fs_free_space;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.THREE:
+ // 3 => Enable/disable quick look plugin
+ vm.arguments.disable_quicklook = !vm.arguments.disable_quicklook;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.SIX:
+ // 6 => Enable/disable mean gpu
+ vm.arguments.meangpu = !vm.arguments.meangpu;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.g:
+ // G => Enable/disable gpu
+ vm.arguments.disable_gpu = !vm.arguments.disable_gpu;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.FIVE:
+ vm.arguments.disable_quicklook = !vm.arguments.disable_quicklook;
+ vm.arguments.disable_cpu = !vm.arguments.disable_cpu;
+ vm.arguments.disable_mem = !vm.arguments.disable_mem;
+ vm.arguments.disable_memswap = !vm.arguments.disable_memswap;
+ vm.arguments.disable_load = !vm.arguments.disable_load;
+ vm.arguments.disable_gpu = !vm.arguments.disable_gpu;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.i:
+ // I => Show/hide IP module
+ vm.arguments.disable_ip = !vm.arguments.disable_ip;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.p:
+ // I => Enable/disable ports module
+ vm.arguments.disable_ports = !vm.arguments.disable_ports;
+ break;
+ case $event.shiftKey && $event.keyCode == keycodes.w:
+ // 'W' > Enable/Disable Wifi plugin
+ vm.arguments.disable_wifi = !vm.arguments.disable_wifi;
+ break;
+ }
+ };
+}
+
+'use strict';
+
+glancesApp.component('glancesPluginIp', {
+ controller: GlancesPluginIpController,
+ controllerAs: 'vm',
+ bindings: {
+ stats: '<',
+ },
+ templateUrl: 'components/plugin-ip/view.html'
});
-glancesApp.service('GlancesPluginCloud', function() {
- var _pluginName = "cloud";
- var _provider = null;
- var _instance = null;
+'use strict';
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- if (data['ami-id'] !== undefined) {
- _provider = 'AWS EC2';
- _instance = data['instance-type'] + ' instance ' + data['instance-id'] + ' (' + data['region'] + ')';
- }
- }
-
- this.getProvider = function() {
- return _provider;
- }
-
- this.getInstance = function() {
- return _instance;
- }
-});
-
-glancesApp.service('GlancesPluginCpu', function() {
- var _pluginName = "cpu";
- var _view = {};
-
- this.total = null;
- this.user = null;
- this.system = null;
- this.idle = null;
- this.nice = null;
- this.irq = null;
- this.iowait = null;
- this.steal = null;
- this.ctx_switches = null;
- this.interrupts = null;
- this.soft_interrupts = null;
- this.syscalls = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- this.total = data.total;
- this.user = data.user;
- this.system = data.system;
- this.idle = data.idle;
- this.nice = data.nice;
- this.irq = data.irq;
- this.iowait = data.iowait;
- this.steal = data.steal;
-
- if (data.ctx_switches) {
- this.ctx_switches = Math.floor(data.ctx_switches / data.time_since_update);
- }
-
- if (data.interrupts) {
- this.interrupts = Math.floor(data.interrupts / data.time_since_update);
- }
-
- if (data.soft_interrupts) {
- this.soft_interrupts = Math.floor(data.soft_interrupts / data.time_since_update);
- }
-
- if (data.syscalls) {
- this.syscalls = Math.floor(data.syscalls / data.time_since_update);
- }
- }
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- }
-});
-
-glancesApp.service('GlancesPluginDiskio', ["$filter", function($filter) {
- var _pluginName = "diskio";
- this.disks = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- data = $filter('orderBy')(data,'disk_name');
- this.disks = [];
-
- for (var i = 0; i < data.length; i++) {
- var diskioData = data[i];
- var timeSinceUpdate = diskioData['time_since_update'];
-
- var diskio = {
- 'name': diskioData['disk_name'],
- 'bitrate': {
- 'txps': $filter('bytes')(diskioData['read_bytes'] / timeSinceUpdate),
- 'rxps': $filter('bytes')(diskioData['write_bytes'] / timeSinceUpdate)
- },
- 'count': {
- 'txps': $filter('bytes')(diskioData['read_count'] / timeSinceUpdate),
- 'rxps': $filter('bytes')(diskioData['write_count'] / timeSinceUpdate)
- },
- 'alias': diskioData['alias'] !== undefined ? diskioData['alias'] : null
- };
-
- this.disks.push(diskio);
- }
- };
-}]);
-
-glancesApp.service('GlancesPluginDocker', ["GlancesPlugin", function(GlancesPlugin) {
-
- var _pluginName = "docker";
- this.containers = [];
- this.version = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.containers = [];
-
- if(_.isEmpty(data)) {
- return;
- }
-
- for (var i = 0; i < data['containers'].length; i++) {
- var containerData = data['containers'][i];
-
- var container = {
- 'id': containerData.Id,
- 'name': containerData.Names[0].split('/').splice(-1)[0],
- 'status': containerData.Status,
- 'cpu': containerData.cpu.total,
- 'memory': containerData.memory.usage != undefined ? containerData.memory.usage : '?',
- 'ior': containerData.io.ior != undefined ? containerData.io.ior : '?',
- 'iow': containerData.io.iow != undefined ? containerData.io.iow : '?',
- 'io_time_since_update': containerData.io.time_since_update,
- 'rx': containerData.network.rx != undefined ? containerData.network.rx : '?',
- 'tx': containerData.network.tx != undefined ? containerData.network.tx : '?',
- 'net_time_since_update': containerData.network.time_since_update,
- 'command': containerData.Command,
- 'image': containerData.Image
- };
-
- this.containers.push(container);
- }
-
- this.version = data['version']['Version'];
- };
-}]);
-
-glancesApp.service('GlancesPluginFolders', function() {
- var _pluginName = "folders";
- this.folders = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.folders = [];
-
- for (var i = 0; i < data.length; i++) {
- var folderData = data[i];
-
- var folder = {
- 'path': folderData['path'],
- 'size': folderData['size'],
- 'careful': folderData['careful'],
- 'warning': folderData['warning'],
- 'critical': folderData['critical']
- };
-
- this.folders.push(folder);
- }
- };
-
- this.getDecoration = function(folder) {
-
- if (!Number.isInteger(folder.size)) {
- return;
- }
-
- if (folder.critical !== null && folder.size > (folder.critical * 1000000)) {
- return 'critical';
- } else if (folder.warning !== null && folder.size > (folder.warning * 1000000)) {
- return 'warning';
- } else if (folder.careful !== null && folder.size > (folder.careful * 1000000)) {
- return 'careful';
- }
-
- return 'ok';
- };
-});
-
-glancesApp.service('GlancesPluginFs', function() {
- var _pluginName = "fs";
- var _view = {};
- this.fileSystems = [];
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
- this.fileSystems = [];
-
- for (var i = 0; i < data.length; i++) {
- var fsData = data[i];
-
- var shortMountPoint = fsData['mnt_point'];
- if (shortMountPoint.length > 9) {
- shortMountPoint = '_' + fsData['mnt_point'].slice(-8);
- }
-
- var fs = {
- 'name': fsData['device_name'],
- 'mountPoint': fsData['mnt_point'],
- 'shortMountPoint': shortMountPoint,
- 'percent': fsData['percent'],
- 'size': fsData['size'],
- 'used': fsData['used'],
- 'free': fsData['free']
- };
-
- this.fileSystems.push(fs);
- }
- };
-
- this.getDecoration = function(mountPoint, field) {
- if(_view[mountPoint][field] == undefined) {
- return;
- }
-
- return _view[mountPoint][field].decoration.toLowerCase();
- };
-});
-
-glancesApp.service('GlancesPluginGpu', function() {
- var _pluginName = "gpu";
- var _view = {};
- this.gpus = [];
- this.name = "GPU";
- this.mean = {};
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- if (data.length === 0) {
- return;
- }
-
- this.gpus = [];
- this.name = "GPU";
- this.mean = {
- proc: null,
- mem: null
- };
- var sameName = true;
-
- for (var i = 0; i < data.length; i++) {
- var gpuData = data[i];
-
- var gpu = gpuData;
-
- this.mean.proc += gpu.proc;
- this.mean.mem += gpu.mem;
-
- this.gpus.push(gpu);
- }
-
- if (data.length === 1 ) {
- this.name = data[0].name;
- } else if (sameName) {
- this.name = data.length + ' GPU ' + data[0].name;
- }
-
- this.mean.proc = this.mean.proc / data.length;
- this.mean.mem = this.mean.mem / data.length;
- };
-
- this.getDecoration = function(gpuId, value) {
- if(_view[gpuId][value] == undefined) {
- return;
- }
-
- return _view[gpuId][value].decoration.toLowerCase();
- };
-
- this.getMeanDecoration = function(value) {
- return this.getDecoration(0, value);
- };
-});
-
-glancesApp.service('GlancesPluginIp', function() {
- var _pluginName = "ip";
+function GlancesPluginIpController() {
+ var vm = this;
this.address = null;
this.gateway = null;
@@ -945,281 +517,107 @@ glancesApp.service('GlancesPluginIp', function() {
this.maskCidr = null;
this.publicAddress = null;
- this.setData = function(data, views) {
- data = data[_pluginName];
+ vm.$onChanges = function (changes) {
+ var stats = changes.stats.currentValue;
+ if (stats === undefined || stats.stats === undefined) {
+ return;
+ }
- this.address = data.address;
- this.gateway = data.gateway;
- this.mask = data.mask;
- this.maskCidr = data.mask_cidr;
- this.publicAddress = data.public_address
+ var data = stats.stats['ip'];
+
+ vm.address = data.address;
+ vm.gateway = data.gateway;
+ vm.mask = data.mask;
+ vm.maskCidr = data.mask_cidr;
+ vm.publicAddress = data.public_address
};
+}
+
+'use strict';
+
+glancesApp.component('glancesPluginSystem', {
+ controller: GlancesPluginSystemController,
+ controllerAs: 'vm',
+ bindings: {
+ stats: '<',
+ isDisconnected: '<'
+ },
+ templateUrl: 'components/plugin-system/view.html'
});
-glancesApp.service('GlancesPluginIrq', function() {
- var _pluginName = "irq";
- this.irqs = [];
+'use strict';
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.irqs = [];
+function GlancesPluginSystemController() {
+ var vm = this;
+ var _pluginName = "system";
- for (var i = 0; i < data.length; i++) {
- var IrqData = data[i];
- var timeSinceUpdate = IrqData['time_since_update'];
-
- var irq = {
- 'irq_line': IrqData['irq_line'],
- 'irq_rate': IrqData['irq_rate']
- };
-
- this.irqs.push(irq);
- }
+ vm.hostname = null;
+ vm.platform = null;
+ vm.humanReadableName = null;
+ vm.os = {
+ 'name': null,
+ 'version': null
};
+
+ vm.$onChanges = function (changes) {
+ var stats = changes.stats.currentValue;
+ if (stats === undefined || stats.stats === undefined) {
+ return;
+ }
+
+ var data = stats.stats[_pluginName];
+
+ vm.hostname = data['hostname'];
+ vm.platform = data['platform'];
+ vm.os.name = data['os_name'];
+ vm.os.version = data['os_version'];
+ vm.humanReadableName = data['hr_name'];
+ };
+
+ vm.isBsd = function() {
+ return this.os.name === 'FreeBSD';
+ };
+
+ vm.isLinux = function() {
+ return this.os.name === 'Linux';
+ };
+
+ vm.isMac = function() {
+ return this.os.name === 'Darwin';
+ };
+
+ vm.isWindows = function() {
+ return this.os.name === 'Windows';
+ };
+}
+
+'use strict';
+
+glancesApp.component('glancesPluginUptime', {
+ controller: GlancesPluginUptimeController,
+ controllerAs: 'vm',
+ bindings: {
+ stats: '<',
+ },
+ templateUrl: 'components/plugin-uptime/view.html'
});
-glancesApp.service('GlancesPluginLoad', function() {
- var _pluginName = "load";
- var _view = {};
+'use strict';
- this.cpucore = null;
- this.min1 = null;
- this.min5 = null;
- this.min15 = null;
+function GlancesPluginUptimeController() {
+ var vm = this;
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
+ this.value = null
- this.cpucore = data['cpucore'];
- this.min1 = data['min1'];
- this.min5 = data['min5'];
- this.min15 = data['min15'];
+ vm.$onChanges = function (changes) {
+ var stats = changes.stats.currentValue;
+ if (stats === undefined || stats.stats === undefined) {
+ return;
+ }
+
+ vm.value = stats.stats['uptime'];
};
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- };
-});
-
-glancesApp.service('GlancesPluginMem', function() {
- var _pluginName = "mem";
- var _view = {};
-
- this.percent = null;
- this.total = null;
- this.used = null;
- this.free = null;
- this.version = null;
- this.active = null;
- this.inactive = null;
- this.buffers = null;
- this.cached = null;
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
-
- this.percent = data['percent'];
- this.total = data['total'];
- this.used = data['used'];
- this.free = data['free'];
- this.active = data['active'];
- this.inactive = data['inactive'];
- this.buffers = data['buffers'];
- this.cached = data['cached'];
- };
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- };
-});
-
-glancesApp.service('GlancesPluginMemSwap', function() {
- var _pluginName = "memswap";
- var _view = {};
-
- this.percent = null;
- this.total = null;
- this.used = null;
- this.free = null;
-
- this.setData = function(data, views) {
- _view = views[_pluginName];
- data = data[_pluginName];
-
- this.percent = data['percent'];
- this.total = data['total'];
- this.used = data['used'];
- this.free = data['free'];
- };
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- };
-});
-
-glancesApp.service('GlancesPluginNetwork', function() {
- var _pluginName = "network";
- this.networks = [];
-
- this.setData = function(data, views) {
- this.networks = [];
-
- for (var i = 0; i < data[_pluginName].length; i++) {
- var networkData = data[_pluginName][i];
-
- var network = {
- 'interfaceName': networkData['interface_name'],
- 'rx': networkData['rx'],
- 'tx': networkData['tx'],
- 'cx': networkData['cx'],
- 'time_since_update': networkData['time_since_update'],
- 'cumulativeRx': networkData['cumulative_rx'],
- 'cumulativeTx': networkData['cumulative_tx'],
- 'cumulativeCx': networkData['cumulative_cx']
- };
-
- this.networks.push(network);
- }
- };
-});
-
-glancesApp.service('GlancesPluginPerCpu', ["$filter", "GlancesPlugin", function($filter, GlancesPlugin) {
- var _pluginName = "percpu";
- this.cpus = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- this.cpus = [];
-
- for (var i = 0; i < data.length; i++) {
- var cpuData = data[i];
-
- this.cpus.push({
- 'total': cpuData.total,
- 'user': cpuData.user,
- 'system': cpuData.system,
- 'idle': cpuData.idle,
- 'iowait': cpuData.iowait,
- 'steal': cpuData.steal
- });
- }
- };
-
- this.getUserAlert = function(cpu) {
- return GlancesPlugin.getAlert(_pluginName, 'percpu_user_', cpu.user)
- };
-
- this.getSystemAlert = function(cpu) {
- return GlancesPlugin.getAlert(_pluginName, 'percpu_system_', cpu.system);
- };
-}]);
-
-glancesApp.service('GlancesPlugin', function () {
-
- var plugin = {
- 'limits': {},
- 'limitSuffix': ['critical', 'careful', 'warning']
- };
-
- plugin.setLimits = function(limits){
- this.limits = limits;
- };
-
- plugin.getAlert = function (pluginName, limitNamePrefix, current, maximum, log) {
- current = current || 0;
- maximum = maximum || 100;
- log = log || false;
-
- var log_str = log ? '_log' : '';
- var value = (current * 100) / maximum;
-
- if (this.limits[pluginName] != undefined) {
- for (var i = 0; i < this.limitSuffix.length; i++) {
- var limitName = limitNamePrefix + this.limitSuffix[i];
- var limit = this.limits[pluginName][limitName];
-
- if (value >= limit) {
- var pos = limitName.lastIndexOf("_");
- var className = limitName.substring(pos + 1);
-
- return className + log_str;
- }
- }
- }
-
- return "ok" + log_str;
- };
-
- plugin.getAlertLog = function (pluginName, limitNamePrefix, current, maximum) {
- return this.getAlert(pluginName, limitNamePrefix, current, maximum, true);
- };
-
- return plugin;
-});
-
-glancesApp.service('GlancesPluginPorts', function() {
- var _pluginName = "ports";
- this.ports = [];
-
- this.setData = function(data, views) {
- var ports = data[_pluginName];
- this.ports = [];
-
- angular.forEach(ports, function(port) {
- this.ports.push(port);
- }, this);
- };
-
- this.getDecoration = function(port) {
- if (port.status === null) {
- return 'careful';
- }
-
- if (port.status === false) {
- return 'critical';
- }
-
- if (port.rtt_warning !== null && port.status > port.rtt_warning) {
- return 'warning';
- }
-
- return 'ok';
- };
-});
-
-glancesApp.service('GlancesPluginProcessCount', function() {
- var _pluginName = "processcount";
-
- this.total = null;
- this.running = null;
- this.sleeping = null;
- this.stopped = null;
- this.thread = null;
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- this.total = data['total'] || 0;
- this.running = data['running'] || 0;
- this.sleeping = data['sleeping'] || 0;
- this.stopped = data['stopped'] || 0;
- this.thread = data['thread'] || 0;
- };
-});
+}
glancesApp.service('GlancesPluginProcessList', ["$filter", "GlancesPlugin", function($filter, GlancesPlugin) {
var _pluginName = "processlist";
@@ -1285,200 +683,3 @@ glancesApp.service('GlancesPluginProcessList', ["$filter", "GlancesPlugin", func
return _maxProcessesToDisplay;
};
}]);
-
-glancesApp.service('GlancesPluginQuicklook', function() {
- var _pluginName = "quicklook";
- var _view = {};
-
- this.mem = null;
- this.cpu = null;
- this.cpu_name = null;
- this.cpu_hz_current = null;
- this.cpu_hz = null;
- this.swap = null;
- this.percpus = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- this.mem = data.mem;
- this.cpu = data.cpu;
- this.cpu_name = data.cpu_name;
- this.cpu_hz_current = data.cpu_hz_current;
- this.cpu_hz = data.cpu_hz;
- this.swap = data.swap;
- this.percpus = [];
-
- angular.forEach(data.percpu, function(cpu) {
- this.percpus.push({
- 'number': cpu.cpu_number,
- 'total': cpu.total
- });
- }, this);
- }
-
- this.getDecoration = function(value) {
- if(_view[value] == undefined) {
- return;
- }
-
- return _view[value].decoration.toLowerCase();
- }
-});
-
-glancesApp.service('GlancesPluginRaid', function () {
- var _pluginName = "raid";
- this.disks = [];
-
- this.setData = function (data, views) {
- var disks = [];
- data = data[_pluginName];
-
- _.forIn(data, function(diskData, diskKey) {
- var disk = {
- 'name': diskKey,
- 'type': diskData.type == null ? 'UNKNOWN' : diskData.type,
- 'used': diskData.used,
- 'available': diskData.available,
- 'status': diskData.status,
- 'degraded': diskData.used < diskData.available,
- 'config': diskData.config == null ? '' : diskData.config.replace('_', 'A'),
- 'inactive': diskData.status == 'inactive',
- 'components': []
- };
-
- _.forEach(diskData.components, function(number, name) {
- disk.components.push({
- 'number': number,
- 'name': name
- });
- });
-
- disks.push(disk);
- });
-
- this.disks = disks;
- };
-
- this.hasDisks = function() {
- return this.disks.length > 0;
- }
-
- this.getAlert = function(disk) {
- if (disk.inactive) {
- return 'critical';
- }
-
- if (disk.degraded) {
- return 'warning';
- }
-
- return 'ok'
- }
-});
-
-glancesApp.service('GlancesPluginSensors', ["GlancesPlugin", function(GlancesPlugin) {
-
- var _pluginName = "sensors";
- this.sensors = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- _.remove(data, function(sensor) {
- return (_.isArray(sensor.value) && _.isEmpty(sensor.value)) || sensor.value === 0;
- });
-
- this.sensors = data;
- };
-
- this.getAlert = function(sensor) {
- var current = sensor.type == 'battery' ? 100 - sensor.value : sensor.value;
-
- return GlancesPlugin.getAlert(_pluginName, 'sensors_' + sensor.type + '_', current);
- };
-}]);
-
-glancesApp.service('GlancesPluginSystem', function() {
- var _pluginName = "system";
-
- this.hostname = null;
- this.platform = null;
- this.humanReadableName = null;
- this.os = {
- 'name': null,
- 'version': null
- };
-
- this.setData = function(data, views) {
- data = data[_pluginName];
-
- this.hostname = data['hostname'];
- this.platform = data['platform'];
- this.os.name = data['os_name'];
- this.os.version = data['os_version'];
- this.humanReadableName = data['hr_name'];
- };
-
- this.isBsd = function() {
- return this.os.name === 'FreeBSD';
- };
-
- this.isLinux = function() {
- return this.os.name === 'Linux';
- };
-
- this.isMac = function() {
- return this.os.name === 'Darwin';
- };
-
- this.isWindows = function() {
- return this.os.name === 'Windows';
- };
-});
-
-glancesApp.service('GlancesPluginUptime', function() {
- this.uptime = null;
-
- this.setData = function(data, views) {
- this.uptime = data['uptime'];
- };
-});
-
-glancesApp.service('GlancesPluginWifi', function() {
- var _pluginName = "wifi";
- var _view = {};
- this.hotspots = [];
-
- this.setData = function(data, views) {
- data = data[_pluginName];
- _view = views[_pluginName];
-
- this.hotspots = [];
- for (var i = 0; i < data.length; i++) {
- var hotspotData = data[i];
-
- if (hotspotData['ssid'] === '') {
- continue;
- }
-
- var hotspot = {
- 'ssid': hotspotData['ssid'],
- 'encrypted': hotspotData['encrypted'],
- 'signal': hotspotData['signal'],
- 'encryption_type': hotspotData['encryption_type'],
- };
-
- this.hotspots.push(hotspot);
- }
- };
-
- this.getDecoration = function(hotpost, field) {
- if(_view[hotpost.ssid][field] == undefined) {
- return;
- }
-
- return _view[hotpost.ssid][field].decoration.toLowerCase();
- };
-});
diff --git a/glances/outputs/static/public/js/templates.min.js b/glances/outputs/static/public/js/templates.min.js
index 3c0c4f24..86740b2e 100644
--- a/glances/outputs/static/public/js/templates.min.js
+++ b/glances/outputs/static/public/js/templates.min.js
@@ -1,27 +1,4 @@
-angular.module('glancesApp').run(['$templateCache', function($templateCache) {$templateCache.put('plugins/alert.html','
\n
\n
\n{{alert.begin | date : \'yyyy-MM-dd H:mm:ss\'}} ({{ alert.ongoing ? \'ongoing\' : alert.duration }}) - {{alert.level}} on {{alert.name}} ({{alert.max}})\n\t\t
\n
\n
\n');
-$templateCache.put('plugins/alerts.html','
No warning or critical alert detected\n
Warning or critical alerts (lasts {{statsAlert.count()}} entries)\n');
-$templateCache.put('plugins/amps.html','
\n
\n
{{ process.name }}
\n
{{ process.count }}
\n
{{ process.result }}
\n
\n
\n');
-$templateCache.put('plugins/cloud.html','
{{ statsCloud.getProvider() }} {{ statsCloud.getInstance() }}\n');
-$templateCache.put('plugins/cpu.html','
\n
\n
\n
\n
CPU
\n
{{ statsCpu.total }}%
\n
\n
\n
user:
\n
\n {{ statsCpu.user }}%\n
\n
\n
\n
system:
\n
\n {{ statsCpu.system }}%\n
\n
\n
\n
idle:
\n
{{ statsCpu.idle }}%
\n
\n
\n
\n
\n
\n
\n
nice:
\n
\n {{ statsCpu.nice }}%\n
\n
\n
\n
irq:
\n
\n {{ statsCpu.irq }}%\n
\n
\n
\n
iowait:
\n
\n {{ statsCpu.iowait }}%\n
\n
\n
\n
steal:
\n
\n {{ statsCpu.steal }}%\n
\n
\n
\n
\n
\n
\n
\n
ctx_sw:
\n
\n {{ statsCpu.ctx_switches }}\n
\n
\n
\n
inter:
\n
\n {{ statsCpu.interrupts }}\n
\n
\n
\n
sw_int:
\n
\n {{ statsCpu.soft_interrupts }}\n
\n
\n
\n
syscal:
\n
\n {{ statsCpu.syscalls }}\n
\n
\n
\n
\n
\n');
-$templateCache.put('plugins/diskio.html','
\n
DISK I/O
\n
R/s
\n
W/s
\n\n
IOR/s
\n
IOW/s
\n
\n
\n
{{(disk.alias ? disk.alias : disk.name) | min_size}}
\n
{{disk.bitrate.txps }}
\n
{{disk.bitrate.rxps }}
\n\n
{{disk.count.txps }}
\n
{{disk.count.rxps }}
\n
\n');
-$templateCache.put('plugins/docker.html','
CONTAINERS {{ statsDocker.containers.length }} (served by Docker {{ statsDocker.version }})\n\n
\n
\n
Name
\n
Status
\n
CPU%
\n
MEM
\n
IOR/s
\n
IOW/s
\n
RX/s
\n
TX/s
\n
Command
\n
\n
\n
{{ container.name }}
\n
{{ container.status }}
\n
{{ container.cpu | number:1 }}
\n
{{ container.memory | bytes }}
\n
{{ container.ior / container.io_time_since_update | bits }}
\n
{{ container.iow / container.io_time_since_update | bits }}
\n
{{ container.rx / container.net_time_since_update | bits }}
\n
{{ container.tx / container.net_time_since_update | bits }}
\n
{{ container.command }}
\n
\n
\n');
-$templateCache.put('plugins/folders.html','
\n
\n
{{ folder.path }}
\n
{{ folder.size | bytes }}
\n
\n');
-$templateCache.put('plugins/fs.html','
\n
FILE SYS
\n
\n Used\n Free\n
\n
Total
\n
\n
\n
{{ fs.shortMountPoint }} ({{ fs.name }})
\n
\n {{ fs.used | bytes }}\n {{ fs.free | bytes }}\n
\n
{{ fs.size | bytes }}
\n
\n');
-$templateCache.put('plugins/gpu.html','
\n {{ statsGpu.name }}\n
\n
\n
\n
proc:
\n
{{ statsGpu.mean.proc | number : 0 }}%
\n
N/A
\n
\n
\n
mem:
\n
{{ statsGpu.mean.mem | number : 0 }}%
\n
N/A
\n
\n
\n
\n {{ gpu.gpu_id }}:\n {{ gpu.proc | number : 0 }}%\n N/A\n mem:\n {{ gpu.mem | number : 0 }}%\n N/A\n
\n
\n
\n');
-$templateCache.put('plugins/ip.html',' -
IP {{ statsIp.address }}/{{ statsIp.maskCidr }} Pub {{ statsIp.publicAddress }}\n');
-$templateCache.put('plugins/irq.html','
\n
\n
{{irq.irq_line}}
\n
\n
{{irq.irq_rate}}
\n
\n');
-$templateCache.put('plugins/load.html','
\n
\n
LOAD
\n
{{ statsLoad.cpucore }}-core
\n
\n
\n
1 min:
\n
\n {{ statsLoad.min1 | number : 2}}\n
\n
\n
\n
5 min:
\n
\n {{ statsLoad.min5 | number : 2}}\n
\n
\n
\n
15 min:
\n
\n {{ statsLoad.min15 | number : 2}}\n
\n
\n
\n');
-$templateCache.put('plugins/mem.html','
\n
\n
MEM
\n
{{ statsMem.percent }}%
\n
\n
\n
total:
\n
{{ statsMem.total | bytes }}
\n
\n
\n
used:
\n
\n {{ statsMem.used | bytes:2 }}\n
\n
\n
\n
free:
\n
{{ statsMem.free | bytes }}
\n
\n
\n');
-$templateCache.put('plugins/mem_more.html','
\n
\n
active:
\n
{{ statsMem.active | bytes }}
\n
\n
\n
inactive:
\n
{{ statsMem.inactive | bytes }}
\n
\n
\n
buffers:
\n
{{ statsMem.buffers | bytes }}
\n
\n
\n
cached:
\n
{{ statsMem.cached | bytes }}
\n
\n
\n');
-$templateCache.put('plugins/memswap.html','
\n
\n
SWAP
\n
{{ statsMemSwap.percent }}%
\n
\n
\n
total:
\n
{{ statsMemSwap.total | bytes }}
\n
\n
\n
used:
\n
\n {{ statsMemSwap.used | bytes }}\n
\n
\n
\n
free:
\n
{{ statsMemSwap.free | bytes }}
\n
\n
\n');
-$templateCache.put('plugins/network.html','
\n
NETWORK
\n
Rx/s
\n
Tx/s
\n\n
\n
Rx+Tx/s
\n\n
Rx
\n
Tx
\n\n
\n
Rx+Tx
\n
\n
\n
{{ network.interfaceName | min_size }}
\n
{{ arguments.byte ? (network.rx / network.time_since_update | bytes) : (network.rx / network.time_since_update | bits) }}
\n
{{ arguments.byte ? (network.tx / network.time_since_update | bytes) : (network.tx / network.time_since_update | bits) }}
\n\n
\n
{{ arguments.byte ? (network.cx / network.time_since_update | bytes) : (network.cx / network.time_since_update | bits) }}
\n\n
{{ arguments.byte ? (network.cumulativeRx | bytes) : (network.cumulativeRx | bits) }}
\n
{{ arguments.byte ? (network.cumulativeTx | bytes) : (network.cumulativeTx | bits) }}
\n\n
\n
{{ arguments.byte ? (network.cumulativeCx | bytes) : (network.cumulativeCx | bits) }}
\n
\n');
-$templateCache.put('plugins/per_cpu.html','
\n
\n
PER CPU
\n
{{ percpu.total }}%
\n
\n
\n
user:
\n
\n {{ percpu.user }}%\n
\n
\n
\n
system:
\n
\n {{ percpu.system }}%\n
\n
\n
\n
idle:
\n
{{ percpu.idle }}%
\n
\n
\n
iowait:
\n
\n {{ percpu.iowait }}%\n
\n
\n
\n
steal:
\n
\n {{ percpu.steal }}%\n
\n
\n
\n');
-$templateCache.put('plugins/ports.html','
\n
{{(port.description ? port.description : port.host + \' \' + port.port) | min_size: 20}}
\n
\n
\n Scanning\n Timeout\n Open\n {{port.status * 1000.0 | number:0}}ms\n
\n
\n');
-$templateCache.put('plugins/processcount.html','
TASKS\n
{{ statsProcessCount.total }} ({{ statsProcessCount.thread }} thr),\n
{{ statsProcessCount.running }} run,\n
{{ statsProcessCount.sleeping }} slp,\n
{{ statsProcessCount.stopped }} oth\n
sorted {{ sorter.auto ? \'automatically\' : \'\' }} by {{ sorter.getColumnLabel(sorter.column) }}, flat view\n');
-$templateCache.put('plugins/processlist.html','
\n
\n
CPU%
\n
MEM%
\n
VIRT
\n
RES
\n
PID
\n
USER
\n
NI
\n
S
\n
TIME+
\n
IOR/s
\n
IOW/s
\n
Command
\n
\n
\n
{{process.cpu_percent | number:1}}
\n
{{process.memory_percent | number:1}}
\n
{{process.memvirt | bytes}}
\n
{{process.memres | bytes}}
\n
{{process.pid}}
\n
{{process.username}}
\n
{{process.nice | exclamation}}
\n
{{process.status}}
\n
\n {{ process.timeplus.hours }}h{{ process.timeplus.minutes | leftPad:2:\'0\' }}:{{ process.timeplus.seconds | leftPad:2:\'0\' }}.{{ process.timeplus.milliseconds | leftPad:2:\'0\' }}\n
\n
{{process.ioRead}}
\n
{{process.ioWrite}}
\n
{{process.name}}
\n
{{process.cmdline}}
\n
\n
\n');
-$templateCache.put('plugins/quicklook.html','
\n {{ statsQuicklook.cpu_name }}\n
\n
\n
\n
CPU
\n
\n
\n {{ statsQuicklook.cpu }}%\n
\n
\n
\n
CPU{{ percpu.number }}
\n
\n
\n {{ percpu.total }}%\n
\n
\n
\n
MEM
\n
\n
\n {{ statsQuicklook.mem }}%\n
\n
\n
\n
SWAP
\n
\n
\n {{ statsQuicklook.swap }}%\n
\n
\n
\n');
-$templateCache.put('plugins/raid.html','
\n
RAID disks
\n
Used
\n
Total
\n
\n
\n
\n {{ disk.type | uppercase }} {{ disk.name }}\n
\u2514\u2500 Degraded mode
\n
\u2514\u2500 {{ disk.config }}
\n\n
\u2514\u2500 Status {{ disk.status }}
\n
\n {{ $last ? \'\u2514\u2500\' : \'\u251C\u2500\' }} disk {{ component.number }}: {{ component.name }}\n
\n
\n
{{ disk.used }}
\n
{{ disk.available }}
\n
');
-$templateCache.put('plugins/sensors.html','
\n\n
\n
{{ sensor.label }}
\n
{{ sensor.unit }}
\n
{{ sensor.value }}
\n
\n');
-$templateCache.put('plugins/system.html','
Disconnected from\n
{{ statsSystem.hostname }}\n
({{ statsSystem.humanReadableName }} / {{ statsSystem.os.name }} {{ statsSystem.os.version }})\n
({{ statsSystem.os.name }} {{ statsSystem.os.version }} {{ statsSystem.platform }})');
-$templateCache.put('plugins/uptime.html','
Uptime: {{ statsUptime.uptime }}\n');
-$templateCache.put('plugins/wifi.html','
\n
\n
{{ hotspot.ssid|limitTo:20 }} {{ hotspot.encryption_type }}
\n
\n
{{ hotspot.signal }}
\n
\n');}]);
\ No newline at end of file
+angular.module('glancesApp').run(['$templateCache', function($templateCache) {$templateCache.put('components/glances/view.html','
\n\n
\n\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n\n
\n');
+$templateCache.put('components/plugin-ip/view.html','
\n - IP {{ vm.address }}/{{ vm.maskCidr }} Pub {{ vm.publicAddress }}\n\n');
+$templateCache.put('components/plugin-system/view.html','
\n Disconnected from\n {{ vm.hostname }}\n ({{ vm.humanReadableName }} / {{ vm.os.name }} {{ vm.os.version }})\n ({{ vm.os.name }} {{ vm.os.version }} {{ vm.platform }})\n\n');
+$templateCache.put('components/plugin-uptime/view.html','
\n Uptime: {{ vm.value }}\n\n');}]);
\ No newline at end of file
diff --git a/glances/outputs/static/public/stats.html b/glances/outputs/static/public/stats.html
index 7982ad15..ad2c1531 100644
--- a/glances/outputs/static/public/stats.html
+++ b/glances/outputs/static/public/stats.html
@@ -1,88 +1 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
PROCESSES DISABLED (press 'z' to display)
-
-
-
+