From 8e0baf0e378a2af1971a7a55728f42d80c938976 Mon Sep 17 00:00:00 2001 From: Karl Gutwin Date: Wed, 12 Aug 2015 16:01:33 -0400 Subject: [PATCH] Optionally include stopped containers --- .../containersNetwork/containersNetwork.html | 1 + .../containersNetworkController.js | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/components/containersNetwork/containersNetwork.html b/app/components/containersNetwork/containersNetwork.html index e9bce03de..f213de493 100644 --- a/app/components/containersNetwork/containersNetwork.html +++ b/app/components/containersNetwork/containersNetwork.html @@ -15,6 +15,7 @@ +
" + "
  • ID: " + container.Id + "
  • " + "
  • Image: " + container.Image + "
  • " + - ""}); + "", + color: (container.State.Running ? null : "gray") + }); }; this.addLinkEdgeIfExists = function(from, to) { @@ -240,10 +242,19 @@ angular.module('containersNetwork', ['ngVis']) $scope.network.addContainer(container); }; - Container.query({all: 0}, function(d) { - for (var i = 0; i < d.length; i++) { - Container.get({id: d[i].Id}, addContainer, showFailure); - } - }); - + var update = function (data) { + Container.query(data, function(d) { + for (var i = 0; i < d.length; i++) { + Container.get({id: d[i].Id}, addContainer, showFailure); + } + }); + }; + update({all: 0}); + + $scope.includeStopped = false; + $scope.toggleIncludeStopped = function() { + $scope.network.updateShownContainers([]); + update({all: $scope.includeStopped ? 1 : 0}); + }; + }]);