Jelajahi Sumber

Alerting: fix response popover prompt when add notification channels (#18967)

lzd 6 tahun lalu
induk
melakukan
c9c0dd1ea8

+ 2 - 0
pkg/services/alerting/notifier.go

@@ -64,6 +64,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
 	if err != nil {
 		n.log.Error("failed to send notification", "uid", notifier.GetNotifierUID(), "error", err)
 		metrics.MAlertingNotificationFailed.WithLabelValues(notifier.GetType()).Inc()
+		return err
 	}
 
 	if evalContext.IsTestRun {
@@ -108,6 +109,7 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
 		err := n.sendNotification(evalContext, notifierState)
 		if err != nil {
 			n.log.Error("failed to send notification", "uid", notifierState.notifier.GetNotifierUID(), "error", err)
+			return err
 		}
 	}
 

+ 1 - 3
public/app/features/alerting/NotificationsEditCtrl.ts

@@ -121,9 +121,7 @@ export class AlertNotificationEditCtrl {
       settings: this.model.settings,
     };
 
-    this.backendSrv.post(`/api/alert-notifications/test`, payload).then((res: any) => {
-      appEvents.emit('alert-success', ['Test notification sent', '']);
-    });
+    this.backendSrv.post(`/api/alert-notifications/test`, payload);
   }
 }