From 71892221d15952691e07088eababc8cab0364073 Mon Sep 17 00:00:00 2001 From: Simon Hunt Date: Tue, 29 Sep 2015 13:39:40 -0700 Subject: [PATCH] ONOS-2901 - Added fix to ignore reserved global keys, when activating a topo overlay. Change-Id: I9bcd15e4a5e6d688683e0ac703328dc4f840c461 --- web/gui/src/main/webapp/app/fw/util/keys.js | 20 ++++++++++++++++++- web/gui/src/main/webapp/app/view/topo/topo.js | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) 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 2985565c3d..10a4e9a2e8 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 2189410040..42b6f4bdda 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,