GUI -- TopoView - Changed link "enhancement" to be addition of glow filter via 'enhanced' CSS class.
- removed unnecessary properties of link data object (delegate to source and target for endpoints).
- removed feature envy for existing links.
Change-Id: I9f96792d5665665a3467e419d80803e1b0db389b
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.css b/web/gui/src/main/webapp/app/view/topo/topo.css
index 12d3beb..5fe9c39 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.css
+++ b/web/gui/src/main/webapp/app/view/topo/topo.css
@@ -432,6 +432,13 @@
opacity: .9;
}
+.light #ov-topo svg .link.enhanced {
+ filter: url(#blue-glow);
+}
+.dark #ov-topo svg .link.enhanced {
+ filter: url(#yellow-glow);
+}
+
#ov-topo svg .link.inactive {
opacity: .5;
stroke-dasharray: 8 4;
diff --git a/web/gui/src/main/webapp/app/view/topo/topoD3.js b/web/gui/src/main/webapp/app/view/topo/topoD3.js
index ced1656..a555ac1 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoD3.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoD3.js
@@ -332,15 +332,6 @@
// ==========================
// updateLinks - subfunctions
- function linkExisting(d) {
- // this is supposed to be an existing link, but we have observed
- // occasions (where links are deleted and added rapidly?) where
- // the DOM element has not been defined. So protection against that...
- if (d.el) {
- api.restyleLinkElement(d, true);
- }
- }
-
function linkEntering(d) {
var link = d3.select(this);
d.el = link;
@@ -466,7 +457,6 @@
hostExit: hostExit,
deviceExit: deviceExit,
- linkExisting: linkExisting,
linkEntering: linkEntering,
applyLinkLabels: applyLinkLabels,
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index 2509290..ea7cada 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -508,16 +508,23 @@
.data(network.links, function (d) { return d.key; });
// operate on existing links:
- link.each(td3.linkExisting);
+ link.each(function (d) {
+ // this is supposed to be an existing link, but we have observed
+ // occasions (where links are deleted and added rapidly?) where
+ // the DOM element has not been defined. So protect against that...
+ if (d.el) {
+ restyleLinkElement(d, true);
+ }
+ });
// operate on entering links:
var entering = link.enter()
.append('line')
.attr({
- x1: function (d) { return d.x1; },
- y1: function (d) { return d.y1; },
- x2: function (d) { return d.x2; },
- y2: function (d) { return d.y2; },
+ x1: function (d) { return d.source.x; },
+ y1: function (d) { return d.source.y; },
+ x2: function (d) { return d.target.x; },
+ y2: function (d) { return d.target.y; },
stroke: linkConfig[th].inColor,
'stroke-width': linkConfig.inWidth
});
diff --git a/web/gui/src/main/webapp/app/view/topo/topoLink.js b/web/gui/src/main/webapp/app/view/topo/topoLink.js
index 6dd4338..2b46f45 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoLink.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoLink.js
@@ -189,12 +189,12 @@
}
function unenhance(d) {
- d.el.style('stroke', '#666');
+ d.el.classed('enhanced', false);
$log.debug('UN-enhancing link: ', d.key);
}
function enhance(d) {
- d.el.style('stroke', 'gold');
+ d.el.classed('enhanced', true);
$log.debug('enhancing link: ', d.key);
}
diff --git a/web/gui/src/main/webapp/app/view/topo/topoModel.js b/web/gui/src/main/webapp/app/view/topo/topoModel.js
index a2fc40b..f7f53a0 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoModel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoModel.js
@@ -219,10 +219,6 @@
return {
source: srcNode,
target: dstNode,
- x1: srcNode.x,
- y1: srcNode.y,
- x2: dstNode.x,
- y2: dstNode.y
};
}