Updated removing notification channel by uid

This commit is contained in:
Pavel Bakulev 2019-01-18 16:26:23 +02:00
parent c27bf6e688
commit 43c3d5b8ba
2 changed files with 5 additions and 4 deletions

View File

@ -140,6 +140,7 @@ export class AlertTabCtrl {
name: model.name,
iconClass: this.getNotificationIcon(model.type),
isDefault: false,
uid: model.uid
});
if (!_.find(this.alert.notifications, { id: model.id})) {
this.alert.notifications.push({ uid: model.uid });
@ -151,9 +152,9 @@ export class AlertTabCtrl {
this.addNotificationSegment.fake = true;
}
removeNotification(index) {
this.alert.notifications.splice(index, 1);
this.alertNotifications.splice(index, 1);
removeNotification(deleteUid) {
_.remove(this.alert.notifications, { uid: deleteUid});
_.remove(this.alertNotifications, { uid: deleteUid});
}
initModel() {

View File

@ -135,7 +135,7 @@
<div class="gf-form" ng-repeat="nc in ctrl.alertNotifications">
<span class="gf-form-label" ng-style="{'background-color': nc.bgColor }">
<i class="{{nc.iconClass}}"></i>&nbsp;{{nc.name}}&nbsp;
<i class="fa fa-remove pointer muted" ng-click="ctrl.removeNotification($index)" ng-if="nc.isDefault === false"></i>
<i class="fa fa-remove pointer muted" ng-click="ctrl.removeNotification(nc.uid)" ng-if="nc.isDefault === false"></i>
</span>
</div>
<div class="gf-form">