ONOS-6724: UI-Lion: Masthead.
- Apologies to Andrea for the bad Italian "translation" ;)
Change-Id: I576b8b1d40f97eb2202c29cbd88bfc5855cbcb28
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast.properties
index b353958..1684c51 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast.properties
@@ -19,5 +19,14 @@
# Tooltip for context-sensitive help button [?]
tt_help=Show help page for current view
+# unknown user
+unknown_user=(no one)
+
# Logout button
logout=Logout
+
+# UI components added/removed, etc.
+uicomp_added=New GUI components were added.
+uicomp_removed=Some GUI components were removed.
+ui_ok_to_update=Press OK to update the GUI.
+confirm_refresh_title=Confirm GUI Refresh
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_it.properties
index e545c59..5409d7f 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/fw/Mast_it.properties
@@ -19,6 +19,14 @@
# Tooltip for context-sensitive help button [?]
tt_help=Mostra suggerimenti per questa vista
+# unknown user
+unknown_user=(no one)
# Logout button
logout=Logout
+
+# UI components added/removed, etc.
+uicomp_added=New GUI components were added. Presto.
+uicomp_removed=Some GUI components were removed. Pronto.
+ui_ok_to_update=Press OK to update the GUI. Allegro.
+confirm_refresh_title=Confirm GUI Refresh. Crescendo.
diff --git a/web/gui/src/main/webapp/app/fw/mast/mast.html b/web/gui/src/main/webapp/app/fw/mast/mast.html
index dfe4e23..415bc0f 100644
--- a/web/gui/src/main/webapp/app/fw/mast/mast.html
+++ b/web/gui/src/main/webapp/app/fw/mast/mast.html
@@ -8,9 +8,9 @@
<div id="mast-right">
<nav>
<div class="dropdown-parent">
- <a class="clickable user-menu__name">{{user}} <i class="dropdown-icon"></i></a>
+ <a class="clickable user-menu__name">{{username()}} <i class="dropdown-icon"></i></a>
<div class="dropdown">
- <a href="rs/logout">logout</a>
+ <a href="rs/logout"> {{lion('logout')}} </a>
</div>
</div>
<div class="ctrl-btns">
diff --git a/web/gui/src/main/webapp/app/fw/mast/mast.js b/web/gui/src/main/webapp/app/fw/mast/mast.js
index 6483703..ae7c81b 100644
--- a/web/gui/src/main/webapp/app/fw/mast/mast.js
+++ b/web/gui/src/main/webapp/app/fw/mast/mast.js
@@ -25,30 +25,38 @@
padMobile = 16,
dialogOpts = {
edge: 'left'
- },
- msg = {
- add: { adj: 'New', op: 'added'},
- rem: { adj: 'Some', op: 'removed'}
};
+ var ls;
+
+ // In the case of Masthead, we cannot cache the lion bundle, because we
+ // call too early (before the lion data is uploaded from the server).
+ // So we'll dig into the lion service for each request...
+ function getLion(x) {
+ var lion = ls.bundle('core.fw.Mast');
+ return lion(x);
+ }
+
angular.module('onosMast', ['onosNav'])
.controller('MastCtrl',
- ['$log', '$scope', '$location', '$window', 'WebSocketService', 'NavService',
- 'DialogService',
+ ['$log', '$scope', '$location', '$window', 'WebSocketService',
+ 'NavService', 'DialogService', 'LionService',
- function ($log, $scope, $location, $window, wss, ns, ds) {
+ function ($log, $scope, $location, $window, wss, ns, ds, _ls_) {
var self = this;
+ ls = _ls_;
+
+ $scope.lion = getLion;
+
function triggerRefresh(action) {
+ var uicomp = action === 'add' ? getLion('uicomp_added')
+ : getLion('uicomp_removed'),
+ okupd = getLion('ui_ok_to_update');
function createConfirmationText() {
- var content = ds.createDiv(),
- txt = msg[action];
-
- content.append('p').text(
- txt.adj + ' GUI components were ' + txt.op +
- '. Press OK to update the GUI.'
- );
+ var content = ds.createDiv();
+ content.append('p').text(uicomp + ' ' + okupd);
return content;
}
@@ -67,7 +75,7 @@
// apps could be injected externally (via the onos-app
// command) and we might be looking at some other view.
ds.openDialog('app-dialog', dialogOpts)
- .setTitle('Confirm GUI Refresh')
+ .setTitle(getLion('confirm_refresh_title'))
.addContent(createConfirmationText())
.addOk(dOk)
.addCancel(dCancel)
@@ -85,8 +93,17 @@
};
// onosUser is a global set via the index.html generated source
- $scope.user = onosUser || '(no one)';
- $scope.helpTip = 'Show help page for current view';
+ $scope.username = function () {
+ return onosUser || getLion('unknown_user');
+ };
+
+ // The problem with the following is that the localization bundle
+ // hasn't been uploaded from the server at this point, so we get
+ // a lookup miss => '%tt_help%'
+ // $scope.helpTip = getLion('tt_help');
+ // We would need to figure out how to inject the text later.
+ // For now, we'll just leave the tooltip blank.
+ $scope.helpTip = '';
$scope.directTo = function () {
var curId = $location.path().replace('/', ''),