Fixed Topo-2 summary and details panels, which were broken from recent
changes made in "classic" topo, to support localization.
Change-Id: I3f5eacc2e792aada63b36da4cb50233e5d593cf2
diff --git a/web/gui/src/main/webapp/app/fw/widget/listBuilder.js b/web/gui/src/main/webapp/app/fw/widget/listBuilder.js
index 8dc5053..0c6df5d 100644
--- a/web/gui/src/main/webapp/app/fw/widget/listBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/listBuilder.js
@@ -43,13 +43,19 @@
}
function listProps(el, data) {
+ var sepLast = false;
+
+ // note: track whether we end with a separator or not...
data.propOrder.forEach(function (p) {
if (p === '-') {
addSep(el);
+ sepLast = true;
} else {
- addProp(el, p, data.props[p]);
+ addProp(el, data.propLabels[p], data.propValues[p]);
+ sepLast = false;
}
});
+ return sepLast;
}
angular.module('onosWidget')
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
index bcf0469..4ee1205 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
@@ -101,6 +101,7 @@
}
function renderSingle(data) {
+ var endedWithSeparator;
detailsPanel.emptyRegions();
@@ -120,12 +121,11 @@
gs.addGlyph(svg, (data.type || 'unknown'), 26);
title.text(data.title);
- if (!data.props.Latitude) {
- var locationIndex = data.propOrder.indexOf('Latitude');
- data.propOrder.splice(locationIndex - 1, 3);
- }
+ // TODO: add navigation hot-link if defined
+ // See topoPanel.js for equivalent code in "classic" topo
- ls.listProps(tbody, data);
+ endedWithSeparator = ls.listProps(tbody, data);
+ // TODO : review whether we need to use/store end-with-sep state
addBtnFooter();
}
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js
index 070c6f2..bbfd808 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2SubRegionPanel.js
@@ -35,14 +35,27 @@
function formatSubRegionData(data) {
return {
title: data.get('name'),
- propOrder: ['Id', 'Type', '-', 'Number of Devices', 'Number of Hosts'],
- props: {
- '-': '',
- 'Id': data.get('id'),
- 'Type': data.get('nodeType'),
- 'Number of Devices': data.get('nDevs'),
- 'Number of Hosts': data.get('nHosts'),
+ propLabels: {
+ '-': '-',
+ 'id': 'Id',
+ 'nodeType': 'Type',
+ 'nDevs': '# Devices',
+ 'nHosts': '# Hosts',
},
+ propValues: {
+ '-': '-',
+ 'id': data.get('id'),
+ 'nodeType': data.get('nodeType'),
+ 'nDevs': data.get('nDevs'),
+ 'nHosts': data.get('nHosts'),
+ },
+ propOrder: [
+ 'id',
+ 'nodeType',
+ '-',
+ 'nDevs',
+ 'nHosts',
+ ],
};
}
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
index 24785f7..6cdf3fe 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
@@ -55,6 +55,8 @@
}
function render() {
+ var endedWithSeparator;
+
summaryPanel.emptyRegions();
var svg = summaryPanel.appendToHeader('div')
@@ -66,7 +68,8 @@
title.text(summaryData.title);
gs.addGlyph(svg, 'bird', 24, 0, [1, 1]);
- ls.listProps(tbody, summaryData);
+ endedWithSeparator = ls.listProps(tbody, summaryData);
+ // TODO : review whether we need to use/store end-with-sep state
}
function handleSummaryData(data) {