ONOS-6723: UI-Lion: Applications View

Change-Id: I06447d3aa6d6a4e4be0937bd7a8bdf7868c90468
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.App.lioncfg b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.App.lioncfg
index 9baf17c..71d357b 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.App.lioncfg
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.App.lioncfg
@@ -27,4 +27,5 @@
 
 from cc.Props import icon, title, app_id, version, category, origin, state, role
 from cc.Action import activate, deactivate, uninstall
-from cc.Ui import click, scroll_down
+from cc.Ui import click_row, scroll_down, tt_ctl_auto_refresh
+from cc.State import total
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties
index 09b8973..59e1255 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties
@@ -21,6 +21,7 @@
 
 # Gesture text
 click=click
+click_row=click row
 scroll_down=scroll down
 
 # Common control button tooltips
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties
index ecd4ace..2f1c7c3 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties
@@ -21,6 +21,7 @@
 
 # Gesture text
 click=click
+click_row=click row
 scroll_down=Desplazar hacia abajo
 
 # Common control button tooltips
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
index 9ac44b6..bb2ba05 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
@@ -21,6 +21,7 @@
 
 # Gesture text
 click=click
+click_row=clicka da row
 scroll_down=scorri verso il basso
 
 # Common control button tooltips
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties
index 90fcb83..59d64f6 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties
@@ -21,6 +21,7 @@
 
 # Gesture text
 click=클릭
+click_row=click row
 scroll_down=아래로 스크롤
 
 # Common control button tooltips
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties
index b45afda..4d5d199 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties
@@ -21,6 +21,7 @@
 
 # Gesture text
 click=点击
+click_row=click row
 scroll_down=向下滚动
 
 # Common control button tooltips
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties
index c8222ec..037c87c 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties
@@ -21,6 +21,7 @@
 
 # Gesture text
 click=點擊
+click_row=click row
 scroll_down=向下滾動
 
 # Common control button tooltips
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App.properties
index 8fab3d3..1593ba8 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App.properties
@@ -54,7 +54,8 @@
 tt_ctl_uninstall=Uninstall selected application
 
 # Quick-Help panel
-qh_hint_click=Select a row to show application details
+qh_hint_esc=Deselect application
+qh_hint_click_row=Select / deselect application
 qh_hint_scroll_down=See more applications
 
 # App details panel
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties
new file mode 100644
index 0000000..2032eba
--- /dev/null
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/App_it.properties
@@ -0,0 +1,52 @@
+#
+# Copyright 2017-present Open Networking Laboratory
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+# ==========================================
+# |  WIP -- Not Yet Ready For Translation  |
+# ==========================================
+#
+# !!!* Sincere apologies to Andrea, for the pseudo-italian :) *!!!
+# (I had to use *something* for testing....)
+
+# Text that appears in the navigation panel
+nav_item_app=Applicazeone
+
+# View title
+title_apps=Applicazeone
+
+# Control button tooltips
+tt_ctl_upload=Uploada da applicazoni (.oar file)
+tt_ctl_activate=Activata choosi applicazoni
+tt_ctl_deactivate=Deactivata choosi applicazoni
+tt_ctl_uninstall=Remova choosi applicazoni
+
+# Quick-Help panel
+qh_hint_esc=Deselecta da applicz
+qh_hint_click_row=Selecta da row to viziliz applicz deetz
+qh_hint_scroll_down=Viewa moreoso applicz
+
+# App details panel
+dp_features=Featz
+dp_required_apps=Requireda Appz
+dp_permissions=Permizzionz
+
+# App dialog panel
+dlg_confirm_action=Confirma da Actiona
+
+dlg_warn_deactivate=Deactivating or uninstalling this component \
+  can have serious negative consequences (biga bada boom)!
+dlg_warn_own_risk=** DO SO AT YOUR OWN RISK (We tolda ya so!) **
diff --git a/web/gui/src/main/webapp/app/fw/widget/chartBuilder.js b/web/gui/src/main/webapp/app/fw/widget/chartBuilder.js
index 9a48fea..e2f2959 100644
--- a/web/gui/src/main/webapp/app/fw/widget/chartBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/chartBuilder.js
@@ -51,7 +51,7 @@
         o.scope.changedData = [];
         o.scope.reqParams = o.reqParams || {};
         o.scope.autoRefresh = true;
-        o.scope.autoRefreshTip = 'Toggle auto refresh';
+        o.scope.autoRefreshTip = o.lion_toggle_auto_refresh || 'Toggle auto refresh';
 
         // === websocket functions ===
         // response
