Browse Source

feat(alerting): include default notifications in alert tab

bergquist 9 năm trước cách đây
mục cha
commit
f56d45ac56

+ 8 - 0
public/app/features/alerting/alert_tab_ctrl.ts

@@ -76,6 +76,14 @@ export class AlertTabCtrl {
           this.alertNotifications.push(model);
         }
       });
+
+      _.each(this.notifications, item => {
+        if (item.isDefault) {
+          item.iconClass = this.getNotificationIcon(item.type);
+          item.bgColor = "#00678b";
+          this.alertNotifications.push(item);
+        }
+      });
     });
   }
 

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

@@ -6,7 +6,7 @@
 			</li>
 			<li ng-class="{active: ctrl.subTabIndex === 1}">
 				<a ng-click="ctrl.changeTabIndex(1)">
-					Notifications <span class="muted">({{ctrl.alert.notifications.length}})</span>
+					Notifications <span class="muted">({{ctrl.alertNotifications.length}})</span>
 				</a>
 			</li>
 			<li ng-class="{active: ctrl.subTabIndex === 2}">
@@ -122,9 +122,9 @@
 			<div class="gf-form-inline">
 				<div class="gf-form max-width-30">
 					<span class="gf-form-label width-8">Send to</span>
-					<span class="gf-form-label query-part" ng-repeat="nc in ctrl.alertNotifications">
+					<span class="gf-form-label" ng-repeat="nc in ctrl.alertNotifications" 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)"></i>
+						<i class="fa fa-remove pointer muted" ng-click="ctrl.removeNotification($index)" ng-if="nc.isDefault === false"></i>
 					</span>
 					<metric-segment segment="ctrl.addNotificationSegment" get-options="ctrl.getNotifications()" on-change="ctrl.notificationAdded()"></metric-segment>
 				</div>