mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Check if alert exists already. Closes #442
This commit is contained in:
parent
43f1374661
commit
a8abaaf5de
@ -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(_.contains(_clist,_ca)) {
|
||||||
|
_.remove(self.list,_.indexOf(_clist,_ca));
|
||||||
|
}
|
||||||
|
|
||||||
// If there isn't already a message with the same text
|
self.list.push(_a);
|
||||||
if(!_.contains(_clist,_ca)) {
|
if (timeout > 0) {
|
||||||
console.log(_clist);
|
$timeout(function() {
|
||||||
console.log([_ca]);
|
self.list = _.without(self.list,_a);
|
||||||
self.list.push(_a);
|
}, timeout);
|
||||||
if (timeout > 0) {
|
|
||||||
$timeout(function() {
|
|
||||||
self.list = _.without(self.list,_a);
|
|
||||||
}, timeout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user