diff --git a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
index 7e0cda4..b23bfd0 100644
--- a/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
+++ b/web/gui/src/main/webapp/app/fw/widget/tableBuilder.js
@@ -54,7 +54,7 @@
         o.scope.changedData = [];
         o.scope.sortParams = o.sortParams || {};
         o.scope.autoRefresh = true;
-        o.scope.autoRefreshTip = 'Toggle auto refresh';
+        o.scope.autoRefreshTip = o.lion_toggle_auto_refresh || 'Toggle auto refresh';
 
         // === websocket functions --------------------
         // response
diff --git a/web/gui/src/main/webapp/app/view/app/app.html b/web/gui/src/main/webapp/app/view/app/app.html
index 53063e3..b7c2eb5 100644
--- a/web/gui/src/main/webapp/app/view/app/app.html
+++ b/web/gui/src/main/webapp/app/view/app/app.html
@@ -1,7 +1,10 @@
 <!-- app partial HTML -->
 <div id="ov-app" filedrop on-file-drop="appDropped()">
     <div class="tabular-header">
-        <h2>Applications ({{tableData.length}} total)</h2>
+        <h2>
+            {{lion('title_apps')}}
+            ({{tableData.length}} {{lion('total')}})
+        </h2>
         <div class="ctrl-btns">
             <div class="refresh" ng-class="{active: autoRefresh}"
                  icon icon-size="42" icon-id="refresh"
@@ -43,12 +46,12 @@
             <table>
                 <tr>
                     <td colId="state" class="table-icon" sortable></td>
-                    <td colId="icon" class="table-icon">Icon </td>
-                    <td colId="title" sortable col-width="240px">Title </td>
-                    <td colId="id" sortable col-width="320px">App ID </td>
-                    <td colId="version" sortable col-width="140px">Version </td>
-                    <td colId="category" sortable col-width="136px">Category </td>
-                    <td colId="origin" sortable>Origin </td>
+                    <td colId="icon" class="table-icon"></td>
+                    <td colId="title" sortable col-width="240px"> {{lion('title')}} </td>
+                    <td colId="id" sortable col-width="320px"> {{lion('app_id')}} </td>
+                    <td colId="version" sortable col-width="140px"> {{lion('version')}} </td>
+                    <td colId="category" sortable col-width="136px"> {{lion('category')}} </td>
+                    <td colId="origin" sortable> {{lion('origin')}} </td>
                 </tr>
             </table>
         </div>
diff --git a/web/gui/src/main/webapp/app/view/app/app.js b/web/gui/src/main/webapp/app/view/app/app.js
index 1a09682..5fb55df 100644
--- a/web/gui/src/main/webapp/app/view/app/app.js
+++ b/web/gui/src/main/webapp/app/view/app/app.js
@@ -22,7 +22,7 @@
     'use strict';
 
     // injected refs
-    var $log, $scope, wss, fs, ks, ps, is;
+    var $log, $scope, wss, fs, ks, ps, is, ls;
 
     // internal state
     var detailsPanel,
@@ -55,12 +55,27 @@
         strongWarning = {
             'org.onosproject.drivers': true
         },
-        discouragement = 'Deactivating or uninstalling this component can' +
-        ' have serious negative consequences! <br> = DO SO AT YOUR OWN RISK =',
-        propOrder = ['id', 'state', 'category', 'version', 'origin', 'role'],
-        friendlyProps = ['App ID', 'State', 'Category', 'Version', 'Origin', 'Role'];
+        propOrder = ['id', 'state', 'category', 'version', 'origin', 'role'];
         // note: url is handled separately
 
