Lion Utilities:
- top down approach, client side code..
- beginnings of LionService.
Change-Id: Ide0b4a334cb67368ce8b89b82e37502604946190
diff --git a/web/gui/src/main/webapp/_doc/fw/util/README.lion.md b/web/gui/src/main/webapp/_doc/fw/util/README.lion.md
new file mode 100644
index 0000000..390ecff
--- /dev/null
+++ b/web/gui/src/main/webapp/_doc/fw/util/README.lion.md
@@ -0,0 +1,6 @@
+Localization Service
+====================
+
+### Function definitions
+
+`bundle(key)`
diff --git a/web/gui/src/main/webapp/app/fw/util/lion.js b/web/gui/src/main/webapp/app/fw/util/lion.js
new file mode 100644
index 0000000..5a0cb69
--- /dev/null
+++ b/web/gui/src/main/webapp/app/fw/util/lion.js
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * 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.
+ *
+ */
+
+/*
+ ONOS GUI -- Lion -- Localization Utilities
+ */
+(function () {
+ 'use strict';
+
+ var $log, fs;
+
+ // returns a lion bundle for the given key
+ function bundle(key) {
+
+ // TODO: Use message handler mech. to get bundle from server
+ // For now, a fake placeholder bundle
+
+ var bun = {
+ computer: 'Calcolatore',
+ disk: 'Disco',
+ monitor: 'Schermo',
+ keyboard: 'Tastiera'
+ };
+
+ $log.warn('Using fake bundle', bun);
+ return bun;
+ }
+
+ angular.module('onosUtil')
+ .factory('LionService', ['$log', 'FnService',
+
+ function (_$log_, _fs_) {
+ $log = _$log_;
+ fs = _fs_;
+
+ return {
+ bundle: bundle
+ };
+ }]);
+}());
diff --git a/web/gui/src/main/webapp/app/view/cluster/cluster.js b/web/gui/src/main/webapp/app/view/cluster/cluster.js
index 451a067..0db243a 100644
--- a/web/gui/src/main/webapp/app/view/cluster/cluster.js
+++ b/web/gui/src/main/webapp/app/view/cluster/cluster.js
@@ -22,7 +22,7 @@
'use strict';
// injected references
- var $log, $scope, $location, fs, tbs, ns, mast, ps, wss, is, ks;
+ var $log, $scope, fs, ns, mast, ps, is, wss, lion;
// internal state
var detailsPanel,
@@ -196,22 +196,24 @@
angular.module('ovCluster', [])
.controller('OvClusterCtrl',
- ['$log', '$scope', 'TableBuilderService', 'NavService', 'MastService',
- 'PanelService', 'KeyService', 'IconService','WebSocketService',
- 'FnService',
+ ['$log', '$scope', 'FnService', 'NavService', 'MastService',
+ 'PanelService', 'IconService','WebSocketService',
+ 'LionService', 'TableBuilderService',
- function (_$log_, _$scope_, tbs, _ns_, _mast_, _ps_, _ks_, _is_,
- _wss_, _fs_) {
+ // var $log, $scope, fs, ns, mast, ps, is, wss, lion;
+
+ function (_$log_, _$scope_, _fs_, _ns_, _mast_, _ps_, _is_, _wss_, _lion_, tbs) {
var handlers = {};
$log = _$log_;
$scope = _$scope_;
fs = _fs_;
ns = _ns_;
- is = _is_;
- wss = _wss_;
mast = _mast_;
ps = _ps_;
+ is = _is_;
+ wss = _wss_;
+ lion = _lion_;
$scope.panelData = {};
@@ -238,6 +240,11 @@
wss.unbindHandlers(handlers);
});
+ // ++++ Temp test code for Localization POC ++++
+ var bun = lion.bundle('core.cluster');
+ $log.debug('Lion bundle test: computer = ', bun.computer);
+ // ++++ Temp test code for Localization POC ++++
+
$log.log('OvClusterCtrl has been created');
}])
diff --git a/web/gui/src/main/webapp/index.html b/web/gui/src/main/webapp/index.html
index 061cd7b..07395cb 100644
--- a/web/gui/src/main/webapp/index.html
+++ b/web/gui/src/main/webapp/index.html
@@ -57,6 +57,7 @@
<script src="app/fw/util/theme.js"></script>
<script src="app/fw/util/keys.js"></script>
<script src="app/fw/util/prefs.js"></script>
+ <script src="app/fw/util/lion.js"></script>
<script src="app/fw/mast/mast.js"></script>
<script src="app/fw/nav/nav.js"></script>