Topo2: Added Esc Handlers to close Details, Summary and Instance Panels
Change-Id: Ic448b4c73f24bada8d82fec35487db766f41ff1a
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js b/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
index bc350c3..2cc8570 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2KeyCommands.js
@@ -32,7 +32,9 @@
P: [togglePorts, 'Toggle Port Highlighting'],
E: [equalizeMasters, 'Equalize mastership roles'],
X: [resetAllNodeLocations, 'Reset Node Location'],
- U: [unpinNode, 'Unpin node (mouse over)']
+ U: [unpinNode, 'Unpin node (mouse over)'],
+
+ esc: handleEscape
};
function init(_t2fs_) {
@@ -53,6 +55,16 @@
]);
}
+ function handleEscape() {
+ if (t2ddp.isVisible()) {
+ t2ddp.toggle();
+ } else if (t2sp.isVisible()) {
+ t2sp.toggle();
+ } else if (t2is.isVisible()) {
+ t2is.toggle();
+ }
+ }
+
var prefsState = {};
function updatePrefsState(what, b) {
@@ -61,7 +73,6 @@
}
function deviceLabelFlashMessage(index) {
-
switch (index) {
case 0: return 'Hide device labels';
case 1: return 'Show friendly device labels';
@@ -123,8 +134,8 @@
.factory('Topo2KeyCommandService',
['KeyService', 'FlashService', 'WebSocketService', 'Topo2PrefsService',
'Topo2MapService', 'PrefsService', 'Topo2InstanceService',
- 'Topo2SummaryPanelService', 'Topo2ViewService',
- function (_ks_, _flash_, _wss_, _t2ps_, _t2ms_, _ps_, _t2is_, _t2sp_, _t2vs_) {
+ 'Topo2SummaryPanelService', 'Topo2DeviceDetailsPanel', 'Topo2ViewService',
+ function (_ks_, _flash_, _wss_, _t2ps_, _t2ms_, _ps_, _t2is_, _t2sp_, _t2ddp_, _t2vs_) {
ks = _ks_;
flash = _flash_;
@@ -134,6 +145,7 @@
t2is = _t2is_;
ps = _ps_;
t2sp = _t2sp_;
+ t2ddp = _t2ddp_;
t2vs = _t2vs_;
return {