فهرست منبع

Updated removing notification channel by uid

Pavel Bakulev 7 سال پیش
والد
کامیت
43c3d5b8ba
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 4 3
      public/app/features/alerting/AlertTabCtrl.ts
  2. 1 1
      public/app/features/alerting/partials/alert_tab.html

+ 4 - 3
public/app/features/alerting/AlertTabCtrl.ts

@@ -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() {

+ 1 - 1
public/app/features/alerting/partials/alert_tab.html

@@ -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">