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
This commit is contained in:
Simon Hunt 2015-11-09 12:48:23 -08:00
parent e086277eb6
commit a211f7fac0
3 changed files with 21 additions and 9 deletions

View File

@ -30,7 +30,7 @@
// references to injected services etc. // references to injected services etc.
var $scope, $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps, var $scope, $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps,
tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov; tds, tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs, ttip, tov;
// DOM elements // DOM elements
var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer; var ovtopo, svg, defs, zoomLayer, mapG, spriteG, forceG, noDevsLayer;
@ -425,7 +425,7 @@
.controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout', .controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout',
'$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService', '$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService',
'GlyphService', 'MapService', 'SvgUtilService', 'FlashService', 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService',
'WebSocketService', 'PrefsService', 'WebSocketService', 'PrefsService', 'TopoDialogService',
'TopoEventService', 'TopoForceService', 'TopoPanelService', 'TopoEventService', 'TopoForceService', 'TopoPanelService',
'TopoInstService', 'TopoSelectService', 'TopoLinkService', 'TopoInstService', 'TopoSelectService', 'TopoLinkService',
'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService', 'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService',
@ -433,9 +433,9 @@
'TopoOverlayService', 'TopoOverlayService',
function (_$scope_, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_, function (_$scope_, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_,
_zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tes_, _tfs_, _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tds_, _tes_,
_tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_, _ttbs_, tspr, _tfs_, _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_,
_ttip_, _tov_) { _ttbs_, tspr, _ttip_, _tov_) {
var params = $loc.search(), var params = $loc.search(),
projection, projection,
dim, dim,
@ -461,6 +461,7 @@
flash = _flash_; flash = _flash_;
wss = _wss_; wss = _wss_;
ps = _ps_; ps = _ps_;
tds = _tds_;
tes = _tes_; tes = _tes_;
tfs = _tfs_; tfs = _tfs_;
// TODO: consider funnelling actions through TopoForceService... // TODO: consider funnelling actions through TopoForceService...
@ -495,6 +496,7 @@
tes.stop(); tes.stop();
ks.unbindKeys(); ks.unbindKeys();
tps.destroyPanels(); tps.destroyPanels();
tds.closeDialog();
tis.destroyInst(); tis.destroyInst();
tfs.destroyForce(); tfs.destroyForce();
ttbs.destroyToolbar(); ttbs.destroyToolbar();

View File

@ -106,6 +106,13 @@
.on('click', invoke); .on('click', invoke);
} }
function setTitle(title) {
if (pApi) {
pApi.appendHeader('h2').text(title);
}
return dApi;
}
function addContent(content) { function addContent(content) {
if (pApi) { if (pApi) {
pApi.appendBody(content); pApi.appendBody(content);
@ -127,11 +134,11 @@
pApi = createDialog(); pApi = createDialog();
} }
pApi.reset(); pApi.reset();
pApi.appendHeader('h2').text('=dialog=');
panel.show(); panel.show();
// return the dialog object API // return the dialog object API
dApi = { dApi = {
setTitle: setTitle,
addContent: addContent, addContent: addContent,
addButton: addButton addButton: addButton
}; };

View File

@ -23,7 +23,7 @@
'use strict'; 'use strict';
// injected references // injected references
var $log, fs, tbs, ps, tov, api; var $log, fs, tbs, ps, tov, tds, api;
// API: // API:
// getActionEntry // getActionEntry
@ -192,6 +192,8 @@
}); });
} }
// ensure dialog has closed (if opened by outgoing overlay)
tds.closeDialog();
thirdRow.clear(); thirdRow.clear();
if (!order.length) { if (!order.length) {
@ -271,14 +273,15 @@
angular.module('ovTopo') angular.module('ovTopo')
.factory('TopoToolbarService', .factory('TopoToolbarService',
['$log', 'FnService', 'ToolbarService', 'PrefsService', ['$log', 'FnService', 'ToolbarService', 'PrefsService',
'TopoOverlayService', 'TopoOverlayService', 'TopoDialogService',
function (_$log_, _fs_, _tbs_, _ps_, _tov_) { function (_$log_, _fs_, _tbs_, _ps_, _tov_, _tds_) {
$log = _$log_; $log = _$log_;
fs = _fs_; fs = _fs_;
tbs = _tbs_; tbs = _tbs_;
ps = _ps_; ps = _ps_;
tov = _tov_; tov = _tov_;
tds = _tds_;
return { return {
init: init, init: init,