Topo2 - Updated host details panel to handle hosts without lat and long
JIRA Tasks; ONOS-6280
Change-Id: I75f07ee9a8ce37823d94db6276c61173a3913167
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js
index eca6750..8aaf152 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2HostsPanel.js
@@ -33,18 +33,24 @@
}
function formatHostData(data) {
- return {
+ var format = {
title: data.get('id'),
- propOrder: ['MAC', 'IP', 'VLAN', '-', 'Latitude', 'Longitude'],
+ propOrder: ['MAC', 'IP', 'VLAN'],
props: {
'-': '',
'MAC': data.get('id'),
'IP': data.get('ips')[0],
- 'VLAN': 'None', // TODO: VLAN is not currently in the data received from backend
- 'Latitude': data.get('location').lat,
- 'Longitude': data.get('location').lng
+ 'VLAN': 'None' // TODO: VLAN is not currently in the data received from backend
}
};
+
+ if (data.get('location')) {
+ format.propOrder.push('-', 'Latitude', 'Longitude');
+ format.props['Latitude'] = data.get('location').lat;
+ format.props['Longitude'] = data.get('location').lng;
+ }
+
+ return format;
}
function displayPanel(data) {