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
pull/658/head
Floran Brutel 2015-08-23 00:10:46 +02:00
parent 3d3f6b09d0
commit 701e9138f4
4 changed files with 32 additions and 13 deletions

View File

@ -1,12 +1,28 @@
<div class="table-row">
<div class="table-cell text-left title">NETWORK</div>
<div class="table-cell">Rx/s</div>
<div class="table-cell">Tx/s</div>
<div class="table-cell" ng-show="!show.network_io_cumulative && !show.network_io_combination">Rx/s</div>
<div class="table-cell" ng-show="!show.network_io_cumulative && !show.network_io_combination">Tx/s</div>
<div class="table-cell" ng-show="!show.network_io_cumulative && show.network_io_combination"></div>
<div class="table-cell" ng-show="!show.network_io_cumulative && show.network_io_combination">Rx+Tx/s</div>
<div class="table-cell" ng-show="show.network_io_cumulative && !show.network_io_combination">Rx</div>
<div class="table-cell" ng-show="show.network_io_cumulative && !show.network_io_combination">Tx</div>
<div class="table-cell" ng-show="show.network_io_cumulative && show.network_io_combination"></div>
<div class="table-cell" ng-show="show.network_io_cumulative && show.network_io_combination">Rx+Tx</div>
</div>
<div class="table-row" ng-repeat="network in statsNetwork.networks | orderBy: 'interfaceName'">
<div class="table-cell text-left">{{ network.interfaceName | min_size }}</div>
<div class="table-cell" ng-show="show.network_by_bytes">{{ network.rx | bytes }}</div>
<div class="table-cell" ng-show="show.network_by_bytes">{{ network.tx | bytes }}</div>
<div class="table-cell" ng-show="!show.network_by_bytes">{{ network.rx | bits }}</div>
<div class="table-cell" ng-show="!show.network_by_bytes">{{ network.tx | bits }}</div>
<div class="table-cell" ng-show="!show.network_io_cumulative && !show.network_io_combination">{{ show.network_by_bytes ? (network.rx|bytes) : (network.rx|bits) }}</div>
<div class="table-cell" ng-show="!show.network_io_cumulative && !show.network_io_combination">{{ show.network_by_bytes ? (network.tx|bytes) : (network.tx|bits) }}</div>
<div class="table-cell" ng-show="!show.network_io_cumulative && show.network_io_combination"></div>
<div class="table-cell" ng-show="!show.network_io_cumulative && show.network_io_combination">{{ show.network_by_bytes ? (network.cx|bytes) : (network.cx|bits) }}</div>
<div class="table-cell" ng-show="show.network_io_cumulative && !show.network_io_combination">{{ show.network_by_bytes ? (network.cumulativeRx|bytes) : (network.cumulativeRx|bits) }}</div>
<div class="table-cell" ng-show="show.network_io_cumulative && !show.network_io_combination">{{ show.network_by_bytes ? (network.cumulativeTx|bytes) : (network.cumulativeTx|bits) }}</div>
<div class="table-cell" ng-show="show.network_io_cumulative && show.network_io_combination"></div>
<div class="table-cell" ng-show="show.network_io_cumulative && show.network_io_combination">{{ show.network_by_bytes ? (network.cumulativeCx|bytes) : (network.cumulativeCx|bits) }}</div>
</div>

View File

@ -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);

View File

@ -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')

View File

@ -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',