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/topo2DeviceDetailsPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
index 50b43d3..624b234 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2DeviceDetailsPanel.js
@@ -198,7 +198,7 @@
function toggle() {
var on = detailsPanel.p.toggle(),
verb = on ? 'Show' : 'Hide';
- flash.flash(verb + ' Summary Panel');
+ flash.flash(verb + ' Details Panel');
}
function show() {
@@ -236,7 +236,8 @@
toggle: toggle,
show: show,
hide: hide,
- destroy: destroy
+ destroy: destroy,
+ isVisible: function () { return detailsPanel.isVisible(); }
};
}
]);
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Instance.js b/web/gui/src/main/webapp/app/view/topo2/topo2Instance.js
index 64cefdd..abf5d11 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Instance.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Instance.js
@@ -285,7 +285,8 @@
initInst: initInst,
allInstances: allInstances,
destroy: destroy,
- toggle: toggle
+ toggle: toggle,
+ isVisible: function () { return oiBox.isVisible(); }
};
}]);
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 {
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2Panel.js b/web/gui/src/main/webapp/app/view/topo2/topo2Panel.js
index 5836382..3687f6b 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2Panel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2Panel.js
@@ -63,6 +63,9 @@
},
destroy: function () {
ps.destroyPanel(this.id);
+ },
+ isVisible: function () {
+ return this.p.isVisible();
}
};
diff --git a/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js b/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
index ac12c2b..43e92fb 100644
--- a/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo2/topo2SummaryPanel.js
@@ -49,7 +49,6 @@
});
summaryPanel = new Panel(id, options);
-
summaryPanel.p.classed(className, true);
}
@@ -132,7 +131,8 @@
init: init,
toggle: toggle,
- destroy: destroy
+ destroy: destroy,
+ isVisible: function () { return summaryPanel.isVisible(); }
};
}
]);