X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fshared%2Fservices%2Fprometheus-alert.service.ts;h=be6c27da6e2a77603531ca644eb4e486324cbe2e;hb=aee94f6923ba628a85d855d0c5316d0da78bfa2a;hp=f26b80629b9206f61496dc4bcf513ef6eaa90e94;hpb=27f45121cc74e31203777ad565f78d8aad9b92a2;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts index f26b80629..be6c27da6 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.ts @@ -64,23 +64,25 @@ export class PrometheusAlertService { this.notifyOnAlertChanges(alerts, this.alerts); } this.activeAlerts = _.reduce( - this.alerts, + alerts, (result, alert) => (alert.status.state === 'active' ? ++result : result), 0 ); this.activeCriticalAlerts = _.reduce( - this.alerts, + alerts, (result, alert) => alert.status.state === 'active' && alert.labels.severity === 'critical' ? ++result : result, 0 ); this.activeWarningAlerts = _.reduce( - this.alerts, + alerts, (result, alert) => alert.status.state === 'active' && alert.labels.severity === 'warning' ? ++result : result, 0 ); - this.alerts = alerts; + this.alerts = alerts.reverse().sort((a, b) => { + return a.labels.severity.localeCompare(b.labels.severity); + }); this.canAlertsBeNotified = true; }