Simon Hunt

GUI -- TopoView - Implemented show/hide summary 'O' keystroke.

Change-Id: Id5014614b8faec19423aa367ad3de1ca3140b882
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
28 ]; 28 ];
29 29
30 // references to injected services etc. 30 // references to injected services etc.
31 - var $log, fs, ks, zs, gs, ms, sus, tfs, tis; 31 + var $log, fs, ks, zs, gs, ms, sus, tes, tfs, tps, tis;
32 32
33 // DOM elements 33 // DOM elements
34 var ovtopo, svg, defs, zoomLayer, mapG, forceG, noDevsLayer; 34 var ovtopo, svg, defs, zoomLayer, mapG, forceG, noDevsLayer;
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
42 // key bindings need to be made after the services have been injected 42 // key bindings need to be made after the services have been injected
43 // thus, deferred to here... 43 // thus, deferred to here...
44 ks.keyBindings({ 44 ks.keyBindings({
45 - //O: [toggleSummary, 'Toggle ONOS summary pane'], 45 + O: [toggleSummary, 'Toggle ONOS summary pane'],
46 I: [toggleInstances, 'Toggle ONOS instances pane'], 46 I: [toggleInstances, 'Toggle ONOS instances pane'],
47 //D: [toggleDetails, 'Disable / enable details pane'], 47 //D: [toggleDetails, 'Disable / enable details pane'],
48 48
...@@ -87,6 +87,15 @@ ...@@ -87,6 +87,15 @@
87 87
88 // --- Keystroke functions ------------------------------------------- 88 // --- Keystroke functions -------------------------------------------
89 89
90 + function toggleSummary() {
91 + if (tps.summaryVisible()) {
92 + tes.sendEvent("cancelSummary");
93 + tps.hideSummaryPanel();
94 + } else {
95 + tes.sendEvent('requestSummary');
96 + }
97 + }
98 +
90 function toggleInstances() { 99 function toggleInstances() {
91 tis.toggle(); 100 tis.toggle();
92 tfs.updateDeviceColors(); 101 tfs.updateDeviceColors();
...@@ -213,7 +222,7 @@ ...@@ -213,7 +222,7 @@
213 'TopoInstService', 222 'TopoInstService',
214 223
215 function ($scope, _$log_, $loc, $timeout, _fs_, mast, 224 function ($scope, _$log_, $loc, $timeout, _fs_, mast,
216 - _ks_, _zs_, _gs_, _ms_, _sus_, tes, _tfs_, tps, _tis_) { 225 + _ks_, _zs_, _gs_, _ms_, _sus_, _tes_, _tfs_, _tps_, _tis_) {
217 var self = this, 226 var self = this,
218 projection, 227 projection,
219 dim, 228 dim,
...@@ -221,7 +230,7 @@ ...@@ -221,7 +230,7 @@
221 // provides function calls back into this space 230 // provides function calls back into this space
222 showNoDevs: showNoDevs, 231 showNoDevs: showNoDevs,
223 projection: function () { return projection; }, 232 projection: function () { return projection; },
224 - sendEvent: tes.sendEvent 233 + sendEvent: _tes_.sendEvent
225 }; 234 };
226 235
227 $log = _$log_; 236 $log = _$log_;
...@@ -231,7 +240,9 @@ ...@@ -231,7 +240,9 @@
231 gs = _gs_; 240 gs = _gs_;
232 ms = _ms_; 241 ms = _ms_;
233 sus = _sus_; 242 sus = _sus_;
243 + tes = _tes_;
234 tfs = _tfs_; 244 tfs = _tfs_;
245 + tps = _tps_;
235 tis = _tis_; 246 tis = _tis_;
236 247
237 self.notifyResize = function () { 248 self.notifyResize = function () {
......
...@@ -58,14 +58,15 @@ ...@@ -58,14 +58,15 @@
58 }; 58 };
59 } 59 }
60 60
61 - var dispatcher = { 61 + var nilApi = {},
62 + dispatcher = {
62 handleEvent: function (ev) { 63 handleEvent: function (ev) {
63 var eid = ev.event, 64 var eid = ev.event,
64 - api = evApis[eid] || {}, 65 + api = evApis[eid] || nilApi,
65 eh = api[eid]; 66 eh = api[eid];
66 67
67 if (eh) { 68 if (eh) {
68 - $log.debug(' *EVENT* ', eid, ev.payload); 69 + $log.debug(' << *Rx* ', eid, ev.payload);
69 eh(ev.payload); 70 eh(ev.payload);
70 } else { 71 } else {
71 $log.warn('Unknown event (ignored):', ev); 72 $log.warn('Unknown event (ignored):', ev);
...@@ -74,6 +75,7 @@ ...@@ -74,6 +75,7 @@
74 75
75 sendEvent: function (evType, payload) { 76 sendEvent: function (evType, payload) {
76 if (wsock) { 77 if (wsock) {
78 + $log.debug(' *Tx* >> ', evType, payload);
77 wes.sendEvent(wsock, evType, payload); 79 wes.sendEvent(wsock, evType, payload);
78 } else { 80 } else {
79 $log.warn('sendEvent: no websocket open:', evType, payload); 81 $log.warn('sendEvent: no websocket open:', evType, payload);
......
...@@ -143,7 +143,12 @@ ...@@ -143,7 +143,12 @@
143 143
144 function showSummaryPanel() { 144 function showSummaryPanel() {
145 summaryPanel.show(); 145 summaryPanel.show();
146 - // TODO: augment, once we have the details pane also 146 + // TODO: augment, for details panel move
147 + }
148 +
149 + function hideSummaryPanel() {
150 + summaryPanel.hide();
151 + // TODO: augment, for details panel move
147 } 152 }
148 153
149 function showDetailPanel() { 154 function showDetailPanel() {
...@@ -194,6 +199,7 @@ ...@@ -194,6 +199,7 @@
194 displayMulti: displayMulti, 199 displayMulti: displayMulti,
195 addAction: addAction, 200 addAction: addAction,
196 201
202 + hideSummaryPanel: hideSummaryPanel,
197 showDetailPanel: showDetailPanel, 203 showDetailPanel: showDetailPanel,
198 hideDetailPanel: hideDetailPanel, 204 hideDetailPanel: hideDetailPanel,
199 205
......
...@@ -40,6 +40,7 @@ describe('factory: view/topo/topoPanel.js', function() { ...@@ -40,6 +40,7 @@ describe('factory: view/topo/topoPanel.js', function() {
40 'displaySingle', 40 'displaySingle',
41 'displayMulti', 41 'displayMulti',
42 'addAction', 42 'addAction',
43 + 'hideSummaryPanel',
43 'showDetailPanel', 44 'showDetailPanel',
44 'hideDetailPanel', 45 'hideDetailPanel',
45 'detailVisible', 46 'detailVisible',
......