From 758ac41648b8454a0572c4d568227d23027e3f92 Mon Sep 17 00:00:00 2001 From: Karl Gutwin Date: Wed, 12 Aug 2015 16:37:19 -0400 Subject: [PATCH] Color and edge cleanup --- .../containersNetworkController.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/components/containersNetwork/containersNetworkController.js b/app/components/containersNetwork/containersNetworkController.js index 63946139a..8d901e311 100644 --- a/app/components/containersNetwork/containersNetworkController.js +++ b/app/components/containersNetwork/containersNetworkController.js @@ -43,12 +43,19 @@ angular.module('containersNetwork', ['ngVis']) "
  • ID: " + container.Id + "
  • " + "
  • Image: " + container.Image + "
  • " + "", - color: (container.Running ? "cyan" : "gray") + color: (container.Running ? "#8888ff" : "#cccccc") }); }; - this.addLinkEdgeIfExists = function(from, to) { - if (from.Links != null && from.Links[to.Name] != null) { + this.hasEdge = function(from, to) { + return this.edges.getIds({ + filter: function (item) { + return item.from == from.Id && item.to == to.Id; + } }); + }; + + this.addLinkEdgeIfExists = function(from, to) { + if (from.Links != null && from.Links[to.Name] != null && !this.hasEdge(from, to)) { this.edges.add({ from: from.Id, to: to.Id, @@ -57,7 +64,7 @@ angular.module('containersNetwork', ['ngVis']) }; this.addVolumeEdgeIfExists = function(from, to) { - if (from.VolumesFrom != null && (from.VolumesFrom[to.Id] != null || from.VolumesFrom[to.Name] != null)) { + if (from.VolumesFrom != null && (from.VolumesFrom[to.Id] != null || from.VolumesFrom[to.Name] != null) && !this.hasEdge(from, to)) { this.edges.add({ from: from.Id, to: to.Id,