+    // deferred localization strings
+    var warn_deactivate,
+        warn_own_risk,
+        friendlyProps,
+        lion;
+
+    function doLion() {
+        lion = ls.bundle('core.view.App');
+
+        warn_deactivate = lion('dlg_warn_deactivate');
+        warn_own_risk = lion('dlg_warn_own_risk');
+
+        friendlyProps = [
+            lion('app_id'), lion('state'), lion('category'), lion('version'),
+            lion('origin'), lion('role')
+        ];
+    }
+
     function createDetailsPane() {
         detailsPanel = ps.createPanel(pName, {
             width: wSize.width,
@@ -130,9 +145,9 @@
             bottom.append('div').classed(cls, true).append('table');
         }
 
-        nTable('Features', 'features');
-        nTable('Required Apps', 'required-apps');
-        nTable('Permissions', 'permissions');
+        nTable(lion('dp_features'), 'features');
+        nTable(lion('dp_required_apps'), 'required-apps');
+        nTable(lion('dp_permissions'), 'permissions');
     }
 
     function addProp(tbody, index, value) {
@@ -212,9 +227,10 @@
         ['$log', '$scope', '$http', '$timeout',
          'WebSocketService', 'FnService', 'KeyService', 'PanelService',
          'IconService', 'UrlFnService', 'DialogService', 'TableBuilderService',
+         'LionService',
 
     function (_$log_, _$scope_, $http, $timeout, _wss_, _fs_, _ks_, _ps_, _is_,
-              ufs, ds, tbs) {
+              ufs, ds, tbs, _ls_) {
         $log = _$log_;
         $scope = _$scope_;
         wss = _wss_;
@@ -222,12 +238,19 @@
         ks = _ks_;
         ps = _ps_;
         is = _is_;
+        ls = _ls_;
+
+        doLion();
+
+        $scope.lion = lion;
+
         $scope.panelData = {};
         $scope.ctrlBtnState = {};
-        $scope.uploadTip = 'Upload an application (.oar file)';
-        $scope.activateTip = 'Activate selected application';
-        $scope.deactivateTip = 'Deactivate selected application';
-        $scope.uninstallTip = 'Uninstall selected application';
+        $scope.uploadTip = lion('tt_ctl_upload');
+        $scope.activateTip = lion('tt_ctl_activate');
+        $scope.deactivateTip = lion('tt_ctl_deactivate');
+        $scope.uninstallTip = lion('tt_ctl_uninstall');
+
 
         var handlers = {};
 
@@ -273,25 +296,28 @@
                 firstDir: 'desc',
                 secondCol: 'title',
                 secondDir: 'asc'
-            }
+            },
+            lion_toggle_auto_refresh: lion('tt_ctl_auto_refresh')
         });
 
-        // TODO: reexamine where keybindings should be - directive or controller?
         ks.keyBindings({
-            esc: [$scope.selectCallback, 'Deselect application'],
+            esc: [$scope.selectCallback, lion('qh_hint_esc')],
             _helpFormat: ['esc']
         });
         ks.gestureNotes([
-            ['click row', 'Select / deselect application'],
-            ['scroll down', 'See more applications']
+            [lion('click_row'), lion('qh_hint_click_row')],
+            [lion('scroll_down'), lion('qh_hint_scroll_down')]
         ]);
 
         function createConfirmationText(action, itemId) {
             var content = ds.createDiv();
-            content.append('p').text(fs.cap(action) + ' ' + itemId);
+            content.append('p').text(lion(action) + ' ' + itemId);
             if (strongWarning[itemId]) {
-                content.append('p').html(fs.sanitize(discouragement))
-                    .classed('strong', true);
+                content.append('p').html(
+                    fs.sanitize(warn_deactivate) +
+                    '<br>' +
+                    fs.sanitize(warn_own_risk)
+                ).classed('strong', true);
             }
             return content;
         }
@@ -308,7 +334,7 @@
                     sortCol: spar.sortCol,
                     sortDir: spar.sortDir
                 });
-                if (action == 'uninstall') {
+                if (action === 'uninstall') {
                     detailsPanel.hide();
                 } else {
                     wss.sendEvent(detailsReq, {id: itemId});
@@ -320,7 +346,7 @@
             }
 
             ds.openDialog(dialogId, dialogOpts)
-                .setTitle('Confirm Action')
+                .setTitle(lion('dlg_confirm_action'))
                 .addContent(createConfirmationText(action, itemId))
                 .addOk(dOk)
                 .addCancel(dCancel)
@@ -470,12 +496,14 @@
                 }
                 // create key bindings to handle panel
                 ks.keyBindings({
-                    esc: [closePanel, 'Close the details panel'],
+                    esc: [closePanel, lion('qh_hint_close_detail')],
                     _helpFormat: ['esc']
                 });
+
+                // TODO: Review - why are we doing this in the detail panel...?
                 ks.gestureNotes([
-                    ['click', 'Select a row to show application details'],
-                    ['scroll down', 'See more applications']
+                    [lion('click_row'), lion('qh_hint_click_row')],
+                    [lion('scroll_down'), lion('qh_hint_scroll_down')]
                 ]);
 
                 // if the panelData changes
diff --git a/web/gui/src/main/webapp/app/view/cluster/cluster.html b/web/gui/src/main/webapp/app/view/cluster/cluster.html
index 83c721e..65132c1 100644
--- a/web/gui/src/main/webapp/app/view/cluster/cluster.html
+++ b/web/gui/src/main/webapp/app/view/cluster/cluster.html
@@ -2,7 +2,8 @@
 <div id="ov-cluster">
     <div class="tabular-header">
         <h2>
-            {{lion('title_cluster_nodes')}} ({{tableData.length}} {{lion('total')}})
+            {{lion('title_cluster_nodes')}}
+            ({{tableData.length}} {{lion('total')}})
         </h2>
         <div class="ctrl-btns">
             <div class="refresh" ng-class="{active: autoRefresh}"