Simon Hunt

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

Change-Id: I4d05a3107e68e75aad47adb6c4ef6a7ca74ba82b
...@@ -119,19 +119,14 @@ ...@@ -119,19 +119,14 @@
119 return true; 119 return true;
120 } 120 }
121 121
122 + // returns true if we 'consumed' the ESC keypress, false otherwise
122 function escapeKey(view, key, code, ev) { 123 function escapeKey(view, key, code, ev) {
123 - // TODO: plumb in handling of alerts and quick help dismissal 124 + // TODO: plumb in handling of quick help dismissal
124 - // We will delegate to the Alert / QuickHelp Services as appropriate.
125 /* 125 /*
126 - if (alerts.open) { 126 + if (qh.hide()) {
127 - closeAlerts();
128 - return true;
129 - }
130 - if (libApi.quickHelp.hide()) {
131 return true; 127 return true;
132 } 128 }
133 */ 129 */
134 - console.log('ESCAPE');
135 return false; 130 return false;
136 } 131 }
137 132
......
...@@ -99,16 +99,26 @@ ...@@ -99,16 +99,26 @@
99 } 99 }
100 100
101 function handleEscape() { 101 function handleEscape() {
102 - $log.debug("TODO: handle-ESCAPE..."); 102 + if (false) {
103 - // if showingAffinity: cancelAffinity 103 + // TODO: if an instance is selected, cancel the affinity mapping
104 + // tis.cancelAffinity()
104 105
105 - // else if showingDetails: deselectAll 106 + } else if (tss.haveDetails()) {
107 + // else if we have node selections, deselect them all
108 + tss.deselectAll();
106 109
107 - // else if oiBox visible: hide oiBox 110 + } else if (tis.isVisible()) {
111 + // else if the Instance Panel is visible, hide it
112 + tis.hide();
113 + tfs.updateDeviceColors();
108 114
109 - // else if summary panel visible: cancel Summary 115 + } else if (tps.summaryVisible()) {
116 + // else if the Summary Panel is visible, hide it
117 + tps.hideSummaryPanel();
110 118
111 - // else: hoverMode = hoverModeNone 119 + } else {
120 + // TODO: set hover mode to hoverModeNone
121 + }
112 } 122 }
113 123
114 // --- Glyphs, Icons, and the like ----------------------------------- 124 // --- Glyphs, Icons, and the like -----------------------------------
......
...@@ -144,10 +144,11 @@ ...@@ -144,10 +144,11 @@
144 144
145 function toggleSummary() { 145 function toggleSummary() {
146 if (summaryPanel.isVisible()) { 146 if (summaryPanel.isVisible()) {
147 - api.sendEvent("cancelSummary");
148 hideSummaryPanel(); 147 hideSummaryPanel();
149 } else { 148 } else {
149 + // ask server to start sending summary data.
150 api.sendEvent('requestSummary'); 150 api.sendEvent('requestSummary');
151 + // note: the summary panel will appear, once data arrives
151 } 152 }
152 } 153 }
153 154
...@@ -163,11 +164,9 @@ ...@@ -163,11 +164,9 @@
163 } 164 }
164 165
165 function hideSummaryPanel() { 166 function hideSummaryPanel() {
166 - summaryPanel.hide(function () { 167 + // instruct server to stop sending summary data
167 - if (detailPanel.isVisible()) { 168 + api.sendEvent("cancelSummary");
168 - detailPanel.up(); 169 + summaryPanel.hide(detailPanel.up);
169 - }
170 - });
171 } 170 }
172 171
173 function showDetailPanel() { 172 function showDetailPanel() {
......
...@@ -302,7 +302,8 @@ ...@@ -302,7 +302,8 @@
302 selectObject: selectObject, 302 selectObject: selectObject,
303 deselectObject: deselectObject, 303 deselectObject: deselectObject,
304 deselectAll: deselectAll, 304 deselectAll: deselectAll,
305 - hovered: function () { return hovered; } 305 + hovered: function () { return hovered; },
306 + haveDetails: function () { return haveDetails; }
306 }; 307 };
307 }]); 308 }]);
308 }()); 309 }());
......
...@@ -36,7 +36,7 @@ describe('factory: view/topo/topoSelect.js', function() { ...@@ -36,7 +36,7 @@ describe('factory: view/topo/topoSelect.js', function() {
36 expect(fs.areFunctions(tss, [ 36 expect(fs.areFunctions(tss, [
37 'initSelect', 'destroySelect', 'showDetails', 'toggleDetails', 37 'initSelect', 'destroySelect', 'showDetails', 'toggleDetails',
38 'nodeMouseOver', 'nodeMouseOut', 'selectObject', 'deselectObject', 38 'nodeMouseOver', 'nodeMouseOut', 'selectObject', 'deselectObject',
39 - 'deselectAll', 'hovered' 39 + 'deselectAll', 'hovered', 'haveDetails'
40 ])).toBeTruthy(); 40 ])).toBeTruthy();
41 }); 41 });
42 42
......