diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts index d16d0c85d88..aa3160b304c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts @@ -131,19 +131,25 @@ describe('PrometheusAlertService', () => { }); it('should notify on alert change', () => { - alerts = [prometheus.createAlert('alert0', 'suppressed')]; + alerts = [prometheus.createAlert('alert0', 'resolved')]; service.refresh(); expect(notificationService.show).toHaveBeenCalledWith( new CdNotificationConfig( - NotificationType.info, - 'alert0 (suppressed)', - 'alert0 is suppressed ' + prometheus.createLink('http://alert0'), + NotificationType.success, + 'alert0 (resolved)', + 'alert0 is resolved ' + prometheus.createLink('http://alert0'), undefined, 'Prometheus' ) ); }); + it('should not notify on change to suppressed', () => { + alerts = [prometheus.createAlert('alert0', 'suppressed')]; + service.refresh(); + expect(notificationService.show).not.toHaveBeenCalled(); + }); + it('should notify on a new alert', () => { alerts = [prometheus.createAlert('alert1'), prometheus.createAlert('alert0')]; service.refresh(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts index 6acd244617e..6223808fb01 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts @@ -75,7 +75,10 @@ export class PrometheusAlertService { this.alertFormatter.convertToCustomAlerts(alerts), this.alertFormatter.convertToCustomAlerts(oldAlerts) ); - const notifications = changedAlerts.map((alert) => + const suppressedFiltered = _.filter(changedAlerts, (alert) => { + return alert.status !== 'suppressed'; + }); + const notifications = suppressedFiltered.map((alert) => this.alertFormatter.convertAlertToNotification(alert) ); this.alertFormatter.sendNotifications(notifications);