Topo2: Enhanced link width uses scale to set the width

Change-Id: I80ba00bfc1e2a238ef593de0d99dd6552c5041c5
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css b/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css
index cdd84b3..a9ba89e 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2-theme.css
@@ -283,7 +283,6 @@
 
 #ov-topo2 svg .link.selected,
 #ov-topo2 svg .link.enhanced {
-    stroke-width: 3.5;
     stroke: #009fdb;
 }
 
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Link.js b/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
index d68b689..37affce 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Link.js
@@ -209,6 +209,7 @@
             unenhance: function () {
                 this.set('enhanced', false);
                 d3.select('.topo2-portLabels').selectAll('.portLabel').remove();
+                this.setScale();
             },
             amt: function (numLinks, index) {
                 var gap = 6;
@@ -283,7 +284,6 @@
                 }
             },
             locatePortLabel: function (src) {
-
                 var offset = 32 / (labelDim * t2zs.scale()),
                     sourceX = this.get('position').x1,
                     sourceY = this.get('position').y1,
@@ -300,7 +300,7 @@
 
                 var dx = farX - nearX,
                     dy = farY - nearY,
-                    k = ((20 * t2zs.scale()) * offset) / dist(dx, dy);
+                    k = (32 * offset) / dist(dx, dy);
 
                 return { x: k * dx + nearX, y: k * dy + nearY };
             },
@@ -322,7 +322,9 @@
 
                 if (!this.el) return;
 
-                var width = linkScale(widthRatio) / t2zs.scale();
+                var linkWidthRatio = this.get('enhanced') ? 3.5 : widthRatio;
+
+                var width = linkScale(linkWidthRatio) / t2zs.scale();
                 this.el.attr('stroke-width', width + 'px');
 
                 var labelScale = labelDim / (labelDim * t2zs.scale());
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Region.js b/web/gui/src/main/webapp/app/view/topo2/topo2Region.js
index f471e85..643aaa5 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Region.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Region.js
@@ -120,7 +120,12 @@
                             deviceConnections[key] = [];
                         }
 
-                        deviceConnections[key].push(link);
+                        // TODO: Investigate why region contains dup links?!?!
+                        // FIXME: This shouldn't be needed - The backend is sending dups
+                        //        and this is preventing the client thinking its a multilink
+                        if (deviceConnections[key].indexOf(link) > -1) {
+                            deviceConnections[key].push(link);
+                        }
                     });
 
                     _.each(deviceConnections, function (connection) {