Simon Hunt
Committed by Gerrit Code Review

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
...@@ -432,6 +432,13 @@ ...@@ -432,6 +432,13 @@
432 opacity: .9; 432 opacity: .9;
433 } 433 }
434 434
435 +.light #ov-topo svg .link.enhanced {
436 + filter: url(#blue-glow);
437 +}
438 +.dark #ov-topo svg .link.enhanced {
439 + filter: url(#yellow-glow);
440 +}
441 +
435 #ov-topo svg .link.inactive { 442 #ov-topo svg .link.inactive {
436 opacity: .5; 443 opacity: .5;
437 stroke-dasharray: 8 4; 444 stroke-dasharray: 8 4;
......
...@@ -332,15 +332,6 @@ ...@@ -332,15 +332,6 @@
332 // ========================== 332 // ==========================
333 // updateLinks - subfunctions 333 // updateLinks - subfunctions
334 334
335 - function linkExisting(d) {
336 - // this is supposed to be an existing link, but we have observed
337 - // occasions (where links are deleted and added rapidly?) where
338 - // the DOM element has not been defined. So protection against that...
339 - if (d.el) {
340 - api.restyleLinkElement(d, true);
341 - }
342 - }
343 -
344 function linkEntering(d) { 335 function linkEntering(d) {
345 var link = d3.select(this); 336 var link = d3.select(this);
346 d.el = link; 337 d.el = link;
...@@ -466,7 +457,6 @@ ...@@ -466,7 +457,6 @@
466 hostExit: hostExit, 457 hostExit: hostExit,
467 deviceExit: deviceExit, 458 deviceExit: deviceExit,
468 459
469 - linkExisting: linkExisting,
470 linkEntering: linkEntering, 460 linkEntering: linkEntering,
471 applyLinkLabels: applyLinkLabels, 461 applyLinkLabels: applyLinkLabels,
472 462
......
...@@ -508,16 +508,23 @@ ...@@ -508,16 +508,23 @@
508 .data(network.links, function (d) { return d.key; }); 508 .data(network.links, function (d) { return d.key; });
509 509
510 // operate on existing links: 510 // operate on existing links:
511 - link.each(td3.linkExisting); 511 + link.each(function (d) {
512 + // this is supposed to be an existing link, but we have observed
513 + // occasions (where links are deleted and added rapidly?) where
514 + // the DOM element has not been defined. So protect against that...
515 + if (d.el) {
516 + restyleLinkElement(d, true);
517 + }
518 + });
512 519
513 // operate on entering links: 520 // operate on entering links:
514 var entering = link.enter() 521 var entering = link.enter()
515 .append('line') 522 .append('line')
516 .attr({ 523 .attr({
517 - x1: function (d) { return d.x1; }, 524 + x1: function (d) { return d.source.x; },
518 - y1: function (d) { return d.y1; }, 525 + y1: function (d) { return d.source.y; },
519 - x2: function (d) { return d.x2; }, 526 + x2: function (d) { return d.target.x; },
520 - y2: function (d) { return d.y2; }, 527 + y2: function (d) { return d.target.y; },
521 stroke: linkConfig[th].inColor, 528 stroke: linkConfig[th].inColor,
522 'stroke-width': linkConfig.inWidth 529 'stroke-width': linkConfig.inWidth
523 }); 530 });
......
...@@ -189,12 +189,12 @@ ...@@ -189,12 +189,12 @@
189 } 189 }
190 190
191 function unenhance(d) { 191 function unenhance(d) {
192 - d.el.style('stroke', '#666'); 192 + d.el.classed('enhanced', false);
193 $log.debug('UN-enhancing link: ', d.key); 193 $log.debug('UN-enhancing link: ', d.key);
194 } 194 }
195 195
196 function enhance(d) { 196 function enhance(d) {
197 - d.el.style('stroke', 'gold'); 197 + d.el.classed('enhanced', true);
198 $log.debug('enhancing link: ', d.key); 198 $log.debug('enhancing link: ', d.key);
199 } 199 }
200 200
......
...@@ -219,10 +219,6 @@ ...@@ -219,10 +219,6 @@
219 return { 219 return {
220 source: srcNode, 220 source: srcNode,
221 target: dstNode, 221 target: dstNode,
222 - x1: srcNode.x,
223 - y1: srcNode.y,
224 - x2: dstNode.x,
225 - y2: dstNode.y
226 }; 222 };
227 } 223 }
228 224
......