Simon Hunt

GUI -- Ensure that topology view dialog is closed if we navigate away from the view,

  or if we switch overlays.
 - also add setTitle() function to dialog API.

Change-Id: I68bf1ff3f329e61bcf41512a9ebdefb1be7a0f95
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
30 30
31 // references to injected services etc. 31 // references to injected services etc.
32 var $scope, $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps, 32 var $scope, $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps,
33 - tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov; 33 + tds, tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov;
34 34
35 // DOM elements 35 // DOM elements
36 var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer; 36 var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer;
...@@ -425,7 +425,7 @@ ...@@ -425,7 +425,7 @@
425 .controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout', 425 .controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout',
426 '$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService', 426 '$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService',
427 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService', 427 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService',
428 - 'WebSocketService', 'PrefsService', 428 + 'WebSocketService', 'PrefsService', 'TopoDialogService',
429 'TopoEventService', 'TopoForceService', 'TopoPanelService', 429 'TopoEventService', 'TopoForceService', 'TopoPanelService',
430 'TopoInstService', 'TopoSelectService', 'TopoLinkService', 430 'TopoInstService', 'TopoSelectService', 'TopoLinkService',
431 'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService', 431 'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService',
...@@ -433,9 +433,9 @@ ...@@ -433,9 +433,9 @@
433 'TopoOverlayService', 433 'TopoOverlayService',
434 434
435 function (_$scope_, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_, 435 function (_$scope_, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_,
436 - _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tes_, _tfs_, 436 + _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tds_, _tes_,
437 - _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_, _ttbs_, tspr, 437 + _tfs_, _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_,
438 - _ttip_, _tov_) { 438 + _ttbs_, tspr, _ttip_, _tov_) {
439 var params = $loc.search(), 439 var params = $loc.search(),
440 projection, 440 projection,
441 dim, 441 dim,
...@@ -461,6 +461,7 @@ ...@@ -461,6 +461,7 @@
461 flash = _flash_; 461 flash = _flash_;
462 wss = _wss_; 462 wss = _wss_;
463 ps = _ps_; 463 ps = _ps_;
464 + tds = _tds_;
464 tes = _tes_; 465 tes = _tes_;
465 tfs = _tfs_; 466 tfs = _tfs_;
466 // TODO: consider funnelling actions through TopoForceService... 467 // TODO: consider funnelling actions through TopoForceService...
...@@ -495,6 +496,7 @@ ...@@ -495,6 +496,7 @@
495 tes.stop(); 496 tes.stop();
496 ks.unbindKeys(); 497 ks.unbindKeys();
497 tps.destroyPanels(); 498 tps.destroyPanels();
499 + tds.closeDialog();
498 tis.destroyInst(); 500 tis.destroyInst();
499 tfs.destroyForce(); 501 tfs.destroyForce();
500 ttbs.destroyToolbar(); 502 ttbs.destroyToolbar();
......
...@@ -106,6 +106,13 @@ ...@@ -106,6 +106,13 @@
106 .on('click', invoke); 106 .on('click', invoke);
107 } 107 }
108 108
109 + function setTitle(title) {
110 + if (pApi) {
111 + pApi.appendHeader('h2').text(title);
112 + }
113 + return dApi;
114 + }
115 +
109 function addContent(content) { 116 function addContent(content) {
110 if (pApi) { 117 if (pApi) {
111 pApi.appendBody(content); 118 pApi.appendBody(content);
...@@ -127,11 +134,11 @@ ...@@ -127,11 +134,11 @@
127 pApi = createDialog(); 134 pApi = createDialog();
128 } 135 }
129 pApi.reset(); 136 pApi.reset();
130 - pApi.appendHeader('h2').text('=dialog=');
131 panel.show(); 137 panel.show();
132 138
133 // return the dialog object API 139 // return the dialog object API
134 dApi = { 140 dApi = {
141 + setTitle: setTitle,
135 addContent: addContent, 142 addContent: addContent,
136 addButton: addButton 143 addButton: addButton
137 }; 144 };
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 'use strict'; 23 'use strict';
24 24
25 // injected references 25 // injected references
26 - var $log, fs, tbs, ps, tov, api; 26 + var $log, fs, tbs, ps, tov, tds, api;
27 27
28 // API: 28 // API:
29 // getActionEntry 29 // getActionEntry
...@@ -192,6 +192,8 @@ ...@@ -192,6 +192,8 @@
192 }); 192 });
193 } 193 }
194 194
195 + // ensure dialog has closed (if opened by outgoing overlay)
196 + tds.closeDialog();
195 thirdRow.clear(); 197 thirdRow.clear();
196 198
197 if (!order.length) { 199 if (!order.length) {
...@@ -271,14 +273,15 @@ ...@@ -271,14 +273,15 @@
271 angular.module('ovTopo') 273 angular.module('ovTopo')
272 .factory('TopoToolbarService', 274 .factory('TopoToolbarService',
273 ['$log', 'FnService', 'ToolbarService', 'PrefsService', 275 ['$log', 'FnService', 'ToolbarService', 'PrefsService',
274 - 'TopoOverlayService', 276 + 'TopoOverlayService', 'TopoDialogService',
275 277
276 - function (_$log_, _fs_, _tbs_, _ps_, _tov_) { 278 + function (_$log_, _fs_, _tbs_, _ps_, _tov_, _tds_) {
277 $log = _$log_; 279 $log = _$log_;
278 fs = _fs_; 280 fs = _fs_;
279 tbs = _tbs_; 281 tbs = _tbs_;
280 ps = _ps_; 282 ps = _ps_;
281 tov = _tov_; 283 tov = _tov_;
284 + tds = _tds_;
282 285
283 return { 286 return {
284 init: init, 287 init: init,
......