From 701e9138f424e16a3e4f6a0f60ec448cec25e6e8 Mon Sep 17 00:00:00 2001 From: Floran Brutel Date: Sun, 23 Aug 2015 00:10:46 +0200 Subject: [PATCH] Add network cumulative/combination in the webui Handle cumulative and combination mode for network I/O Fix shortcuts for cumulative and combination Use bit/s for network I/O --- .../outputs/static/html/plugins/network.html | 28 +++++++++++++++---- .../js/services/plugins/glances_network.js | 6 +++- glances/outputs/static/js/stats_controller.js | 8 +++--- glances/outputs/static/js/variables.js | 3 +- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/glances/outputs/static/html/plugins/network.html b/glances/outputs/static/html/plugins/network.html index 409ec86b..bfe5d0ca 100644 --- a/glances/outputs/static/html/plugins/network.html +++ b/glances/outputs/static/html/plugins/network.html @@ -1,12 +1,28 @@
NETWORK
-
Rx/s
-
Tx/s
+
Rx/s
+
Tx/s
+ +
+
Rx+Tx/s
+ +
Rx
+
Tx
+ +
+
Rx+Tx
{{ network.interfaceName | min_size }}
-
{{ network.rx | bytes }}
-
{{ network.tx | bytes }}
-
{{ network.rx | bits }}
-
{{ network.tx | bits }}
+
{{ show.network_by_bytes ? (network.rx|bytes) : (network.rx|bits) }}
+
{{ show.network_by_bytes ? (network.tx|bytes) : (network.tx|bits) }}
+ +
+
{{ show.network_by_bytes ? (network.cx|bytes) : (network.cx|bits) }}
+ +
{{ show.network_by_bytes ? (network.cumulativeRx|bytes) : (network.cumulativeRx|bits) }}
+
{{ show.network_by_bytes ? (network.cumulativeTx|bytes) : (network.cumulativeTx|bits) }}
+ +
+
{{ show.network_by_bytes ? (network.cumulativeCx|bytes) : (network.cumulativeCx|bits) }}
diff --git a/glances/outputs/static/js/services/plugins/glances_network.js b/glances/outputs/static/js/services/plugins/glances_network.js index 1068bb6e..00a21f47 100644 --- a/glances/outputs/static/js/services/plugins/glances_network.js +++ b/glances/outputs/static/js/services/plugins/glances_network.js @@ -11,7 +11,11 @@ glancesApp.service('GlancesPluginNetwork', function() { var network = { 'interfaceName': networkData['interface_name'], 'rx': networkData['rx'], - 'tx': networkData['tx'] + 'tx': networkData['tx'], + 'cx': networkData['cx'], + 'cumulativeRx': networkData['cumulative_rx'], + 'cumulativeTx': networkData['cumulative_tx'], + 'cumulativeCx': networkData['cumulative_cx'] }; this.networks.push(network); diff --git a/glances/outputs/static/js/stats_controller.js b/glances/outputs/static/js/stats_controller.js index b0a57b78..d9ddc5f6 100644 --- a/glances/outputs/static/js/stats_controller.js +++ b/glances/outputs/static/js/stats_controller.js @@ -32,7 +32,7 @@ glancesApp.controller('statsController', function ($scope, $interval, $routePara 'network_io_combination': false, 'network_io_cumulative': false, 'filesystem_freespace': false, - 'network_by_bytes': true + 'network_by_bytes': false }; $scope.init_refresh_time = function () { @@ -132,10 +132,10 @@ glancesApp.controller('statsController', function ($scope, $interval, $routePara } else if ($event.keyCode == keycodes.i) {//i Sort processes by I/O rate $scope.sorter.column = ['io_read', 'io_write']; $scope.sorter.auto = false; - } else if ($event.keyCode == keycodes.t) {//t Sort processes by CPU times + } else if ($event.keyCode == keycodes.t && !$event.shiftKey) {//t Sort processes by CPU times $scope.sorter.column = "timemillis"; $scope.sorter.auto = false; - } else if ($event.keyCode == keycodes.u) {//t Sort processes by user + } else if ($event.keyCode == keycodes.u && !$event.shiftKey) {//t Sort processes by user $scope.sorter.column = "username"; $scope.sorter.auto = false; } else if ($event.keyCode == keycodes.d) {//d Show/hide disk I/O stats @@ -170,7 +170,7 @@ glancesApp.controller('statsController', function ($scope, $interval, $routePara $scope.show_hide('help') } else if ($event.keyCode == keycodes.T && $event.shiftKey) {//T View network I/O as combination $scope.show_hide('network_io_combination') - } else if ($event.keyCode == keycodes.u) {//u View cumulative network I/O + } else if ($event.keyCode == keycodes.u && $event.shiftKey) {//U View cumulative network I/O $scope.show_hide('network_io_cumulative') } else if ($event.keyCode == keycodes.F && $event.shiftKey) {//F Show filesystem free space $scope.show_hide('filesystem_freespace') diff --git a/glances/outputs/static/js/variables.js b/glances/outputs/static/js/variables.js index 6537b500..6ee1f175 100644 --- a/glances/outputs/static/js/variables.js +++ b/glances/outputs/static/js/variables.js @@ -10,7 +10,6 @@ var keycodes = { 'f' : '70', 'n' : '78', 's' : '83', - 'TWO': '50', 'z' : '90', 'e' : '69', 'SLASH': '191', @@ -20,9 +19,9 @@ var keycodes = { 'w' : '87', 'x' : '88', 'ONE': '49', + 'TWO': '50', 'h' : '72', 'T' : '84', - 'u' : '85', 'F' : '70', 'g' : '71', 'r' : '82',