Simon Hunt

GUI -- TopoView - Reimplemented (most of) the ESCAPE key handling.

Change-Id: I4d05a3107e68e75aad47adb6c4ef6a7ca74ba82b
......@@ -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;
}
......
......@@ -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 -----------------------------------
......
......@@ -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() {
......
......@@ -302,7 +302,8 @@
selectObject: selectObject,
deselectObject: deselectObject,
deselectAll: deselectAll,
hovered: function () { return hovered; }
hovered: function () { return hovered; },
haveDetails: function () { return haveDetails; }
};
}]);
}());
......
......@@ -36,7 +36,7 @@ describe('factory: view/topo/topoSelect.js', function() {
expect(fs.areFunctions(tss, [
'initSelect', 'destroySelect', 'showDetails', 'toggleDetails',
'nodeMouseOver', 'nodeMouseOut', 'selectObject', 'deselectObject',
'deselectAll', 'hovered'
'deselectAll', 'hovered', 'haveDetails'
])).toBeTruthy();
});
......