Commit a8abaaf5 by Rashid Khan

Check if alert exists already. Closes #442

parent 43f13746
...@@ -17,21 +17,20 @@ angular.module('kibana.services', []) ...@@ -17,21 +17,20 @@ angular.module('kibana.services', [])
text: text || '', text: text || '',
severity: severity || 'info', severity: severity || 'info',
}, },
_ca = angular.copy(_a), _ca = angular.toJson(_a),
_clist = angular.copy(self.list); _clist = _.map(self.list,function(alert){return angular.toJson(alert);});
console.log(_.contains(_clist,_ca)) // If we already have this alert, remove it and add a new one
// Why do this instead of skipping the add because it resets the timer
// If there isn't already a message with the same text if(_.contains(_clist,_ca)) {
if(!_.contains(_clist,_ca)) { _.remove(self.list,_.indexOf(_clist,_ca));
console.log(_clist); }
console.log([_ca]);
self.list.push(_a); self.list.push(_a);
if (timeout > 0) { if (timeout > 0) {
$timeout(function() { $timeout(function() {
self.list = _.without(self.list,_a); self.list = _.without(self.list,_a);
}, timeout); }, timeout);
}
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment