Topo2: Place peer regions in their configured locations
JIRA Tasks; ONOS-6257
Change-Id: Ifd6133c1c9ac7f4f7ea5dee54fd38f1ea3382c8b
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
index 86d1faa..1d71212 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2NodePosition.js
@@ -57,7 +57,18 @@
loc = {};
if (t2bgs.getBackgroundType() === 'geo') {
+
+ var loc = node.get('location'),
+ type = loc.locType || loc.type;
+
+ node.set({ location: {
+ type: type.toLowerCase(),
+ lat: loc.latOrY || loc.lat,
+ lng: loc.longOrX || loc.lng
+ }});
+
setLongLat(node);
+
return true;
} else {
loc.gridX = -20;
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 8fbe814..68b1ad1 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Region.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Region.js
@@ -84,6 +84,7 @@
});
this.sortMultiLinks();
+ this.assignPeerLocations();
this.model.set({ subregions: t2sr.createSubRegionCollection(this.regionData.subregions, this) });
this.model.set({ devices: t2ds.createDeviceCollection(this.regionData.devices, this) });
@@ -107,6 +108,16 @@
var regex = new RegExp('^[^/]*');
return regex.exec(key)[0];
},
+ assignPeerLocations: function () {
+ var _this = this;
+ _.each(this.regionData.peerLocations, function (location, id) {
+ _.each(_this.peers, function (peer) {
+ if (peer.id === id) {
+ peer.location = location;
+ }
+ })
+ });
+ },
sortMultiLinks: function () {
var _this = this,
deviceConnections = {};