Fix network stats error for 1.9.0+ clients, hide networks and volumes better on older clients.

pull/2/head
Kevan Ahlquist 2016-01-10 21:51:51 -06:00
parent 22d35eb32f
commit 9d1193c0b5
4 changed files with 10 additions and 4 deletions

View File

@ -7,8 +7,8 @@
<li><a href="#/containers/">Containers</a></li>
<li><a href="#/containers_network/">Containers Network</a></li>
<li><a href="#/images/">Images</a></li>
<li><a href="#/networks/" ng-if="showNetworksVolumes">Networks</a></li>
<li><a href="#/volumes/" ng-if="showNetworksVolumes">Volumes</a></li>
<li ng-if="showNetworksVolumes"><a href="#/networks/">Networks</a></li>
<li ng-if="showNetworksVolumes"><a href="#/volumes/">Volumes</a></li>
<li><a href="#/info/">Info</a></li>
</ul>
</div>

View File

@ -11,5 +11,5 @@ angular.module('masthead', [])
$scope.refresh = function() {
location.reload();
}
};
}]);

View File

@ -44,7 +44,7 @@
</div>
</div>
<h1>Network</h1>
<h1>Network {{ networkName}}</h1>
<div class="row">
<div class="col-sm-7">
<canvas id="network-stats-chart" width="650" height="300"></canvas>

View File

@ -138,6 +138,12 @@ angular.module('stats', [])
var lastRxBytes = 0, lastTxBytes = 0;
function updateNetworkChart(data) {
// 1.9+ contains an object of networks, for now we'll just show stats for the first network
// TODO: Show graphs for all networks
if (data.networks) {
$scope.networkName = Object.keys(data.networks)[0];
data.network = data.networks[$scope.networkName];
}
var rxBytes = 0, txBytes = 0;
if (lastRxBytes !== 0 || lastTxBytes !== 0) {
// These will be zero on first call, ignore to prevent large graph spike