ONOS-5784: Empty latitude/longitude in ONOS Web UI
- (part one)
- Enhanced HostManager to react to NetworkConfigEvents such that
it applies annotations to relevant host instances from the
config data.
- A little refactoring in DeviceManager.
- Updated topoModel.js to use updated field names latOrY/longOrX.
Change-Id: I06536a6b2279291ffe638549a80b56a9fe94f48a
(cherry picked from commit 78193fd06661a7fa524c8b3a8fa7ddb69d7437c9)
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 887635d..3236ae5 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoModel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoModel.js
@@ -47,8 +47,7 @@
function coordFromLngLat(loc) {
var p = api.projection();
- // suspected cause of ONOS-2109
- return p ? p([loc.lng, loc.lat]) : [0, 0];
+ return p ? p([loc.longOrX, loc.latOrY]) : [0, 0];
}
function lngLatFromCoord(coord) {
@@ -115,7 +114,7 @@
var loc = node.location,
coord;
- if (loc && loc.type === 'geo') {
+ if (loc && loc.locType === 'geo') {
coord = coordFromLngLat(loc);
node.fixed = true;
node.px = node.x = coord[0];
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoModel-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoModel-spec.js
index e9f63f6..d1db42a 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoModel-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoModel-spec.js
@@ -33,9 +33,9 @@
mock: 'yup'
};
- // to mock out the [lng,lat] <=> [x,y] transformations, we will
+ // to mock out the [longOrX,latOrY] <=> [x,y] transformations, we will
// add/subtract 2000, 3000 respectively:
- // lng:2005 === x:5, lat:3004 === y:4
+ // longOrX:2005 === x:5, latOrY:3004 === y:4
var mockProjection = function (lnglat) {
return [lnglat[0] - 2000, lnglat[1] - 3000];
@@ -199,7 +199,7 @@
});
it('should install the mock projection', function () {
- expect(tms.coordFromLngLat({lng: 2005, lat: 3004})).toEqual([5,4]);
+ expect(tms.coordFromLngLat({longOrX: 2005, latOrY: 3004})).toEqual([5,4]);
expect(tms.lngLatFromCoord([5,4])).toEqual([2005,3004]);
});
@@ -232,9 +232,9 @@
it('should position a node by translating lng/lat', function () {
var node = {
location: {
- type: 'geo',
- lng: 2008,
- lat: 3009
+ locType: 'geo',
+ longOrX: 2008,
+ latOrY: 3009
}
};
tms.positionNode(node);
@@ -319,9 +319,9 @@
type: 'yowser',
online: true,
location: {
- type: 'geo',
- lng: 2048,
- lat: 3096
+ locType: 'geo',
+ longOrX: 2048,
+ latOrY: 3096
}
});
expect(node).toBePositionedAt([48,96]);