From 85a07237b1d435984cb8d70783e8721b530b7345 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Mon, 13 Feb 2017 22:39:02 +1300 Subject: [PATCH] =?UTF-8?q?feat(swarm):=20display=20the=20IP=20address=20o?= =?UTF-8?q?f=20each=20node=20when=20API=20Version=20>=3D=20=E2=80=A6=20(#5?= =?UTF-8?q?95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/swarm/swarm.html | 56 ++++++++++++++----------- app/components/swarm/swarmController.js | 4 +- app/models/node.js | 4 ++ 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/app/components/swarm/swarm.html b/app/components/swarm/swarm.html index 661dbd710..5bead69b7 100644 --- a/app/components/swarm/swarm.html +++ b/app/components/swarm/swarm.html @@ -163,57 +163,65 @@ - + Name - - + + - + Role - - + + - + CPU - - + + - + Memory - - + + - + Engine - - + + + + + + + IP Address + + - + Status - - + + - {{ node.Description.Hostname }} - {{ node.Spec.Role }} - {{ node.Description.Resources.NanoCPUs / 1000000000 }} - {{ node.Description.Resources.MemoryBytes|humansize }} - {{ node.Description.Engine.EngineVersion }} - {{ node.Status.State }} + {{ node.Hostname }} + {{ node.Role }} + {{ node.CPUs / 1000000000 }} + {{ node.Memory|humansize }} + {{ node.EngineVersion }} + {{ node.Addr }} + {{ node.Status }} diff --git a/app/components/swarm/swarmController.js b/app/components/swarm/swarmController.js index 713db07ef..4855caf69 100644 --- a/app/components/swarm/swarmController.js +++ b/app/components/swarm/swarmController.js @@ -28,7 +28,9 @@ function ($scope, Info, Version, Node, Pagination) { $scope.info = d; if ($scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE') { Node.query({}, function(d) { - $scope.nodes = d; + $scope.nodes = d.map(function (node) { + return new NodeViewModel(node); + }); var CPU = 0, memory = 0; angular.forEach(d, function(node) { CPU += node.Description.Resources.NanoCPUs; diff --git a/app/models/node.js b/app/models/node.js index 49aab6a13..1362d0885 100644 --- a/app/models/node.js +++ b/app/models/node.js @@ -27,6 +27,10 @@ function NodeViewModel(data) { this.Plugins = data.Description.Engine.Plugins; this.Status = data.Status.State; + if (data.Status.Addr) { + this.Addr = data.Status.Addr; + } + if (data.ManagerStatus) { this.Leader = data.ManagerStatus.Leader; this.Reachability = data.ManagerStatus.Reachability;