From 9d1193c0b5c7bb48736fa1c4d3129d19baaa6112 Mon Sep 17 00:00:00 2001 From: Kevan Ahlquist Date: Sun, 10 Jan 2016 21:51:51 -0600 Subject: [PATCH] Fix network stats error for 1.9.0+ clients, hide networks and volumes better on older clients. --- app/components/masthead/masthead.html | 4 ++-- app/components/masthead/mastheadController.js | 2 +- app/components/stats/stats.html | 2 +- app/components/stats/statsController.js | 6 ++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/components/masthead/masthead.html b/app/components/masthead/masthead.html index 0e358e7cb..e17808c11 100644 --- a/app/components/masthead/masthead.html +++ b/app/components/masthead/masthead.html @@ -7,8 +7,8 @@
  • Containers
  • Containers Network
  • Images
  • -
  • Networks
  • -
  • Volumes
  • +
  • Networks
  • +
  • Volumes
  • Info
  • diff --git a/app/components/masthead/mastheadController.js b/app/components/masthead/mastheadController.js index 713ff8bf3..579ef6e5a 100644 --- a/app/components/masthead/mastheadController.js +++ b/app/components/masthead/mastheadController.js @@ -11,5 +11,5 @@ angular.module('masthead', []) $scope.refresh = function() { location.reload(); - } + }; }]); diff --git a/app/components/stats/stats.html b/app/components/stats/stats.html index 71f3a2fa0..fa47be6a0 100644 --- a/app/components/stats/stats.html +++ b/app/components/stats/stats.html @@ -44,7 +44,7 @@ -

    Network

    +

    Network {{ networkName}}

    diff --git a/app/components/stats/statsController.js b/app/components/stats/statsController.js index 40d0b4159..38fb08de6 100644 --- a/app/components/stats/statsController.js +++ b/app/components/stats/statsController.js @@ -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