Simon Hunt

GUI -- Added enable() function to flash service, to allow topo view to disable f…

…lash messages while restoring state..

Change-Id: I1c904d0b69bf707ffa08b423ac5d4ecf7b0a7ff2
......@@ -41,7 +41,8 @@
// internal state
var settings,
timer = null,
data = [];
data = [],
enabled;
// DOM elements
var flashDiv, svg;
......@@ -123,6 +124,8 @@
}
function flash(msg) {
if (!enabled) return;
if (timer) {
$timeout.cancel(timer);
}
......@@ -136,6 +139,10 @@
updateFlash();
}
function enable(b) {
enabled = !!b;
}
angular.module('onosLayer')
.factory('FlashService', ['$log', '$timeout',
function (_$log_, _$timeout_) {
......@@ -145,11 +152,13 @@
function initFlash(opts) {
settings = angular.extend({}, defaultSettings, opts);
flashDiv = d3.select('#flash');
enabled = true;
}
return {
initFlash: initFlash,
flash: flash
flash: flash,
enable: enable
};
}]);
......
......@@ -273,10 +273,12 @@
$log.debug('TOPO---- Prefs State:', prefsState);
flash.enable(false);
toggleInstances(prefsState.insts);
toggleSummary(prefsState.summary);
toggleDetails(prefsState.detail);
toggleSprites(prefsState.sprites);
flash.enable(true);
}
......@@ -362,7 +364,9 @@
function (proj) {
projection = proj;
$log.debug('** We installed the projection: ', proj);
flash.enable(false);
toggleMap(prefsState.bg);
flash.enable(true);
}
);
spriteG = zoomLayer.append ('g').attr('id', 'topo-sprites');
......
......@@ -47,8 +47,8 @@ describe('factory: fw/layer/flash.js', function () {
it('should define api functions', function () {
expect(fs.areFunctions(flash, [
'initFlash', 'flash'
])).toBeTruthy();
'initFlash', 'flash', 'enable'
])).toBe(true);
});
it('should have no items to start', function () {
......