This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch 
4287-migrate-angular-ui-from-constructor-injection-to-inject
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit d3fdae53a8097cdfebeca6151b51110d189b2eb8
Author: Philipp Zehnder <[email protected]>
AuthorDate: Tue Mar 24 09:58:38 2026 +0100

    migrate notifications UI to inject()
---
 .../components/notification-item.component.ts           |  6 +++---
 ui/src/app/notifications/notifications.component.ts     | 17 +++++++++--------
 .../app/notifications/service/notifications.service.ts  |  8 +++-----
 3 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/ui/src/app/notifications/components/notification-item.component.ts 
b/ui/src/app/notifications/components/notification-item.component.ts
index 1713846791..af3b4b52c8 100644
--- a/ui/src/app/notifications/components/notification-item.component.ts
+++ b/ui/src/app/notifications/components/notification-item.component.ts
@@ -15,7 +15,7 @@
  *   limitations under the License.
  */
 
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
 import { NotificationItem } from '../model/notifications.model';
 import { DomSanitizer } from '@angular/platform-browser';
 import { DatePipe } from '@angular/common';
@@ -27,11 +27,11 @@ import { DatePipe } from '@angular/common';
     imports: [DatePipe],
 })
 export class NotificationItemComponent implements OnInit {
+    private domSanitizer = inject(DomSanitizer);
+
     @Input() notification: NotificationItem;
     sanitizedMessage;
 
-    constructor(private domSanitizer: DomSanitizer) {}
-
     ngOnInit(): void {
         this.sanitizedMessage = this.domSanitizer.bypassSecurityTrustHtml(
             this.notification.message,
diff --git a/ui/src/app/notifications/notifications.component.ts 
b/ui/src/app/notifications/notifications.component.ts
index 039124b4dd..4a38330aad 100644
--- a/ui/src/app/notifications/notifications.component.ts
+++ b/ui/src/app/notifications/notifications.component.ts
@@ -22,6 +22,7 @@ import {
     OnDestroy,
     OnInit,
     ViewChild,
+    inject,
 } from '@angular/core';
 import {
     ExistingNotification,
@@ -72,6 +73,13 @@ import { NotificationItemComponent } from 
'./components/notification-item.compon
     ],
 })
 export class NotificationsComponent implements OnInit, OnDestroy {
+    private authService = inject(AuthService);
+    private pipelineService = inject(PipelineService);
+    elementIconText = inject(PipelineElementIconTextService);
+    private notificationService = inject(NotificationsService);
+    private notificationCountService = inject(NotificationCountService);
+    private breadcrumbService = inject(SpBreadcrumbService);
+
     static readonly NOTIFICATIONS_APP_ID =
         'org.apache.streampipes.sinks.internal.jvm.notification';
     static readonly NOTIFICATION_TITLE_KEY = 'title';
@@ -99,14 +107,7 @@ export class NotificationsComponent implements OnInit, 
OnDestroy {
     newEventArriving = false;
     lastFetchTime = new Date().getTime();
 
-    constructor(
-        private authService: AuthService,
-        private pipelineService: PipelineService,
-        public elementIconText: PipelineElementIconTextService,
-        private notificationService: NotificationsService,
-        private notificationCountService: NotificationCountService,
-        private breadcrumbService: SpBreadcrumbService,
-    ) {
+    constructor() {
         this.unreadNotifications = [];
     }
 
diff --git a/ui/src/app/notifications/service/notifications.service.ts 
b/ui/src/app/notifications/service/notifications.service.ts
index 5fc4e2e06b..006a167c87 100644
--- a/ui/src/app/notifications/service/notifications.service.ts
+++ b/ui/src/app/notifications/service/notifications.service.ts
@@ -21,7 +21,7 @@ import {
     ExistingNotification,
     NotificationItem,
 } from '../model/notifications.model';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
 import { NotificationUtils } from '../utils/notifications.utils';
 import { map } from 'rxjs/operators';
 import { PlatformServicesCommons } from '@streampipes/platform-services';
@@ -29,10 +29,8 @@ import { NGX_LOADING_BAR_IGNORED } from 
'@ngx-loading-bar/http-client';
 
 @Injectable({ providedIn: 'root' })
 export class NotificationsService {
-    constructor(
-        private http: HttpClient,
-        private platformServicesCommons: PlatformServicesCommons,
-    ) {}
+    private http = inject(HttpClient);
+    private platformServicesCommons = inject(PlatformServicesCommons);
 
     getNotificationsFromTime(
         startTime: number,

Reply via email to