ONOS-2470: Implement "Reset Node Locations" function in topology view.
- also cleaned up some Long/Lat code.
- Note also that metadata from client is structured so 'lng/lat' properties
(from repositioned node) are wrapped in 'equivLoc' object.
Change-Id: I5afc53d26ef56fc0932f8650e8f7df79b36c3947
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 21137af..8508f85 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -455,10 +455,17 @@
ll;
// if we are not clearing the position data (unpinning),
- // attach the x, y, longitude, latitude...
+ // attach the x, y, (and equivalent longitude, latitude)...
if (!clearPos) {
ll = tms.lngLatFromCoord([d.x, d.y]);
- metaUi = {x: d.x, y: d.y, lng: ll[0], lat: ll[1]};
+ metaUi = {
+ x: d.x,
+ y: d.y,
+ equivLoc: {
+ lng: ll[0],
+ lat: ll[1]
+ }
+ };
}
d.metaUi = metaUi;
wss.sendEvent('updateMeta', {
@@ -580,6 +587,13 @@
$timeout(updateLinks, 2000);
}
+ function resetAllLocations() {
+ tms.resetAllLocations();
+ updateNodes();
+ tick(); // force nodes to be redrawn in their new locations
+ flash.flash('Reset Node Locations');
+ }
+
// ==========================================
function updateNodes() {
@@ -1169,6 +1183,7 @@
showMastership: showMastership,
showBadLinks: showBadLinks,
+ resetAllLocations: resetAllLocations,
addDevice: addDevice,
updateDevice: updateDevice,
removeDevice: removeDevice,