ONOS-6730: Topo View i18n:
- augmented UiMessageHandler base class to allow injection of
localization bundles, so that the handler can look up localized
text when composing data to ship to the client.
- i18n'd the Summary Panel in Topo view.
Change-Id: I15010d1e2fcce72e3133a9ce40e51510c8f5146f
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.css b/web/gui/src/main/webapp/app/view/topo/topo.css
index 540b480..74fe0c6 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.css
+++ b/web/gui/src/main/webapp/app/view/topo/topo.css
@@ -124,8 +124,8 @@
padding: 0;
}
-#topo-p-summary td.label {
- width: 50%;
+#topo-p-summary td.label {
+ width: 65%;
}
#topo-p-detail div.actionBtns {
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.js b/web/gui/src/main/webapp/app/view/topo/topo.js
index 3e9a0cc..ba0bc7d 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -728,6 +728,7 @@
tfs.setLionBundle(topoLion);
tis.setLionBundle(topoLion);
tms.setLionBundle(topoLion);
+ tps.setLionBundle(topoLion);
// now we have the map projection, we are ready for
// the server to send us device/host data...
diff --git a/web/gui/src/main/webapp/app/view/topo/topoInst.js b/web/gui/src/main/webapp/app/view/topo/topoInst.js
index 4e89822..63d49fa 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoInst.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoInst.js
@@ -47,7 +47,7 @@
// function to be replaced by the localization bundle function
var topoLion = function (x) {
- return '#tinst#' + x + '#';
+ return '#tis#' + x + '#';
};
@@ -317,11 +317,6 @@
return on;
}
- // invoked after the localization bundle has been received from the server
- function setLionBundle(bundle) {
- topoLion = bundle;
- }
-
// ==========================
angular.module('ovTopo')
@@ -353,7 +348,7 @@
hide: hideInsts,
toggle: toggleInsts,
showMaster: function () { return oiShowMaster; },
- setLionBundle: setLionBundle,
+ setLionBundle: function (bundle) { topoLion = bundle; },
};
}]);
}());
diff --git a/web/gui/src/main/webapp/app/view/topo/topoPanel.js b/web/gui/src/main/webapp/app/view/topo/topoPanel.js
index b25f02e..eac6a89 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoPanel.js
@@ -25,6 +25,11 @@
// injected refs
var $log, $window, $rootScope, fs, ps, gs, flash, wss, bns, mast, ns;
+ // function to be replaced by the localization bundle function
+ var topoLion = function (x) {
+ return '#tps#' + x + '#';
+ };
+
// constants
var pCls = 'topo-p',
idSum = 'topo-p-summary',
@@ -175,17 +180,26 @@
function listProps(tbody, data) {
// Suppress Lat Long in details panel if null
- if (data.props.Latitude === null ||
- data.props.Longitude === null) {
- var idx = data.propOrder.indexOf('Latitude');
+ if (data.propLabels.latitude === null ||
+ data.propLabels.longitude === null) {
+ var idx = data.propOrder.indexOf('latitude');
data.propOrder.splice(idx, 3);
}
data.propOrder.forEach(function (p) {
+ // TODO: remove after topo view fully i18n'd
+ var foo = data.props && data.props[p];
+
if (p === '-') {
addSep(tbody);
+
} else {
- addProp(tbody, p, data.props[p]);
+ // TODO: remove this if/else once DETAILS panel fixed for i18n
+ if (foo !== undefined) {
+ addProp(tbody, p, foo);
+ } else {
+ addProp(tbody, data.propLabels[p], data.propValues[p]);
+ }
}
});
}
@@ -392,7 +406,8 @@
function toggleSummary(x) {
var kev = (x === 'keyev'),
on = kev ? !summary.panel().isVisible() : !!x,
- verb = on ? 'Show' : 'Hide';
+ verb = on ? topoLion('show') : topoLion('hide'),
+ sumpan = topoLion('fl_panel_summary');
if (on) {
// ask server to start sending summary data.
@@ -401,7 +416,7 @@
} else {
hideSummaryPanel();
}
- flash.flash(verb + ' summary panel');
+ flash.flash(verb + ' ' + sumpan);
return on;
}
@@ -553,6 +568,8 @@
detailVisible: function () { return detail.panel().isVisible(); },
summaryVisible: function () { return summary.panel().isVisible(); },
+
+ setLionBundle: function (bundle) { topoLion = bundle; },
};
}]);
}());
diff --git a/web/gui/src/main/webapp/app/view/topo/topoSelect.js b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
index 1309a66..5d23f1e 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoSelect.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
@@ -256,7 +256,7 @@
function showDetails(data) {
var buttons = fs.isA(data.buttons) || [];
tps.displaySingle(data);
- tov.installButtons(buttons, data, data.props['URI']);
+ tov.installButtons(buttons, data, data.propValues['uri']);
tov.hooks.singleSelect(data);
tps.displaySomething();
}