GUI -- Added enable() function to flash service, to allow topo view to disable flash messages while restoring state..
Change-Id: I1c904d0b69bf707ffa08b423ac5d4ecf7b0a7ff2
diff --git a/web/gui/src/main/webapp/app/fw/layer/flash.js b/web/gui/src/main/webapp/app/fw/layer/flash.js
index 5ae0ca9..0d95b77 100644
--- a/web/gui/src/main/webapp/app/fw/layer/flash.js
+++ b/web/gui/src/main/webapp/app/fw/layer/flash.js
@@ -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
};
}]);