ONOS-2901 - Added fix to ignore reserved global keys, when activating a topo overlay.
Change-Id: I9bcd15e4a5e6d688683e0ac703328dc4f840c461
diff --git a/web/gui/src/main/webapp/app/fw/util/keys.js b/web/gui/src/main/webapp/app/fw/util/keys.js
index 2985565..10a4e9a 100644
--- a/web/gui/src/main/webapp/app/fw/util/keys.js
+++ b/web/gui/src/main/webapp/app/fw/util/keys.js
@@ -173,6 +173,23 @@
keyHandler.viewGestures = [];
}
+ function checkNotGlobal(o) {
+ var oops = [];
+ if (fs.isO(o)) {
+ angular.forEach(o, function (val, key) {
+ if (keyHandler.globalKeys[key]) {
+ oops.push(key);
+ }
+ });
+ if (oops.length) {
+ $log.warn('Ignoring reserved global key(s):', oops.join(','));
+ oops.forEach(function (key) {
+ delete o[key];
+ });
+ }
+ }
+ }
+
angular.module('onosUtil')
.factory('KeyService',
['$log', 'FnService', 'ThemeService', 'NavService',
@@ -208,7 +225,8 @@
},
enableKeys: function (b) {
enabled = b;
- }
+ },
+ checkNotGlobal: checkNotGlobal
};
}]);
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 2189410..42b6f4b 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -95,6 +95,9 @@
// and include them in the quick-help panel
function mergeKeys(extra) {
var _hf = actionMap._helpFormat[2];
+
+ ks.checkNotGlobal(extra);
+
extra._keyOrder.forEach(function (k) {
var d = extra[k],
cb = d && d.cb,