ONOS-5403: cleaned up code change to match coding style.
Change-Id: If1ba37d8f4b6d3296a057bbf2dfa042ed2051eab
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 708ff91..a7b5bc7 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoLink.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoLink.js
@@ -117,23 +117,24 @@
minDist = proximity * 2;
network.links.forEach(function (d) {
+ var line = d.position,
+ point,
+ hit,
+ dist;
+
if (!api.showHosts() && d.type() === 'hostLink') {
return; // skip hidden host links
}
- if(d.position != null)
- {
- var line = d.position,
- point = pdrop(line, mouse),
- hit = lineHit(line, point, mouse),
- dist;
- }
-
- if (hit) {
- dist = mdist(point, mouse);
- if (dist < minDist) {
- minDist = dist;
- nearest = d;
+ if (line) {
+ point = pdrop(line, mouse);
+ hit = lineHit(line, point, mouse);
+ if (hit) {
+ dist = mdist(point, mouse);
+ if (dist < minDist) {
+ minDist = dist;
+ nearest = d;
+ }
}
}
});
@@ -225,17 +226,11 @@
tss.deselectAll();
- if(ldata != null)
- {
-
- if (!ldata.el.classed('selected')) {
- selLink(ldata);
- return;
- }
-
+ if (ldata) {
if (ldata.el.classed('selected')) {
unselLink(ldata);
- return;
+ } else {
+ selLink(ldata);
}
}
}
diff --git a/web/gui/src/main/webapp/app/view/topo/topoSelect.js b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
index bdcf244..cfd2fb3 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoSelect.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
@@ -107,18 +107,15 @@
});
}
- if (obj !=null)
- {
- if (obj.class === 'link') {
- if (selections[obj.key]) {
- deselectObject(obj.key);
- } else {
- selections[obj.key] = { obj: obj, el: el };
- selectOrder.push(obj.key);
- }
- updateDetail();
- return;
+ if (obj && obj.class === 'link') {
+ if (selections[obj.key]) {
+ deselectObject(obj.key);
+ } else {
+ selections[obj.key] = { obj: obj, el: el };
+ selectOrder.push(obj.key);
}
+ updateDetail();
+ return;
}
if (!n) {