GUI -- TopoView - Reimplemented (most of) the ESCAPE key handling.
Change-Id: I4d05a3107e68e75aad47adb6c4ef6a7ca74ba82b
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 81d0bc3..46a98cb 100644
--- a/web/gui/src/main/webapp/app/fw/util/keys.js
+++ b/web/gui/src/main/webapp/app/fw/util/keys.js
@@ -119,19 +119,14 @@
return true;
}
+ // returns true if we 'consumed' the ESC keypress, false otherwise
function escapeKey(view, key, code, ev) {
- // TODO: plumb in handling of alerts and quick help dismissal
- // We will delegate to the Alert / QuickHelp Services as appropriate.
+ // TODO: plumb in handling of quick help dismissal
/*
- if (alerts.open) {
- closeAlerts();
- return true;
- }
- if (libApi.quickHelp.hide()) {
+ if (qh.hide()) {
return true;
}
*/
- console.log('ESCAPE');
return false;
}
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 18b4fe1..6e3dd5f 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -99,16 +99,26 @@
}
function handleEscape() {
- $log.debug("TODO: handle-ESCAPE...");
- // if showingAffinity: cancelAffinity
+ if (false) {
+ // TODO: if an instance is selected, cancel the affinity mapping
+ // tis.cancelAffinity()
- // else if showingDetails: deselectAll
+ } else if (tss.haveDetails()) {
+ // else if we have node selections, deselect them all
+ tss.deselectAll();
- // else if oiBox visible: hide oiBox
+ } else if (tis.isVisible()) {
+ // else if the Instance Panel is visible, hide it
+ tis.hide();
+ tfs.updateDeviceColors();
- // else if summary panel visible: cancel Summary
+ } else if (tps.summaryVisible()) {
+ // else if the Summary Panel is visible, hide it
+ tps.hideSummaryPanel();
- // else: hoverMode = hoverModeNone
+ } else {
+ // TODO: set hover mode to hoverModeNone
+ }
}
// --- Glyphs, Icons, and the like -----------------------------------
diff --git a/web/gui/src/main/webapp/app/view/topo/topoPanel.js b/web/gui/src/main/webapp/app/view/topo/topoPanel.js
index d3b50bd..c1a8400 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoPanel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoPanel.js
@@ -144,10 +144,11 @@
function toggleSummary() {
if (summaryPanel.isVisible()) {
- api.sendEvent("cancelSummary");
hideSummaryPanel();
} else {
+ // ask server to start sending summary data.
api.sendEvent('requestSummary');
+ // note: the summary panel will appear, once data arrives
}
}
@@ -163,11 +164,9 @@
}
function hideSummaryPanel() {
- summaryPanel.hide(function () {
- if (detailPanel.isVisible()) {
- detailPanel.up();
- }
- });
+ // instruct server to stop sending summary data
+ api.sendEvent("cancelSummary");
+ summaryPanel.hide(detailPanel.up);
}
function showDetailPanel() {
diff --git a/web/gui/src/main/webapp/app/view/topo/topoSelect.js b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
index fb6c2f8..f431d9e 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoSelect.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoSelect.js
@@ -302,7 +302,8 @@
selectObject: selectObject,
deselectObject: deselectObject,
deselectAll: deselectAll,
- hovered: function () { return hovered; }
+ hovered: function () { return hovered; },
+ haveDetails: function () { return haveDetails; }
};
}]);
}());
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js
index 9e6c2fb..e640764 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoSelect-spec.js
@@ -36,7 +36,7 @@
expect(fs.areFunctions(tss, [
'initSelect', 'destroySelect', 'showDetails', 'toggleDetails',
'nodeMouseOver', 'nodeMouseOut', 'selectObject', 'deselectObject',
- 'deselectAll', 'hovered'
+ 'deselectAll', 'hovered', 'haveDetails'
])).toBeTruthy();
});