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

View File

@ -135,7 +135,7 @@
<div class="gf-form" ng-repeat="nc in ctrl.alertNotifications"> <div class="gf-form" ng-repeat="nc in ctrl.alertNotifications">
<span class="gf-form-label" ng-style="{'background-color': nc.bgColor }"> <span class="gf-form-label" ng-style="{'background-color': nc.bgColor }">
<i class="{{nc.iconClass}}"></i>&nbsp;{{nc.name}}&nbsp; <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> </span>
</div> </div>
<div class="gf-form"> <div class="gf-form">