From 66f4d306d8ae69e1c9018deef33d170ae2c2ac1c Mon Sep 17 00:00:00 2001 From: Christoph Klingenberg Date: Tue, 3 Dec 2024 19:04:11 +0100 Subject: [PATCH 1/4] fixed alert notification endpoint Signed-off-by: Christoph Klingenberg --- .../management/services/notification.service.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/apps/frontend/src/app/management/services/notification.service.ts b/apps/frontend/src/app/management/services/notification.service.ts index fc497e7..f21dbd4 100644 --- a/apps/frontend/src/app/management/services/notification.service.ts +++ b/apps/frontend/src/app/management/services/notification.service.ts @@ -20,16 +20,9 @@ export class NotificationService { // Speichere neue Einstellungen updateNotificationSettings(notification: AlertType): Observable { - if (notification.user_active) { - return this.http.patch( - `${this.baseUrl}/alerting/type/${notification.id}/activate/user`, - { params: notification } - ); - } else { - return this.http.patch( - `${this.baseUrl}/alerting/type/${notification.id}/deactivate/user`, - { params: notification } - ); - } + return this.http.patch( + `${this.baseUrl}/alerting/type/${notification.id}/user`, + { params: notification } + ); } } From 4742a4f19428c56b9bc748fce9c77840993733a5 Mon Sep 17 00:00:00 2001 From: Christoph Klingenberg Date: Tue, 3 Dec 2024 19:31:42 +0100 Subject: [PATCH 2/4] fixed alert notification endpoint 2.o Signed-off-by: Christoph Klingenberg --- .../src/app/management/services/notification.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/src/app/management/services/notification.service.ts b/apps/frontend/src/app/management/services/notification.service.ts index f21dbd4..ae03da9 100644 --- a/apps/frontend/src/app/management/services/notification.service.ts +++ b/apps/frontend/src/app/management/services/notification.service.ts @@ -22,7 +22,7 @@ export class NotificationService { updateNotificationSettings(notification: AlertType): Observable { return this.http.patch( `${this.baseUrl}/alerting/type/${notification.id}/user`, - { params: notification } + { params: notification.user_active } ); } } From c0f7c1444db07bc7a97a417b9f0b745f81926143 Mon Sep 17 00:00:00 2001 From: Christoph Klingenberg Date: Tue, 3 Dec 2024 20:17:14 +0100 Subject: [PATCH 3/4] fixed alert notification endpoint 3.o Signed-off-by: Christoph Klingenberg --- .../src/app/alert/component/alert.component.ts | 11 ++++------- .../app/management/services/notification.service.ts | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/frontend/src/app/alert/component/alert.component.ts b/apps/frontend/src/app/alert/component/alert.component.ts index 9879f46..85fa912 100644 --- a/apps/frontend/src/app/alert/component/alert.component.ts +++ b/apps/frontend/src/app/alert/component/alert.component.ts @@ -43,19 +43,16 @@ export class AlertComponent implements OnInit { .getAllAlerts(this.DAYS) .pipe(takeUntil(this.destroy$)) .subscribe((data: Alert[]) => { - const activeAlerts = data.filter( - (alert) => alert.alertType.user_active === true - ); - this.criticalAlertsCount = activeAlerts.filter( + this.criticalAlertsCount = data.filter( (alert) => alert.alertType.severity === SeverityType.CRITICAL ).length; - this.warningAlertsCount = activeAlerts.filter( + this.warningAlertsCount = data.filter( (alert) => alert.alertType.severity === SeverityType.WARNING ).length; - this.infoAlertsCount = activeAlerts.filter( + this.infoAlertsCount = data.filter( (alert) => alert.alertType.severity === SeverityType.INFO ).length; - this.alerts = activeAlerts; + this.alerts = data; this.status = this.getStatus(); }); } diff --git a/apps/frontend/src/app/management/services/notification.service.ts b/apps/frontend/src/app/management/services/notification.service.ts index ae03da9..2874156 100644 --- a/apps/frontend/src/app/management/services/notification.service.ts +++ b/apps/frontend/src/app/management/services/notification.service.ts @@ -13,12 +13,10 @@ export class NotificationService { private readonly http: HttpClient ) {} - // Lade aktuelle Einstellungen getNotificationSettings(): Observable { return this.http.get(`${this.baseUrl}/alerting/type`); } - // Speichere neue Einstellungen updateNotificationSettings(notification: AlertType): Observable { return this.http.patch( `${this.baseUrl}/alerting/type/${notification.id}/user`, From 562b6b2d68306c3bed93fa7fe402a8dbb58c836b Mon Sep 17 00:00:00 2001 From: Christoph Klingenberg Date: Tue, 3 Dec 2024 20:23:34 +0100 Subject: [PATCH 4/4] fixed alert notification endpoint 4.o Signed-off-by: Christoph Klingenberg --- .../src/app/management/services/notification.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/frontend/src/app/management/services/notification.service.ts b/apps/frontend/src/app/management/services/notification.service.ts index 2874156..42246c9 100644 --- a/apps/frontend/src/app/management/services/notification.service.ts +++ b/apps/frontend/src/app/management/services/notification.service.ts @@ -20,7 +20,7 @@ export class NotificationService { updateNotificationSettings(notification: AlertType): Observable { return this.http.patch( `${this.baseUrl}/alerting/type/${notification.id}/user`, - { params: notification.user_active } + { status: notification.user_active } ); } }