You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2026/03/24 11:17:29 UTC
(streampipes) branch 4287-migrate-angular-ui-from-constructor-injection-to-inject updated (6b2869385d -> 5e90a44ae1)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a change to branch 4287-migrate-angular-ui-from-constructor-injection-to-inject
in repository https://gitbox.apache.org/repos/asf/streampipes.git
from 6b2869385d fix: redesign auto aggregation for client limits (#4274)
new a7197d3333 migrate app shell to inject()
new ef67834196 migrate app services to inject()
new ee0d6b4d14 migrate http interceptor to inject()
new d9b29a414b migrate apidocs to inject()
new 60348e95f7 migrate login UI to inject()
new c60dccdfb6 migrate profile UI to inject()
new e55fc796ad migrate core guards to inject()
new 5093fc85ba migrate info UI to inject()
new d3fdae53a8 migrate notifications UI to inject()
new 4a3f17609b migrate dashboard UI to inject()
new a9f34c46e1 migrate dashboard shared services to inject()
new 353f1bdb1f migrate chart shared UI to inject()
new 798b2a557a migrate home UI to inject()
new 8f85bab02c migrate editor UI to inject()
new d526b15714 migrate core UI utilities to inject()
new 3dd8545ec7 migrate pipeline details UI to inject()
new caedf02bc5 migrate pipelines UI to inject()
new 53d9db944b migrate chart designer UI to inject()
new 3385412216 migrate asset UI to inject()
new a5f2a271ef migrate connect UI to inject()
new 45ad9e030c migrate configuration UI to inject()
new 2b4c21f150 migrate shared UI components to inject()
new bbecbd7fc5 migrate shared UI dialogs to inject()
new 5e90a44ae1 migrate shared UI services to inject()
The 24 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../asset-browser-filter-type.component.ts | 6 +-
.../asset-browser-filter.component.ts | 5 +-
.../asset-link-configuration.component.ts | 13 +-
.../basic-nav-tabs/basic-nav-tabs.component.ts | 6 +-
.../components/basic-view/basic-view.component.ts | 6 +-
.../input-schema-property.component.ts | 8 +-
.../pipeline-element-documentation.component.ts | 6 +-
.../pipeline-element-runtime-info.component.ts | 11 +-
.../exception-details-dialog.component.ts | 9 +-
.../sp-exception-message.component.ts | 4 +-
.../lib/components/sp-label/sp-label.component.ts | 5 +-
.../sp-table/sp-paginator/sp-paginator.service.ts | 6 +-
.../time-selector/time-range-selector.component.ts | 5 +-
.../custom-time-range-selection.component.ts | 21 +-
.../time-selector-menu.component.ts | 5 +-
.../lib/dialog/base-dialog/base-dialog.service.ts | 8 +-
.../components/download/download.component.ts | 6 +-
.../data-download-dialog.component.ts | 10 +-
.../services/data-export.service.ts | 12 +-
.../pipeline-element-help.component.ts | 5 +-
.../src/lib/services/current-user.service.ts | 4 +-
.../src/lib/services/date-format.service.ts | 4 +-
ui/src/app/apidocs/apidocs.component.ts | 4 +-
ui/src/app/app.component.ts | 14 +-
.../asset-details-basics.component.ts | 5 +-
.../asset-details-labels.component.ts | 9 +-
.../asset-location/asset-location.component.ts | 6 +-
.../asset-details-links.component.ts | 13 +-
.../view-assset-basics.component.ts | 12 +-
.../view-asset-labels.component.ts | 5 +-
.../asset-overview/asset-overview.component.ts | 22 +-
.../create-asset/create-asset-dialog.component.ts | 11 +-
.../edit-asset-link-dialog.component.ts | 43 ++--
.../manage-asset-links-dialog.component.ts | 43 ++--
.../color-mapping-options-config.component.ts | 5 +-
.../echarts-widget-appearance-config.component.ts | 8 +-
.../select-color-properties-config.component.ts | 15 +-
.../chart-container/chart-container.component.ts | 25 ++-
.../components/chart-container/chart.directive.ts | 4 +-
.../gauge/config/gauge-widget-config.component.ts | 10 +-
.../config/heatmap-widget-config.component.ts | 10 +-
.../indicator-appearance-config.component.ts | 8 +-
.../map/config/map-widget-config.component.ts | 10 +-
.../config/pie-chart-widget-config.component.ts | 10 +-
.../status-heatmap-widget-config.component.ts | 10 +-
.../config/status-widget-config.component.ts | 10 +-
.../table/config/table-widget-config.component.ts | 10 +-
.../charts/table/table-widget.component.ts | 14 +-
.../time-series-appearance-config.component.ts | 8 +-
.../time-series-chart-widget-config.component.ts | 10 +-
.../traffic-light-widget-config.component.ts | 8 +-
.../registry/chart-registry.service.ts | 26 +--
.../chart-shared/services/chart-routing.service.ts | 6 +-
.../chart-appearance-settings.component.ts | 12 +-
.../aggregate-configuration.component.ts | 4 +-
.../data-settings/chart-data-settings.component.ts | 15 +-
.../field-selection-panel.component.ts | 17 +-
.../field-selection/field-selection.component.ts | 13 +-
...ction-panel-row-value-autocomplete.component.ts | 13 +-
...er-selection-panel-row-value-input.component.ts | 13 +-
.../filter-selection-panel.component.ts | 18 +-
.../group-selection-panel.component.ts | 10 +-
.../order-selection-panel.component.ts | 6 +-
.../chart-visualisation-settings.component.ts | 9 +-
.../extensions-installation.component.ts | 13 +-
.../extensions-service-details-dialog.component.ts | 9 +-
.../file-rename/file-rename-dialog.component.ts | 8 +-
.../file-upload/file-upload-dialog.component.ts | 8 +-
.../email-configuration.component.ts | 16 +-
.../email-template-configuration.component.ts | 8 +-
.../export/data-export-import.component.ts | 16 +-
.../configuration/export/data-export.service.ts | 8 +-
.../export-dialog/data-export-dialog.component.ts | 11 +-
.../import-dialog/data-import-dialog.component.ts | 9 +-
.../endpoint-item/endpoint-item.component.ts | 27 ++-
.../extensions-installation.component.ts | 18 +-
.../extensions-installation.service.ts | 8 +-
.../extensions-service-configuration.component.ts | 6 +-
.../service-configs-boolean.component.ts | 5 +-
.../service-configs-number.component.ts | 5 +-
.../service-configs-password.component.ts | 6 +-
.../service-configs-text.component.ts | 5 +-
.../extensions-service-management.component.ts | 10 +-
.../registered-extensions-services.component.ts | 12 +-
.../files/file-overview/file-overview.component.ts | 12 +-
ui/src/app/configuration/files/files.component.ts | 14 +-
.../general-configuration.component.ts | 20 +-
.../label-configuration.component.ts | 12 +-
.../authentication-configuration.component.ts | 4 +-
.../edit-group-dialog.component.ts | 20 +-
.../edit-role-dialog/edit-role-dialog.component.ts | 14 +-
.../edit-user-dialog/edit-user-dialog.component.ts | 32 +--
.../role-configuration.component.ts | 14 +-
.../user-group-configuration.component.ts | 14 +-
.../configuration/shared/configuration.service.ts | 226 ++++++++++-----------
.../location-features-configuration.component.ts | 14 +-
.../site-area-configuration.component.ts | 12 +-
.../adapter-code-panel.component.ts | 6 +-
.../adapter-deployment-settings.component.ts | 13 +-
.../configuration-group.component.ts | 6 +-
.../adapter-details-data.component.ts | 19 +-
.../adapter-details-logs.component.ts | 16 +-
.../adapter-details-metrics.component.ts | 16 +-
.../create-adapter/create-adapter.component.ts | 12 +-
.../adapter-documentation-dialog.component.ts | 9 +-
.../adapter-started-preview.component.ts | 10 +-
.../adapter-template-dialog.component.ts | 12 +-
.../delete-adapter-dialog.component.ts | 11 +-
.../edit-schema-transformation.component.ts | 19 +-
.../all-adapter-actions-dialog.component.ts | 13 +-
.../connect/services/adapter-template.service.ts | 4 +-
ui/src/app/connect/services/rest.service.ts | 8 +-
.../pipeline-element-template-config.component.ts | 10 +-
.../static-alternatives.component.ts | 7 +-
.../add-to-collection.component.ts | 4 +-
.../static-color-picker.component.ts | 6 +-
.../static-file-input.component.ts | 10 +-
.../static-mapping-nary.component.ts | 6 +-
.../static-property-util.service.ts | 4 +-
...tatic-runtime-resolvable-any-input.component.ts | 6 +-
.../static-runtime-resolvable-group.component.ts | 5 +-
.../runtime-resolvable.service.ts | 8 +-
...tic-runtime-resolvable-oneof-input.component.ts | 6 +-
...atic-runtime-resolvable-tree-input.component.ts | 13 +-
.../static-tree-input-browse-nodes.component.ts | 9 +-
.../static-secret-input.component.ts | 6 +-
ui/src/app/core-ui/topics/topics.component.ts | 4 +-
.../guards/auth.can-activate-children.guard.ts | 4 +-
.../auth/guards/page-auth.can-activate.guard.ts | 4 +-
.../setup/guards/configured.can-activate.guard.ts | 7 +-
.../registration-allowed.can-activate.guard.ts | 8 +-
.../restore-password-allowed.can-activate.guard.ts | 8 +-
.../dashboard-shared/services/dashboard.service.ts | 8 +-
.../chart-preview/chart-preview.component.ts | 13 +-
.../chart-selection/chart-selection.component.ts | 8 +-
.../custom-output-strategy.component.ts | 8 +-
.../user-defined-output.component.ts | 6 +-
...ine-assembly-drawing-area-pan-zoom.component.ts | 9 +-
.../pipeline-assembly-drawing-area.component.ts | 17 +-
...ne-assembly-options-pipeline-cache.component.ts | 10 +-
.../pipeline-assembly-options.component.ts | 15 +-
.../pipeline-assembly.component.ts | 30 +--
.../pipeline-element-icon-stand-row.component.ts | 6 +-
.../pipeline-element-icon-stand.component.ts | 10 +-
.../pipeline-element-options.component.ts | 19 +-
.../pipeline-element-preview.component.ts | 6 +-
.../components/pipeline/pipeline.component.ts | 29 +--
.../add-template-dialog.component.ts | 11 +-
.../compatible-elements.component.ts | 11 +-
.../editor/dialog/customize/customize.component.ts | 23 ++-
.../matching-error/matching-error.component.ts | 6 +-
.../missing-elements-for-tutorial.component.ts | 9 +-
.../pipeline-element-discovery.component.ts | 11 +-
ui/src/app/editor/editor.component.ts | 22 +-
ui/src/app/editor/services/editor.service.ts | 14 +-
.../editor/services/jsplumb-endpoint.service.ts | 4 +-
.../app/editor/services/jsplumb-factory.service.ts | 12 +-
ui/src/app/editor/services/jsplumb.service.ts | 12 +-
.../app/editor/services/object-provider.service.ts | 8 +-
.../services/pipeline-positioning.service.ts | 10 +-
.../app/editor/services/pipeline-style.service.ts | 8 +-
.../editor/services/pipeline-validation.service.ts | 6 +-
ui/src/app/editor/utils/style-sanitizer.ts | 4 +-
.../dialog/welcome-tour/welcome-tour.component.ts | 14 +-
ui/src/app/http-interceptor.ts | 4 +-
ui/src/app/info/info.component.ts | 4 +-
ui/src/app/info/versions/versions.component.ts | 6 +-
.../components/auth-box/auth-box.component.ts | 6 +-
.../login/components/startup/startup.component.ts | 12 +-
.../login/services/account-activation.service.ts | 8 +-
ui/src/app/login/services/login.service.ts | 8 +-
.../app/login/services/restore-password.service.ts | 8 +-
.../components/notification-item.component.ts | 6 +-
.../app/notifications/notifications.component.ts | 17 +-
.../notifications/service/notifications.service.ts | 8 +-
.../actions/pipeline-actions.component.ts | 17 +-
.../pipeline-element-details-row.component.ts | 6 +-
.../status/pipeline-status.component.ts | 6 +-
.../preview/pipeline-preview.component.ts | 5 +-
.../pipeline-code-dialog.component.ts | 11 +-
.../pipeline-logs-dialog.component.ts | 7 +-
.../pipeline-details/pipeline-details.component.ts | 22 +-
.../functions-overview.component.ts | 6 +-
.../pipeline-notifications.component.ts | 11 +-
.../services/pipeline-operations.service.ts | 10 +-
.../general/general-profile-settings.component.ts | 19 +-
.../change-email/change-email-dialog.component.ts | 19 +-
.../change-password-dialog.component.ts | 19 +-
ui/src/app/profile/profile.component.ts | 6 +-
ui/src/app/profile/profile.service.ts | 8 +-
ui/src/app/services/auth.service.ts | 18 +-
ui/src/app/services/available-roles.service.ts | 6 +-
ui/src/app/services/notification-count-service.ts | 6 +-
ui/src/app/services/rest-api.service.ts | 8 +-
ui/src/app/services/secure.pipe.ts | 10 +-
ui/src/app/services/tour/shepherd.service.ts | 12 +-
196 files changed, 1190 insertions(+), 1122 deletions(-)
(streampipes) 16/24: migrate pipeline details UI to inject()
Posted by ze...@apache.org.
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 3dd8545ec7b0c21034c78db7b5a253d85d3b2d43
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:01:33 2026 +0100
migrate pipeline details UI to inject()
---
.../actions/pipeline-actions.component.ts | 17 +++++++++++------
.../pipeline-element-details-row.component.ts | 6 +++---
.../status/pipeline-status.component.ts | 6 ++++--
.../preview/pipeline-preview.component.ts | 5 +++--
.../pipeline-code-dialog.component.ts | 11 +++++------
.../pipeline-logs-dialog.component.ts | 7 ++++---
.../pipeline-details/pipeline-details.component.ts | 22 ++++++++++------------
7 files changed, 40 insertions(+), 34 deletions(-)
diff --git a/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/actions/pipeline-actions.component.ts b/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/actions/pipeline-actions.component.ts
index d29b8b8449..de64d3c9b5 100644
--- a/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/actions/pipeline-actions.component.ts
+++ b/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/actions/pipeline-actions.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { PipelineOperationsService } from '../../../../pipelines/services/pipeline-operations.service';
import { Pipeline } from '@streampipes/platform-services';
import { Router } from '@angular/router';
@@ -44,6 +51,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineActionsComponent implements OnInit {
+ pipelineOperationsService = inject(PipelineOperationsService);
+ private router = inject(Router);
+
starting = false;
stopping = false;
@@ -56,11 +66,6 @@ export class PipelineActionsComponent implements OnInit {
@Output()
reloadPipelineEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
- constructor(
- public pipelineOperationsService: PipelineOperationsService,
- private router: Router,
- ) {}
-
ngOnInit() {
this.toggleRunningOperation = this.toggleRunningOperation.bind(this);
this.switchToPipelineView = this.switchToPipelineView.bind(this);
diff --git a/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/pipeline-element-details-row/pipeline-element-details-row.component.ts b/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/pipeline-element-details-row/pipeline-element-details-row.component.ts
index cf1add2b5c..e1343e09aa 100644
--- a/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/pipeline-element-details-row/pipeline-element-details-row.component.ts
+++ b/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/pipeline-element-details-row/pipeline-element-details-row.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { PipelineElementUnion } from '../../../../editor/model/editor.model';
import { SpLogEntry } from '@streampipes/platform-services';
import { DialogService, PanelType } from '@streampipes/shared-ui';
@@ -47,6 +47,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineElementDetailsRowComponent {
+ private dialogService = inject(DialogService);
+
@Input()
pipelineElement: PipelineElementUnion;
@@ -56,8 +58,6 @@ export class PipelineElementDetailsRowComponent {
@Input()
logInfo: SpLogEntry[] = [];
- constructor(private dialogService: DialogService) {}
-
openLogsDialog(): void {
this.dialogService.open(PipelineLogsDialogComponent, {
panelType: PanelType.SLIDE_IN_PANEL,
diff --git a/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/status/pipeline-status.component.ts b/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/status/pipeline-status.component.ts
index 40b913278b..5d807237cf 100644
--- a/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/status/pipeline-status.component.ts
+++ b/ui/src/app/pipeline-details/components/pipeline-details-expansion-panel/status/pipeline-status.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
Pipeline,
PipelineService,
@@ -45,12 +45,14 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineStatusComponent implements OnInit {
+ private pipelineService = inject(PipelineService);
+
pipelineStatus: PipelineStatusMessage[];
@Input()
pipeline: Pipeline;
- constructor(private pipelineService: PipelineService) {
+ constructor() {
this.pipelineStatus = [];
}
diff --git a/ui/src/app/pipeline-details/components/preview/pipeline-preview.component.ts b/ui/src/app/pipeline-details/components/preview/pipeline-preview.component.ts
index 7bd623b356..cfdc40ee34 100644
--- a/ui/src/app/pipeline-details/components/preview/pipeline-preview.component.ts
+++ b/ui/src/app/pipeline-details/components/preview/pipeline-preview.component.ts
@@ -24,6 +24,7 @@ import {
OnInit,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import {
Pipeline,
@@ -46,6 +47,8 @@ import { FlexDirective } from '@ngbracket/ngx-layout/flex';
imports: [FlexDirective, PipelineAssemblyDrawingAreaComponent],
})
export class PipelinePreviewComponent implements OnInit, AfterViewInit {
+ private jsplumbService = inject(JsplumbService);
+
@Input()
metricsInfo: Record<string, SpMetricsEntry>;
@@ -66,8 +69,6 @@ export class PipelinePreviewComponent implements OnInit, AfterViewInit {
jsPlumbBridge: JsplumbBridge;
- constructor(private jsplumbService: JsplumbService) {}
-
ngAfterViewInit() {
this.jsPlumbBridge = this.jsplumbService.getBridge(true);
}
diff --git a/ui/src/app/pipeline-details/dialogs/pipeline-code/pipeline-code-dialog.component.ts b/ui/src/app/pipeline-details/dialogs/pipeline-code/pipeline-code-dialog.component.ts
index 227c53222c..0ad906e31e 100644
--- a/ui/src/app/pipeline-details/dialogs/pipeline-code/pipeline-code-dialog.component.ts
+++ b/ui/src/app/pipeline-details/dialogs/pipeline-code/pipeline-code-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
CompactPipeline,
Pipeline,
@@ -42,16 +42,15 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineCodeDialogComponent implements OnInit {
+ private pipelineService = inject(PipelineService);
+ private dialogRef =
+ inject<DialogRef<PipelineCodeDialogComponent>>(DialogRef);
+
@Input()
pipeline: Pipeline;
compactPipeline: CompactPipeline;
- constructor(
- private pipelineService: PipelineService,
- private dialogRef: DialogRef<PipelineCodeDialogComponent>,
- ) {}
-
ngOnInit() {
this.pipelineService
.convertToCompactPipeline(this.pipeline)
diff --git a/ui/src/app/pipeline-details/dialogs/pipeline-logs/pipeline-logs-dialog.component.ts b/ui/src/app/pipeline-details/dialogs/pipeline-logs/pipeline-logs-dialog.component.ts
index acf350a299..5a7cb11d92 100644
--- a/ui/src/app/pipeline-details/dialogs/pipeline-logs/pipeline-logs-dialog.component.ts
+++ b/ui/src/app/pipeline-details/dialogs/pipeline-logs/pipeline-logs-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { SpLogEntry } from '@streampipes/platform-services';
import { DialogRef } from '@streampipes/shared-ui';
import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
@@ -39,11 +39,12 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineLogsDialogComponent {
+ private dialogRef =
+ inject<DialogRef<PipelineLogsDialogComponent>>(DialogRef);
+
@Input()
logInfo: SpLogEntry[] = [];
- constructor(private dialogRef: DialogRef<PipelineLogsDialogComponent>) {}
-
close() {
this.dialogRef.close();
}
diff --git a/ui/src/app/pipeline-details/pipeline-details.component.ts b/ui/src/app/pipeline-details/pipeline-details.component.ts
index 2419c8e5bb..8a0e573f2f 100644
--- a/ui/src/app/pipeline-details/pipeline-details.component.ts
+++ b/ui/src/app/pipeline-details/pipeline-details.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
+import { Component, OnDestroy, OnInit, ViewChild, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AuthService } from '../services/auth.service';
import {
@@ -69,6 +69,15 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpPipelineDetailsComponent implements OnInit, OnDestroy {
+ private activatedRoute = inject(ActivatedRoute);
+ private pipelineService = inject(PipelineService);
+ private pipelineCanvasService = inject(PipelineCanvasMetadataService);
+ private authService = inject(AuthService);
+ private currentUserService = inject(CurrentUserService);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private pipelineMonitoringService = inject(PipelineMonitoringService);
+ private dialogService = inject(DialogService);
+
hasPipelineWritePrivileges = false;
currentPipelineId: string;
@@ -90,17 +99,6 @@ export class SpPipelineDetailsComponent implements OnInit, OnDestroy {
@ViewChild('pipelinePreviewComponent')
pipelinePreviewComponent: PipelinePreviewComponent;
- constructor(
- private activatedRoute: ActivatedRoute,
- private pipelineService: PipelineService,
- private pipelineCanvasService: PipelineCanvasMetadataService,
- private authService: AuthService,
- private currentUserService: CurrentUserService,
- private breadcrumbService: SpBreadcrumbService,
- private pipelineMonitoringService: PipelineMonitoringService,
- private dialogService: DialogService,
- ) {}
-
ngOnInit(): void {
this.currentUser$ = this.currentUserService.user$.subscribe(user => {
this.hasPipelineWritePrivileges = this.authService.hasRole(
(streampipes) 06/24: migrate profile UI to inject()
Posted by ze...@apache.org.
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 c60dccdfb6bec5e60153404a8154f96decb03847
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:57:29 2026 +0100
migrate profile UI to inject()
---
.../general/general-profile-settings.component.ts | 19 ++++++++++---------
.../change-email/change-email-dialog.component.ts | 19 ++++++++++++-------
.../change-password-dialog.component.ts | 19 ++++++++++++-------
ui/src/app/profile/profile.component.ts | 6 +++---
ui/src/app/profile/profile.service.ts | 8 +++-----
5 files changed, 40 insertions(+), 31 deletions(-)
diff --git a/ui/src/app/profile/components/general/general-profile-settings.component.ts b/ui/src/app/profile/components/general/general-profile-settings.component.ts
index cffdd08ece..ec6c816b0c 100644
--- a/ui/src/app/profile/components/general/general-profile-settings.component.ts
+++ b/ui/src/app/profile/components/general/general-profile-settings.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Component, OnDestroy, OnInit, inject } from '@angular/core';
import { ProfileService } from '../../profile.service';
import { BasicProfileSettings } from '../basic-profile-settings';
import { AppConstants } from '../../../services/app.constants';
@@ -72,6 +72,9 @@ export class GeneralProfileSettingsComponent
extends BasicProfileSettings
implements OnInit, OnDestroy
{
+ private dialogService = inject(DialogService);
+ private router = inject(Router);
+
darkMode = false;
originalDarkMode = false;
darkModeChanged = false;
@@ -84,14 +87,12 @@ export class GeneralProfileSettingsComponent
{ label: 'Polski', id: 'pl' },
];
- constructor(
- authService: AuthService,
- profileService: ProfileService,
- appConstants: AppConstants,
- currentUserService: CurrentUserService,
- private dialogService: DialogService,
- private router: Router,
- ) {
+ constructor() {
+ const authService = inject(AuthService);
+ const profileService = inject(ProfileService);
+ const appConstants = inject(AppConstants);
+ const currentUserService = inject(CurrentUserService);
+
super(profileService, appConstants, currentUserService, authService);
}
diff --git a/ui/src/app/profile/dialog/change-email/change-email-dialog.component.ts b/ui/src/app/profile/dialog/change-email/change-email-dialog.component.ts
index 6265aa25cd..04e93e756e 100644
--- a/ui/src/app/profile/dialog/change-email/change-email-dialog.component.ts
+++ b/ui/src/app/profile/dialog/change-email/change-email-dialog.component.ts
@@ -16,7 +16,13 @@
*
*/
-import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
+import {
+ Component,
+ Input,
+ OnInit,
+ ViewEncapsulation,
+ inject,
+} from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import {
AbstractControl,
@@ -55,6 +61,11 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class ChangeEmailDialogComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<ChangeEmailDialogComponent>>(DialogRef);
+ private fb = inject(UntypedFormBuilder);
+ private userService = inject(UserService);
+
parentForm: UntypedFormGroup;
@Input()
@@ -70,12 +81,6 @@ export class ChangeEmailDialogComponent implements OnInit {
error = false;
errorMessage = '';
- constructor(
- private dialogRef: DialogRef<ChangeEmailDialogComponent>,
- private fb: UntypedFormBuilder,
- private userService: UserService,
- ) {}
-
ngOnInit(): void {
this.clonedUser = UserAccount.fromData(this.user);
this.email = this.clonedUser.username;
diff --git a/ui/src/app/profile/dialog/change-password/change-password-dialog.component.ts b/ui/src/app/profile/dialog/change-password/change-password-dialog.component.ts
index c128920388..67a82d9b81 100644
--- a/ui/src/app/profile/dialog/change-password/change-password-dialog.component.ts
+++ b/ui/src/app/profile/dialog/change-password/change-password-dialog.component.ts
@@ -16,7 +16,13 @@
*
*/
-import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
+import {
+ Component,
+ Input,
+ OnInit,
+ ViewEncapsulation,
+ inject,
+} from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import {
AbstractControl,
@@ -59,6 +65,11 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class ChangePasswordDialogComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<ChangePasswordDialogComponent>>(DialogRef);
+ private fb = inject(UntypedFormBuilder);
+ private userService = inject(UserService);
+
@Input()
user: UserAccount;
@@ -72,12 +83,6 @@ export class ChangePasswordDialogComponent implements OnInit {
error = false;
errorMessage = '';
- constructor(
- private dialogRef: DialogRef<ChangePasswordDialogComponent>,
- private fb: UntypedFormBuilder,
- private userService: UserService,
- ) {}
-
ngOnInit(): void {
this.parentForm = this.fb.group({});
this.parentForm.addControl(
diff --git a/ui/src/app/profile/profile.component.ts b/ui/src/app/profile/profile.component.ts
index 2d9611b485..8496d979ee 100644
--- a/ui/src/app/profile/profile.component.ts
+++ b/ui/src/app/profile/profile.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
SpBasicViewComponent,
SpBreadcrumbService,
@@ -48,9 +48,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ProfileComponent implements OnInit {
- selectedIndex = 0;
+ private breadcrumbService = inject(SpBreadcrumbService);
- constructor(private breadcrumbService: SpBreadcrumbService) {}
+ selectedIndex = 0;
ngOnInit(): void {
this.breadcrumbService.updateBreadcrumb([{ label: 'Profile' }]);
diff --git a/ui/src/app/profile/profile.service.ts b/ui/src/app/profile/profile.service.ts
index 19061ca8c5..0ae362a6b8 100644
--- a/ui/src/app/profile/profile.service.ts
+++ b/ui/src/app/profile/profile.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
Message,
PlatformServicesCommons,
@@ -29,10 +29,8 @@ import { map } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class ProfileService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
getUserProfile(username: string): Observable<UserAccount> {
return this.http.get(this.profilePath + '/username/' + username).pipe(
(streampipes) 20/24: migrate connect UI to inject()
Posted by ze...@apache.org.
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 a5f2a271ef7d3779585caa0d0d4d5b4256410635
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:04:36 2026 +0100
migrate connect UI to inject()
---
.../adapter-code-panel.component.ts | 6 +++---
.../adapter-deployment-settings.component.ts | 13 +++++++++++--
.../configuration-group.component.ts | 6 +++---
.../adapter-details-data.component.ts | 19 ++++++++++---------
.../adapter-details-logs.component.ts | 16 ++++++++--------
.../adapter-details-metrics.component.ts | 16 ++++++++--------
.../create-adapter/create-adapter.component.ts | 12 +++++-------
.../adapter-documentation-dialog.component.ts | 9 ++++-----
.../adapter-started-preview.component.ts | 10 ++++------
.../adapter-template-dialog.component.ts | 12 ++++++------
.../delete-adapter-dialog.component.ts | 11 +++++------
.../edit-schema-transformation.component.ts | 19 ++++++++++++-------
.../all-adapter-actions-dialog.component.ts | 13 +++++++------
.../app/connect/services/adapter-template.service.ts | 4 ++--
ui/src/app/connect/services/rest.service.ts | 8 +++-----
15 files changed, 91 insertions(+), 83 deletions(-)
diff --git a/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.ts b/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.ts
index 993f71e6f3..c5586757ac 100644
--- a/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.ts
+++ b/ui/src/app/connect/components/adapter-code-panel/adapter-code-panel.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
AdapterDescription,
AdapterService,
@@ -32,6 +32,8 @@ import { ConfigurationCodePanelComponent } from '../../../core-ui/configuration-
imports: [FlexDirective, ConfigurationCodePanelComponent],
})
export class AdapterCodePanelComponent implements OnInit {
+ private adapterService = inject(AdapterService);
+
@Input()
adapterDescription: AdapterDescription;
@@ -40,8 +42,6 @@ export class AdapterCodePanelComponent implements OnInit {
compactAdapter: CompactAdapter;
- constructor(private adapterService: AdapterService) {}
-
ngOnInit(): void {
this.adapterService
.convertToCompactAdapter(this.adapterDescription)
diff --git a/ui/src/app/connect/components/adapter-configuration/adapter-settings/adapter-deployment-settings/adapter-deployment-settings.component.ts b/ui/src/app/connect/components/adapter-configuration/adapter-settings/adapter-deployment-settings/adapter-deployment-settings.component.ts
index 4ee994f11f..edc80ef422 100644
--- a/ui/src/app/connect/components/adapter-configuration/adapter-settings/adapter-deployment-settings/adapter-deployment-settings.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/adapter-settings/adapter-deployment-settings/adapter-deployment-settings.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
+import {
+ Component,
+ ElementRef,
+ Input,
+ OnInit,
+ ViewChild,
+ inject,
+} from '@angular/core';
import {
ExtensionDeploymentConfiguration,
ServiceTagService,
@@ -75,6 +82,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpAdapterDeploymentSettingsComponent implements OnInit {
+ private serviceTagService = inject(ServiceTagService);
+
@Input()
deploymentConfiguration: ExtensionDeploymentConfiguration;
@@ -89,7 +98,7 @@ export class SpAdapterDeploymentSettingsComponent implements OnInit {
@ViewChild('serviceTagInput') serviceTagInput: ElementRef<HTMLInputElement>;
- constructor(private serviceTagService: ServiceTagService) {
+ constructor() {
this.filteredServiceTags = this.serviceTagCtrl.valueChanges.pipe(
startWith(null),
map((serviceTagValue: string | null) => {
diff --git a/ui/src/app/connect/components/adapter-configuration/adapter-settings/configuration-group/configuration-group.component.ts b/ui/src/app/connect/components/adapter-configuration/adapter-settings/configuration-group/configuration-group.component.ts
index 0dd10f742a..f930d5477b 100644
--- a/ui/src/app/connect/components/adapter-configuration/adapter-settings/configuration-group/configuration-group.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/adapter-settings/configuration-group/configuration-group.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
@@ -43,6 +43,8 @@ import { StaticPropertyComponent } from '../../../../../core-ui/static-propertie
],
})
export class ConfigurationGroupComponent implements OnInit {
+ private staticPropertyUtils = inject(StaticPropertyUtilService);
+
@Input() configurationGroup: UntypedFormGroup;
@Input() adapterId: string;
@@ -53,8 +55,6 @@ export class ConfigurationGroupComponent implements OnInit {
completedConfigurations: ConfigurationInfo[] = [];
- constructor(private staticPropertyUtils: StaticPropertyUtilService) {}
-
ngOnInit() {
this.completedConfigurations =
this.staticPropertyUtils.initializeCompletedConfigurations(
diff --git a/ui/src/app/connect/components/adapter-details/adapter-details-data/adapter-details-data.component.ts b/ui/src/app/connect/components/adapter-details/adapter-details-data/adapter-details-data.component.ts
index 19aba9a9bd..562d259d3c 100644
--- a/ui/src/app/connect/components/adapter-details/adapter-details-data/adapter-details-data.component.ts
+++ b/ui/src/app/connect/components/adapter-details/adapter-details-data/adapter-details-data.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { SpAbstractAdapterDetailsDirective } from '../abstract-adapter-details.directive';
import {
CurrentUserService,
@@ -57,16 +57,17 @@ export class AdapterDetailsDataComponent
extends SpAbstractAdapterDetailsDirective
implements OnInit
{
+ private pipelineElementService = inject(PipelineElementService);
+
stream: SpDataStream;
- constructor(
- currentUserService: CurrentUserService,
- activatedRoute: ActivatedRoute,
- adapterService: AdapterService,
- adapterMonitoringService: AdapterMonitoringService,
- breadcrumbService: SpBreadcrumbService,
- private pipelineElementService: PipelineElementService,
- ) {
+ constructor() {
+ const currentUserService = inject(CurrentUserService);
+ const activatedRoute = inject(ActivatedRoute);
+ const adapterService = inject(AdapterService);
+ const adapterMonitoringService = inject(AdapterMonitoringService);
+ const breadcrumbService = inject(SpBreadcrumbService);
+
super(
currentUserService,
activatedRoute,
diff --git a/ui/src/app/connect/components/adapter-details/adapter-details-logs/adapter-details-logs.component.ts b/ui/src/app/connect/components/adapter-details/adapter-details-logs/adapter-details-logs.component.ts
index 49171a5bf8..60be30f665 100644
--- a/ui/src/app/connect/components/adapter-details/adapter-details-logs/adapter-details-logs.component.ts
+++ b/ui/src/app/connect/components/adapter-details/adapter-details-logs/adapter-details-logs.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { SpAbstractAdapterDetailsDirective } from '../abstract-adapter-details.directive';
import { ActivatedRoute } from '@angular/router';
import {
@@ -61,13 +61,13 @@ export class SpAdapterDetailsLogsComponent
{
adapterLogs: SpLogEntry[];
- constructor(
- currentUserService: CurrentUserService,
- activatedRoute: ActivatedRoute,
- adapterService: AdapterService,
- adapterMonitoringService: AdapterMonitoringService,
- breadcrumbService: SpBreadcrumbService,
- ) {
+ constructor() {
+ const currentUserService = inject(CurrentUserService);
+ const activatedRoute = inject(ActivatedRoute);
+ const adapterService = inject(AdapterService);
+ const adapterMonitoringService = inject(AdapterMonitoringService);
+ const breadcrumbService = inject(SpBreadcrumbService);
+
super(
currentUserService,
activatedRoute,
diff --git a/ui/src/app/connect/components/adapter-details/adapter-details-metrics/adapter-details-metrics.component.ts b/ui/src/app/connect/components/adapter-details/adapter-details-metrics/adapter-details-metrics.component.ts
index 2732b6190e..aaa07ace13 100644
--- a/ui/src/app/connect/components/adapter-details/adapter-details-metrics/adapter-details-metrics.component.ts
+++ b/ui/src/app/connect/components/adapter-details/adapter-details-metrics/adapter-details-metrics.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { SpAbstractAdapterDetailsDirective } from '../abstract-adapter-details.directive';
import { ActivatedRoute } from '@angular/router';
import {
@@ -61,13 +61,13 @@ export class SpAdapterDetailsMetricsComponent
{
adapterMetrics: SpMetricsEntry;
- constructor(
- currentUserService: CurrentUserService,
- activatedRoute: ActivatedRoute,
- adapterService: AdapterService,
- adapterMonitoringService: AdapterMonitoringService,
- breadcrumbService: SpBreadcrumbService,
- ) {
+ constructor() {
+ const currentUserService = inject(CurrentUserService);
+ const activatedRoute = inject(ActivatedRoute);
+ const adapterService = inject(AdapterService);
+ const adapterMonitoringService = inject(AdapterMonitoringService);
+ const breadcrumbService = inject(SpBreadcrumbService);
+
super(
currentUserService,
activatedRoute,
diff --git a/ui/src/app/connect/components/create-adapter/create-adapter.component.ts b/ui/src/app/connect/components/create-adapter/create-adapter.component.ts
index dd2c669b71..7ddbfe7c53 100644
--- a/ui/src/app/connect/components/create-adapter/create-adapter.component.ts
+++ b/ui/src/app/connect/components/create-adapter/create-adapter.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
AdapterDescription,
AdapterService,
@@ -33,16 +33,14 @@ import { AdapterConfigurationComponent } from '../adapter-configuration/adapter-
imports: [AdapterConfigurationComponent],
})
export class CreateAdapterComponent implements OnInit {
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private adapterService = inject(AdapterService);
+ private route = inject(ActivatedRoute);
+
initialized = false;
adapterTypeName = '';
adapter: AdapterDescription = undefined;
- constructor(
- private breadcrumbService: SpBreadcrumbService,
- private adapterService: AdapterService,
- private route: ActivatedRoute,
- ) {}
-
ngOnInit(): void {
this.adapterService.getAdapterDescriptions().subscribe(adapters => {
const adapter = this.findAdapterWithAppIdFromRoute(adapters);
diff --git a/ui/src/app/connect/dialog/adapter-documentation/adapter-documentation-dialog.component.ts b/ui/src/app/connect/dialog/adapter-documentation/adapter-documentation-dialog.component.ts
index 12e10bbaf1..dc142de89d 100644
--- a/ui/src/app/connect/dialog/adapter-documentation/adapter-documentation-dialog.component.ts
+++ b/ui/src/app/connect/dialog/adapter-documentation/adapter-documentation-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import {
DialogRef,
PipelineElementDocumentationComponent,
@@ -30,10 +30,9 @@ import { MatButton } from '@angular/material/button';
imports: [PipelineElementDocumentationComponent, MatDivider, MatButton],
})
export class SpAdapterDocumentationDialogComponent {
+ dialogRef =
+ inject<DialogRef<SpAdapterDocumentationDialogComponent>>(DialogRef);
+
@Input()
appId: string;
-
- constructor(
- public dialogRef: DialogRef<SpAdapterDocumentationDialogComponent>,
- ) {}
}
diff --git a/ui/src/app/connect/dialog/adapter-started/adapter-started-preview/adapter-started-preview.component.ts b/ui/src/app/connect/dialog/adapter-started/adapter-started-preview/adapter-started-preview.component.ts
index d197b6d066..32005967e4 100644
--- a/ui/src/app/connect/dialog/adapter-started/adapter-started-preview/adapter-started-preview.component.ts
+++ b/ui/src/app/connect/dialog/adapter-started/adapter-started-preview/adapter-started-preview.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { AdapterService, SpDataStream } from '@streampipes/platform-services';
import { RestService } from '../../../services/rest.service';
import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
@@ -32,17 +32,15 @@ import { PipelineElementRuntimeInfoComponent } from '@streampipes/shared-ui';
],
})
export class SpAdapterStartedPreviewComponent implements OnInit {
+ private adapterService = inject(AdapterService);
+ private restService = inject(RestService);
+
@Input()
streamDescription: SpDataStream;
@Input()
adapterElementId: string;
- constructor(
- private adapterService: AdapterService,
- private restService: RestService,
- ) {}
-
ngOnInit() {
this.getLiveViewPreview();
}
diff --git a/ui/src/app/connect/dialog/adapter-template/adapter-template-dialog.component.ts b/ui/src/app/connect/dialog/adapter-template/adapter-template-dialog.component.ts
index 690045bcae..85ef23d09e 100644
--- a/ui/src/app/connect/dialog/adapter-template/adapter-template-dialog.component.ts
+++ b/ui/src/app/connect/dialog/adapter-template/adapter-template-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
PipelineElementTemplate,
PipelineElementTemplateService,
@@ -40,6 +40,11 @@ import { MatButton } from '@angular/material/button';
],
})
export class SpAdapterTemplateDialogComponent implements OnInit {
+ dialogRef = inject<DialogRef<SpAdapterTemplateDialogComponent>>(DialogRef);
+ private pipelineElementTemplateService = inject(
+ PipelineElementTemplateService,
+ );
+
@Input()
configs: StaticPropertyUnion[];
@@ -49,11 +54,6 @@ export class SpAdapterTemplateDialogComponent implements OnInit {
template: PipelineElementTemplate;
templateConfigs: Map<string, any>[] = [];
- constructor(
- public dialogRef: DialogRef<SpAdapterTemplateDialogComponent>,
- private pipelineElementTemplateService: PipelineElementTemplateService,
- ) {}
-
ngOnInit(): void {
this.template = new PipelineElementTemplate();
}
diff --git a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
index d756426ec2..d374add960 100644
--- a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
+++ b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import {
AdapterDescription,
AdapterService,
@@ -47,6 +47,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class DeleteAdapterDialogComponent {
+ private dialogRef =
+ inject<DialogRef<DeleteAdapterDialogComponent>>(DialogRef);
+ private dataMarketplaceService = inject(AdapterService);
+
@Input()
adapter: AdapterDescription;
@@ -57,11 +61,6 @@ export class DeleteAdapterDialogComponent {
namesOfPipelinesUsingAdapter = '';
namesOfPipelinesNotOwnedByUser = '';
- constructor(
- private dialogRef: DialogRef<DeleteAdapterDialogComponent>,
- private dataMarketplaceService: AdapterService,
- ) {}
-
close(refreshAdapters: boolean) {
this.dialogRef.close(refreshAdapters);
}
diff --git a/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts b/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts
index 1c2a871362..ba655323e6 100644
--- a/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts
+++ b/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import {
debounceTime,
distinctUntilChanged,
@@ -78,6 +85,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class EditSchemaTransformationComponent implements OnInit {
+ private semanticTypesRestService = inject(SemanticTypesRestService);
+ private shepherdService = inject(ShepherdService);
+ private router = inject(Router);
+
@Input()
cachedProperty: EventProperty;
@@ -93,12 +104,6 @@ export class EditSchemaTransformationComponent implements OnInit {
adapterIsInEditMode: boolean;
- constructor(
- private semanticTypesRestService: SemanticTypesRestService,
- private shepherdService: ShepherdService,
- private router: Router,
- ) {}
-
ngOnInit(): void {
this.semanticTypes = this.domainPropertyControl.valueChanges.pipe(
startWith(''),
diff --git a/ui/src/app/connect/dialog/start-all-adapters/all-adapter-actions-dialog.component.ts b/ui/src/app/connect/dialog/start-all-adapters/all-adapter-actions-dialog.component.ts
index 898502bac7..dd74983228 100644
--- a/ui/src/app/connect/dialog/start-all-adapters/all-adapter-actions-dialog.component.ts
+++ b/ui/src/app/connect/dialog/start-all-adapters/all-adapter-actions-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import {
AdapterDescription,
@@ -33,6 +33,11 @@ import { MatButton } from '@angular/material/button';
imports: [FlexDirective, MatDivider, MatButton, TranslatePipe],
})
export class AllAdapterActionsComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<AllAdapterActionsComponent>>(DialogRef);
+ private adapterService = inject(AdapterService);
+ private translate = inject(TranslateService);
+
@Input()
adapters: AdapterDescription[];
@@ -46,11 +51,7 @@ export class AllAdapterActionsComponent implements OnInit {
@Input()
action: boolean;
- constructor(
- private dialogRef: DialogRef<AllAdapterActionsComponent>,
- private adapterService: AdapterService,
- private translate: TranslateService,
- ) {
+ constructor() {
this.adaptersToModify = [];
this.actionStatus = [];
this.actionFinished = false;
diff --git a/ui/src/app/connect/services/adapter-template.service.ts b/ui/src/app/connect/services/adapter-template.service.ts
index ed0f859c29..08869f7d0c 100644
--- a/ui/src/app/connect/services/adapter-template.service.ts
+++ b/ui/src/app/connect/services/adapter-template.service.ts
@@ -16,14 +16,14 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { SpAdapterTemplateDialogComponent } from '../dialog/adapter-template/adapter-template-dialog.component';
import { DialogService, PanelType } from '@streampipes/shared-ui';
import { StaticPropertyUnion } from '@streampipes/platform-services';
@Injectable({ providedIn: 'root' })
export class AdapterTemplateService {
- constructor(private dialogService: DialogService) {}
+ private dialogService = inject(DialogService);
getDialog(configs: StaticPropertyUnion[], appId: string) {
return this.dialogService.open(SpAdapterTemplateDialogComponent, {
diff --git a/ui/src/app/connect/services/rest.service.ts b/ui/src/app/connect/services/rest.service.ts
index bfd601c2d6..519191aa0b 100644
--- a/ui/src/app/connect/services/rest.service.ts
+++ b/ui/src/app/connect/services/rest.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient, HttpContext } from '@angular/common/http';
@@ -34,10 +34,8 @@ import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client';
@Injectable({ providedIn: 'root' })
export class RestService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
get connectPath() {
return this.platformServicesCommons.apiBasePath + '/connect';
(streampipes) 17/24: migrate pipelines UI to inject()
Posted by ze...@apache.org.
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 caedf02bc53ded49946c3a1cee04b2bf23a0b764
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:02:01 2026 +0100
migrate pipelines UI to inject()
---
.../functions-overview/functions-overview.component.ts | 6 +++---
.../pipeline-notifications.component.ts | 11 +++++------
ui/src/app/pipelines/services/pipeline-operations.service.ts | 10 ++++------
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/ui/src/app/pipelines/components/functions-overview/functions-overview.component.ts b/ui/src/app/pipelines/components/functions-overview/functions-overview.component.ts
index 4145f9dbe3..b5eb2a8cc3 100644
--- a/ui/src/app/pipelines/components/functions-overview/functions-overview.component.ts
+++ b/ui/src/app/pipelines/components/functions-overview/functions-overview.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { FunctionId } from '@streampipes/platform-services';
import {
MatCell,
@@ -56,6 +56,8 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class FunctionsOverviewComponent implements OnInit {
+ private router = inject(Router);
+
@Input()
functions: FunctionId[] = [];
@@ -63,8 +65,6 @@ export class FunctionsOverviewComponent implements OnInit {
displayedColumns: string[] = ['name', 'action'];
- constructor(private router: Router) {}
-
ngOnInit(): void {
this.dataSource = new MatTableDataSource<FunctionId>();
this.dataSource.data = this.functions;
diff --git a/ui/src/app/pipelines/dialog/pipeline-notifications/pipeline-notifications.component.ts b/ui/src/app/pipelines/dialog/pipeline-notifications/pipeline-notifications.component.ts
index 6408805a36..1e9ffb94ee 100644
--- a/ui/src/app/pipelines/dialog/pipeline-notifications/pipeline-notifications.component.ts
+++ b/ui/src/app/pipelines/dialog/pipeline-notifications/pipeline-notifications.component.ts
@@ -18,7 +18,7 @@
import { DialogRef } from '@streampipes/shared-ui';
import { Pipeline, PipelineService } from '@streampipes/platform-services';
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
import { MatDivider } from '@angular/material/divider';
import { MatButton } from '@angular/material/button';
@@ -37,14 +37,13 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineNotificationsComponent {
+ private dialogRef =
+ inject<DialogRef<PipelineNotificationsComponent>>(DialogRef);
+ private pipelineService = inject(PipelineService);
+
@Input()
pipeline: Pipeline;
- constructor(
- private dialogRef: DialogRef<PipelineNotificationsComponent>,
- private pipelineService: PipelineService,
- ) {}
-
acknowledgeAndClose() {
this.pipeline.pipelineNotifications = [];
if (this.pipeline.healthStatus === 'REQUIRES_ATTENTION') {
diff --git a/ui/src/app/pipelines/services/pipeline-operations.service.ts b/ui/src/app/pipelines/services/pipeline-operations.service.ts
index 19103f1cc8..ef6c64f037 100644
--- a/ui/src/app/pipelines/services/pipeline-operations.service.ts
+++ b/ui/src/app/pipelines/services/pipeline-operations.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { EventEmitter, Injectable } from '@angular/core';
+import { EventEmitter, Injectable, inject } from '@angular/core';
import { Pipeline } from '@streampipes/platform-services';
import {
PanelType,
@@ -32,14 +32,12 @@ import { PipelineNotificationsComponent } from '../dialog/pipeline-notifications
@Injectable({ providedIn: 'root' })
export class PipelineOperationsService {
+ private dialogService = inject(DialogService);
+ private router = inject(Router);
+
starting: any;
stopping: any;
- constructor(
- private dialogService: DialogService,
- private router: Router,
- ) {}
-
startPipeline(
pipelineId: string,
refreshPipelinesEmitter: EventEmitter<boolean>,
(streampipes) 19/24: migrate asset UI to inject()
Posted by ze...@apache.org.
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 338541221617c187025e00b77ffd6cdda2f971a2
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:04:07 2026 +0100
migrate asset UI to inject()
---
.../asset-details-basics.component.ts | 5 ++-
.../asset-details-labels.component.ts | 9 ++---
.../asset-location/asset-location.component.ts | 6 +--
.../asset-details-links.component.ts | 13 +++----
.../view-assset-basics.component.ts | 12 ++++--
.../view-asset-labels.component.ts | 5 ++-
.../asset-overview/asset-overview.component.ts | 22 +++++------
.../create-asset/create-asset-dialog.component.ts | 11 +++---
.../edit-asset-link-dialog.component.ts | 43 ++++++++++++++++------
.../manage-asset-links-dialog.component.ts | 43 ++++++++++++++++------
10 files changed, 105 insertions(+), 64 deletions(-)
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts
index 751d011661..f2a5bd0eb2 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-basics.component.ts
@@ -24,6 +24,7 @@ import {
OnInit,
Output,
SimpleChanges,
+ inject,
} from '@angular/core';
import {
AssetSiteDesc,
@@ -68,6 +69,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class AssetDetailsBasicsComponent implements OnInit, OnChanges {
+ private isa95TypeService = inject(Isa95TypeService);
+
@Input()
asset: SpAsset;
@@ -88,8 +91,6 @@ export class AssetDetailsBasicsComponent implements OnInit, OnChanges {
isa95Types: Isa95TypeDesc[] = [];
- constructor(private isa95TypeService: Isa95TypeService) {}
-
ngOnInit() {
this.isa95Types = this.isa95TypeService.getTypeDescriptions();
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.ts
index 794baa443f..fa330c1159 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-labels/asset-details-labels.component.ts
@@ -24,6 +24,7 @@ import {
OnInit,
SimpleChanges,
ViewChild,
+ inject,
} from '@angular/core';
import {
LabelsService,
@@ -97,6 +98,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class AssetDetailsLabelsComponent implements OnInit, OnChanges {
+ private labelsService = inject(LabelsService);
+ private colorizationService = inject(SpColorizationService);
+
@Input()
asset: SpAsset;
@@ -114,11 +118,6 @@ export class AssetDetailsLabelsComponent implements OnInit, OnChanges {
@ViewChild('labelInput') labelInput: ElementRef<HTMLInputElement>;
- constructor(
- private labelsService: LabelsService,
- private colorizationService: SpColorizationService,
- ) {}
-
ngOnInit(): void {
this.loadLabels();
}
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-location/asset-location.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-location/asset-location.component.ts
index e25d5f8fa6..95b376479c 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-location/asset-location.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-basics/asset-details-site/asset-location/asset-location.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
LocationConfig,
LocationConfigService,
@@ -40,6 +40,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class AssetLocationComponent implements OnInit {
+ private locationConfigService = inject(LocationConfigService);
+
@Input()
asset: SpAsset;
@@ -48,8 +50,6 @@ export class AssetLocationComponent implements OnInit {
locationConfig: LocationConfig;
- constructor(private locationConfigService: LocationConfigService) {}
-
ngOnInit() {
this.asset.assetSite.location ??= {
coordinates: {
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
index e02c8dec77..40d4eb092f 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
@@ -23,6 +23,7 @@ import {
OnInit,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import {
AssetConstants,
@@ -63,6 +64,11 @@ import { MatButton } from '@angular/material/button';
],
})
export class AssetDetailsLinksComponent implements OnInit {
+ private genericStorageService = inject(GenericStorageService);
+ private dialogService = inject(DialogService);
+ private translateService = inject(TranslateService);
+ private assetBrowserService = inject(SpAssetBrowserService);
+
@Input()
asset: SpAsset;
@@ -81,13 +87,6 @@ export class AssetDetailsLinksComponent implements OnInit {
@ViewChild('assetLinkTable', { static: false })
assetLinkTable: AssetLinkTableComponent;
- constructor(
- private genericStorageService: GenericStorageService,
- private dialogService: DialogService,
- private translateService: TranslateService,
- private assetBrowserService: SpAssetBrowserService,
- ) {}
-
ngOnInit(): void {
this.genericStorageService
.getAllDocuments(AssetConstants.ASSET_LINK_TYPES_DOC_NAME)
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts
index e0850cfbef..da150b43f3 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-basics/view-assset-basics.component.ts
@@ -16,7 +16,13 @@
*
*/
-import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
+import {
+ Component,
+ Input,
+ OnChanges,
+ SimpleChanges,
+ inject,
+} from '@angular/core';
import {
AssetSiteDesc,
Isa95TypeService,
@@ -43,6 +49,8 @@ import { ViewAssetLabelsComponent } from '../view-asset-labels/view-asset-labels
],
})
export class ViewAssetBasicsComponent implements OnChanges {
+ private isa95TypeService = inject(Isa95TypeService);
+
@Input()
selectedAsset: SpAsset;
@@ -51,8 +59,6 @@ export class ViewAssetBasicsComponent implements OnChanges {
selectedAssetType: string;
- constructor(private isa95TypeService: Isa95TypeService) {}
-
ngOnChanges(changes: SimpleChanges) {
this.selectedAssetType =
this.isa95TypeService.toLabel(
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-labels/view-asset-labels.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset-labels/view-asset-labels.component.ts
index 988539de66..da05409ae2 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-labels/view-asset-labels.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-labels/view-asset-labels.component.ts
@@ -22,6 +22,7 @@ import {
OnChanges,
OnInit,
SimpleChanges,
+ inject,
} from '@angular/core';
import {
LabelsService,
@@ -48,6 +49,8 @@ import { SpLabelComponent } from '@streampipes/shared-ui';
],
})
export class ViewAssetLabelsComponent implements OnInit, OnChanges {
+ private labelsService = inject(LabelsService);
+
@Input()
asset: SpAsset;
@@ -57,8 +60,6 @@ export class ViewAssetLabelsComponent implements OnInit, OnChanges {
allLabels: SpLabel[] = [];
assignedLabels: SpLabel[] = [];
- constructor(private labelsService: LabelsService) {}
-
ngOnInit() {
this.labelsService.getAllLabels().subscribe(res => {
this.allLabels = res;
diff --git a/ui/src/app/assets/components/asset-overview/asset-overview.component.ts b/ui/src/app/assets/components/asset-overview/asset-overview.component.ts
index a0fa0e1331..f75aaeb5ce 100644
--- a/ui/src/app/assets/components/asset-overview/asset-overview.component.ts
+++ b/ui/src/app/assets/components/asset-overview/asset-overview.component.ts
@@ -89,6 +89,16 @@ import { MatIcon } from '@angular/material/icon';
],
})
export class SpAssetOverviewComponent implements OnInit {
+ private assetService = inject(AssetManagementService);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private dialogService = inject(DialogService);
+ private router = inject(Router);
+ private idGeneratorService = inject(IdGeneratorService);
+ private assetBrowserService = inject(SpAssetBrowserService);
+ private currentUserService = inject(CurrentUserService);
+ private dialog = inject(MatDialog);
+ private translateService = inject(TranslateService);
+
existingAssets: SpAssetModel[] = [];
filteredAssets: SpAssetModel[] = [];
@@ -107,18 +117,6 @@ export class SpAssetOverviewComponent implements OnInit {
private assetFilterService = inject(SpAssetBrowserService);
- constructor(
- private assetService: AssetManagementService,
- private breadcrumbService: SpBreadcrumbService,
- private dialogService: DialogService,
- private router: Router,
- private idGeneratorService: IdGeneratorService,
- private assetBrowserService: SpAssetBrowserService,
- private currentUserService: CurrentUserService,
- private dialog: MatDialog,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.hasWritePrivilege = this.currentUserService.hasRole(
UserPrivilege.PRIVILEGE_WRITE_ASSETS,
diff --git a/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.ts b/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.ts
index 708d5c4b1b..e7747f8fa0 100644
--- a/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.ts
+++ b/ui/src/app/assets/dialog/create-asset/create-asset-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import {
AssetManagementService,
SpAssetModel,
@@ -52,12 +52,11 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpCreateAssetDialogComponent {
- @Input() assetModel: SpAssetModel;
+ private dialogRef =
+ inject<DialogRef<SpCreateAssetDialogComponent>>(DialogRef);
+ private assetManagementService = inject(AssetManagementService);
- constructor(
- private dialogRef: DialogRef<SpCreateAssetDialogComponent>,
- private assetManagementService: AssetManagementService,
- ) {}
+ @Input() assetModel: SpAssetModel;
onCancel(): void {
this.dialogRef.close();
diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
index 28dc64b0df..8b482e75bd 100644
--- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
+++ b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { DialogRef, FormFieldComponent } from '@streampipes/shared-ui';
import {
AdapterService,
@@ -65,6 +65,17 @@ export class EditAssetLinkDialogComponent
extends BaseAssetLinksDirective
implements OnInit
{
+ private dialogRef =
+ inject<DialogRef<EditAssetLinkDialogComponent>>(DialogRef);
+ protected genericStorageService: GenericStorageService;
+ protected pipelineService: PipelineService;
+ protected chartService: ChartService;
+ protected dashboardService: DashboardService;
+ protected dataLakeService: DatalakeRestService;
+ protected pipelineElementService: PipelineElementService;
+ protected adapterService: AdapterService;
+ protected filesService: FilesService;
+
@Input()
assetLink: AssetLink;
@@ -82,17 +93,16 @@ export class EditAssetLinkDialogComponent
selectedLinkType: AssetLinkType;
- constructor(
- private dialogRef: DialogRef<EditAssetLinkDialogComponent>,
- protected genericStorageService: GenericStorageService,
- protected pipelineService: PipelineService,
- protected chartService: ChartService,
- protected dashboardService: DashboardService,
- protected dataLakeService: DatalakeRestService,
- protected pipelineElementService: PipelineElementService,
- protected adapterService: AdapterService,
- protected filesService: FilesService,
- ) {
+ constructor() {
+ const genericStorageService = inject(GenericStorageService);
+ const pipelineService = inject(PipelineService);
+ const chartService = inject(ChartService);
+ const dashboardService = inject(DashboardService);
+ const dataLakeService = inject(DatalakeRestService);
+ const pipelineElementService = inject(PipelineElementService);
+ const adapterService = inject(AdapterService);
+ const filesService = inject(FilesService);
+
super(
genericStorageService,
pipelineService,
@@ -103,6 +113,15 @@ export class EditAssetLinkDialogComponent
adapterService,
filesService,
);
+
+ this.genericStorageService = genericStorageService;
+ this.pipelineService = pipelineService;
+ this.chartService = chartService;
+ this.dashboardService = dashboardService;
+ this.dataLakeService = dataLakeService;
+ this.pipelineElementService = pipelineElementService;
+ this.adapterService = adapterService;
+ this.filesService = filesService;
}
ngOnInit(): void {
diff --git a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts
index fc20993324..af55946e27 100644
--- a/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts
+++ b/ui/src/app/assets/dialog/manage-asset-links/manage-asset-links-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { DialogRef, SplitSectionComponent } from '@streampipes/shared-ui';
import {
AdapterService,
@@ -59,6 +59,17 @@ export class SpManageAssetLinksDialogComponent
extends BaseAssetLinksDirective
implements OnInit
{
+ private dialogRef =
+ inject<DialogRef<SpManageAssetLinksDialogComponent>>(DialogRef);
+ protected genericStorageService: GenericStorageService;
+ protected pipelineService: PipelineService;
+ protected chartService: ChartService;
+ protected dashboardService: DashboardService;
+ protected dataLakeService: DatalakeRestService;
+ protected pipelineElementService: PipelineElementService;
+ protected adapterService: AdapterService;
+ protected filesService: FilesService;
+
@Input()
assetLinks: AssetLink[];
@@ -74,17 +85,16 @@ export class SpManageAssetLinksDialogComponent
measureNameFunction = el => el.measureName;
widgetNameFunction = el => el.baseAppearanceConfig.widgetTitle;
- constructor(
- private dialogRef: DialogRef<SpManageAssetLinksDialogComponent>,
- protected genericStorageService: GenericStorageService,
- protected pipelineService: PipelineService,
- protected chartService: ChartService,
- protected dashboardService: DashboardService,
- protected dataLakeService: DatalakeRestService,
- protected pipelineElementService: PipelineElementService,
- protected adapterService: AdapterService,
- protected filesService: FilesService,
- ) {
+ constructor() {
+ const genericStorageService = inject(GenericStorageService);
+ const pipelineService = inject(PipelineService);
+ const chartService = inject(ChartService);
+ const dashboardService = inject(DashboardService);
+ const dataLakeService = inject(DatalakeRestService);
+ const pipelineElementService = inject(PipelineElementService);
+ const adapterService = inject(AdapterService);
+ const filesService = inject(FilesService);
+
super(
genericStorageService,
pipelineService,
@@ -95,6 +105,15 @@ export class SpManageAssetLinksDialogComponent
adapterService,
filesService,
);
+
+ this.genericStorageService = genericStorageService;
+ this.pipelineService = pipelineService;
+ this.chartService = chartService;
+ this.dashboardService = dashboardService;
+ this.dataLakeService = dataLakeService;
+ this.pipelineElementService = pipelineElementService;
+ this.adapterService = adapterService;
+ this.filesService = filesService;
}
ngOnInit(): void {
(streampipes) 04/24: migrate apidocs to inject()
Posted by ze...@apache.org.
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 d9b29a414bd0344c7f92bb1dda25238d9b469d25
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:56:44 2026 +0100
migrate apidocs to inject()
---
ui/src/app/apidocs/apidocs.component.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/src/app/apidocs/apidocs.component.ts b/ui/src/app/apidocs/apidocs.component.ts
index b644d7dc85..3e6d47a753 100644
--- a/ui/src/app/apidocs/apidocs.component.ts
+++ b/ui/src/app/apidocs/apidocs.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, ElementRef, OnInit } from '@angular/core';
+import { Component, ElementRef, OnInit, inject } from '@angular/core';
import { SwaggerUIBundle } from 'swagger-ui-dist';
@Component({
@@ -25,7 +25,7 @@ import { SwaggerUIBundle } from 'swagger-ui-dist';
styleUrls: ['./apidocs.component.scss'],
})
export class ApidocsComponent implements OnInit {
- constructor(private el: ElementRef) {}
+ private el = inject(ElementRef);
ngOnInit(): void {
SwaggerUIBundle({
(streampipes) 10/24: migrate dashboard UI to inject()
Posted by ze...@apache.org.
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 4a3f17609b5d0532afcb430104443aec4855a4f7
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:59:03 2026 +0100
migrate dashboard UI to inject()
---
.../chart-preview/chart-preview.component.ts | 13 ++++++++++---
.../chart-selection/chart-selection.component.ts | 8 +++-----
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts
index 964d8ce43b..f1e5d677ec 100644
--- a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts
+++ b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-preview/chart-preview.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { DataExplorerWidgetModel } from '@streampipes/platform-services';
import { ChartRegistry } from '../../../../../../chart-shared/registry/chart-registry.service';
import {
@@ -40,6 +47,8 @@ import { MatIcon } from '@angular/material/icon';
],
})
export class ChartPreviewComponent implements OnInit {
+ private widgetRegistryService = inject(ChartRegistry);
+
@Input()
chart: DataExplorerWidgetModel;
@@ -48,8 +57,6 @@ export class ChartPreviewComponent implements OnInit {
@Output()
addChartEmitter: EventEmitter<string> = new EventEmitter<string>();
- constructor(private widgetRegistryService: ChartRegistry) {}
-
ngOnInit() {
this.widgetTypeLabel = this.widgetRegistryService.getChartTemplate(
this.chart.widgetType,
diff --git a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts
index ae71d2ae69..07b3f7eec3 100644
--- a/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts
+++ b/ui/src/app/dashboard/components/panel/chart-selection-panel/chart-selection/chart-selection.component.ts
@@ -51,6 +51,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ChartSelectionComponent implements OnInit {
+ private dataViewService = inject(ChartService);
+ private router = inject(Router);
+
private authService = inject(AuthService);
@Output()
@@ -60,11 +63,6 @@ export class ChartSelectionComponent implements OnInit {
hasChartWritePrivileges: boolean = false;
- constructor(
- private dataViewService: ChartService,
- private router: Router,
- ) {}
-
ngOnInit() {
this.dataViewService.getAllCharts().subscribe(charts => {
this.charts = charts.sort((a, b) =>
(streampipes) 14/24: migrate editor UI to inject()
Posted by ze...@apache.org.
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 8f85bab02cc677e2c16ef2af159b171183fb4940
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:00:35 2026 +0100
migrate editor UI to inject()
---
.../custom-output-strategy.component.ts | 8 +++---
.../user-defined-output.component.ts | 6 +++--
...ine-assembly-drawing-area-pan-zoom.component.ts | 9 ++++---
.../pipeline-assembly-drawing-area.component.ts | 17 ++++++------
...ne-assembly-options-pipeline-cache.component.ts | 10 +++-----
.../pipeline-assembly-options.component.ts | 15 +++++------
.../pipeline-assembly.component.ts | 30 ++++++++++++----------
.../pipeline-element-icon-stand-row.component.ts | 6 ++---
.../pipeline-element-icon-stand.component.ts | 10 +++-----
.../pipeline-element-options.component.ts | 19 ++++++++------
.../pipeline-element-preview.component.ts | 6 ++---
.../components/pipeline/pipeline.component.ts | 29 +++++++++++----------
.../add-template-dialog.component.ts | 11 ++++----
.../compatible-elements.component.ts | 11 ++++----
.../editor/dialog/customize/customize.component.ts | 23 +++++++++--------
.../matching-error/matching-error.component.ts | 6 ++---
.../missing-elements-for-tutorial.component.ts | 9 +++----
.../pipeline-element-discovery.component.ts | 11 ++++----
ui/src/app/editor/editor.component.ts | 22 ++++++++--------
ui/src/app/editor/services/editor.service.ts | 14 +++++-----
.../editor/services/jsplumb-endpoint.service.ts | 4 +--
.../app/editor/services/jsplumb-factory.service.ts | 12 ++++-----
ui/src/app/editor/services/jsplumb.service.ts | 12 ++++-----
.../app/editor/services/object-provider.service.ts | 8 +++---
.../services/pipeline-positioning.service.ts | 10 +++-----
.../app/editor/services/pipeline-style.service.ts | 8 +++---
.../editor/services/pipeline-validation.service.ts | 6 ++---
ui/src/app/editor/utils/style-sanitizer.ts | 4 +--
28 files changed, 163 insertions(+), 173 deletions(-)
diff --git a/ui/src/app/editor/components/output-strategy/custom-output/custom-output-strategy.component.ts b/ui/src/app/editor/components/output-strategy/custom-output/custom-output-strategy.component.ts
index 548a9e140e..1183e35ea4 100644
--- a/ui/src/app/editor/components/output-strategy/custom-output/custom-output-strategy.component.ts
+++ b/ui/src/app/editor/components/output-strategy/custom-output/custom-output-strategy.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { CustomOutputStrategy } from '@streampipes/platform-services';
import { BaseOutputStrategy } from '../base/BaseOutputStrategy';
import { PropertySelectorService } from '../../../../services/property-selector.service';
@@ -47,13 +47,11 @@ export class CustomOutputStrategyComponent
extends BaseOutputStrategy<CustomOutputStrategy>
implements OnInit
{
+ private propertySelectorService = inject(PropertySelectorService);
+
collectedPropertiesFirstStream: any;
collectedPropertiesSecondStream: any;
- constructor(private propertySelectorService: PropertySelectorService) {
- super();
- }
-
ngOnInit() {
this.parentForm.addControl('output-strategy', new UntypedFormControl());
this.collectedPropertiesFirstStream =
diff --git a/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts b/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts
index 3563bd911b..2ac2e5f7d3 100644
--- a/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts
+++ b/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { BaseOutputStrategy } from '../base/BaseOutputStrategy';
import {
DataType,
@@ -63,9 +63,11 @@ export class UserDefinedOutputStrategyComponent
extends BaseOutputStrategy<UserDefinedOutputStrategy>
implements OnInit
{
+ private idGeneratorService = inject(IdGeneratorService);
+
primitiveClasses = [];
- constructor(private idGeneratorService: IdGeneratorService) {
+ constructor() {
super();
this.primitiveClasses = [
{ label: 'String', id: DataType.STRING },
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area-pan-zoom/pipeline-assembly-drawing-area-pan-zoom.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area-pan-zoom/pipeline-assembly-drawing-area-pan-zoom.component.ts
index 001cdc8b3d..fb2950cd4a 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area-pan-zoom/pipeline-assembly-drawing-area-pan-zoom.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area-pan-zoom/pipeline-assembly-drawing-area-pan-zoom.component.ts
@@ -23,6 +23,7 @@ import {
Input,
OnDestroy,
OnInit,
+ inject,
} from '@angular/core';
import { JsplumbBridge } from '../../../../services/jsplumb-bridge.service';
import Panzoom, { PanzoomObject } from '@panzoom/panzoom';
@@ -39,6 +40,10 @@ import { MatDivider } from '@angular/material/divider';
export class PipelineAssemblyDrawingAreaPanZoomComponent
implements OnInit, AfterViewInit, OnDestroy
{
+ private pipelineElementDraggedService = inject(
+ PipelineElementDraggedService,
+ );
+
@Input()
jsplumbBridge: JsplumbBridge;
@@ -49,10 +54,6 @@ export class PipelineAssemblyDrawingAreaPanZoomComponent
moveSub: Subscription;
currentZoomLevel = 1;
- constructor(
- private pipelineElementDraggedService: PipelineElementDraggedService,
- ) {}
-
ngOnInit() {
this.moveSub =
this.pipelineElementDraggedService.pipelineElementMovedSubject.subscribe(
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area.component.ts
index 193f8230ea..3c8c16f129 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-drawing-area/pipeline-assembly-drawing-area.component.ts
@@ -26,6 +26,7 @@ import {
OnInit,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import { JsplumbBridge } from '../../../services/jsplumb-bridge.service';
import { PipelineComponent } from '../../pipeline/pipeline.component';
@@ -59,6 +60,13 @@ import { ErrorHintComponent } from '../../../../core-ui/error-hint/error-hint.co
],
})
export class PipelineAssemblyDrawingAreaComponent implements OnInit, OnDestroy {
+ pipelineValidationService = inject(PipelineValidationService);
+ private ngZone = inject(NgZone);
+ private editorService = inject(EditorService);
+ private pipelinePositioningService = inject(PipelinePositioningService);
+ private livePreviewService = inject(LivePreviewService);
+ private objectProvider = inject(ObjectProvider);
+
@Input()
jsplumbBridge: JsplumbBridge;
@@ -97,15 +105,6 @@ export class PipelineAssemblyDrawingAreaComponent implements OnInit, OnDestroy {
zoomComponent: PipelineAssemblyDrawingAreaPanZoomComponent;
@ViewChild('outerCanvas') pipelineCanvas: ElementRef;
- constructor(
- public pipelineValidationService: PipelineValidationService,
- private ngZone: NgZone,
- private editorService: EditorService,
- private pipelinePositioningService: PipelinePositioningService,
- private livePreviewService: LivePreviewService,
- private objectProvider: ObjectProvider,
- ) {}
-
ngOnInit(): void {
if (this.rawPipelineModel.length > 0) {
this.displayPipelineInEditor(
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options-pipeline-cache/pipeline-assembly-options-pipeline-cache.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options-pipeline-cache/pipeline-assembly-options-pipeline-cache.component.ts
index a0f68e3752..b1de6030d6 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options-pipeline-cache/pipeline-assembly-options-pipeline-cache.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options-pipeline-cache/pipeline-assembly-options-pipeline-cache.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { PipelineElementConfig } from '../../../../model/editor.model';
import { forkJoin } from 'rxjs';
import { PipelinePositioningService } from '../../../../services/pipeline-positioning.service';
@@ -43,6 +43,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineAssemblyOptionsPipelineCacheComponent {
+ private pipelinePositioningService = inject(PipelinePositioningService);
+ private editorService = inject(EditorService);
+
pipelineCached = false;
pipelineCacheRunning = false;
@@ -52,11 +55,6 @@ export class PipelineAssemblyOptionsPipelineCacheComponent {
@Input()
pipelineCanvasMetadata: PipelineCanvasMetadata;
- constructor(
- private pipelinePositioningService: PipelinePositioningService,
- private editorService: EditorService,
- ) {}
-
triggerPipelineCacheUpdate() {
setTimeout(() => {
this.pipelineCacheRunning = true;
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options.component.ts
index 55bd424825..fe591aebc3 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly-options/pipeline-assembly-options.component.ts
@@ -22,6 +22,7 @@ import {
Input,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import { JsplumbBridge } from '../../../services/jsplumb-bridge.service';
import { PipelinePositioningService } from '../../../services/pipeline-positioning.service';
@@ -69,6 +70,12 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineAssemblyOptionsComponent {
+ editorService = inject(EditorService);
+ pipelineValidationService = inject(PipelineValidationService);
+ private pipelinePositioningService = inject(PipelinePositioningService);
+ private dialog = inject(MatDialog);
+ private dialogService = inject(DialogService);
+
@Input()
jsplumbBridge: JsplumbBridge;
@@ -100,14 +107,6 @@ export class PipelineAssemblyOptionsComponent {
@ViewChild('assemblyOptionsPipelineCacheComponent')
assemblyOptionsCacheComponent: PipelineAssemblyOptionsPipelineCacheComponent;
- constructor(
- public editorService: EditorService,
- public pipelineValidationService: PipelineValidationService,
- private pipelinePositioningService: PipelinePositioningService,
- private dialog: MatDialog,
- private dialogService: DialogService,
- ) {}
-
autoLayout() {
this.pipelinePositioningService.layoutGraph(
'#assembly',
diff --git a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
index 8fd3cd0769..bfae6c4e65 100644
--- a/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
+++ b/ui/src/app/editor/components/pipeline-assembly/pipeline-assembly.component.ts
@@ -16,7 +16,13 @@
*
*/
-import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
+import {
+ AfterViewInit,
+ Component,
+ Input,
+ ViewChild,
+ inject,
+} from '@angular/core';
import { JsplumbBridge } from '../../services/jsplumb-bridge.service';
import { PipelinePositioningService } from '../../services/pipeline-positioning.service';
import { PipelineValidationService } from '../../services/pipeline-validation.service';
@@ -57,6 +63,16 @@ import { FlexDirective } from '@ngbracket/ngx-layout/flex';
],
})
export class PipelineAssemblyComponent implements AfterViewInit {
+ private jsPlumbFactoryService = inject(JsplumbFactoryService);
+ private pipelinePositioningService = inject(PipelinePositioningService);
+ private objectProvider = inject(ObjectProvider);
+ editorService = inject(EditorService);
+ pipelineValidationService = inject(PipelineValidationService);
+ private dialogService = inject(DialogService);
+ private router = inject(Router);
+ private jsplumbService = inject(JsplumbService);
+ private translateService = inject(TranslateService);
+
@Input()
rawPipelineModel: PipelineElementConfig[];
@@ -82,18 +98,6 @@ export class PipelineAssemblyComponent implements AfterViewInit {
@ViewChild('drawingAreaComponent')
drawingAreaComponent: PipelineAssemblyDrawingAreaComponent;
- constructor(
- private jsPlumbFactoryService: JsplumbFactoryService,
- private pipelinePositioningService: PipelinePositioningService,
- private objectProvider: ObjectProvider,
- public editorService: EditorService,
- public pipelineValidationService: PipelineValidationService,
- private dialogService: DialogService,
- private router: Router,
- private jsplumbService: JsplumbService,
- private translateService: TranslateService,
- ) {}
-
ngAfterViewInit() {
this.jsplumbBridge = this.jsPlumbFactoryService.getJsplumbBridge(
this.readonly,
diff --git a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts
index b9fda96d27..b9b761246d 100644
--- a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
PipelineElementType,
PipelineElementUnion,
@@ -50,6 +50,8 @@ import { MatButton } from '@angular/material/button';
],
})
export class PipelineElementIconStandRowComponent implements OnInit {
+ private editorService = inject(EditorService);
+
@Input()
element: PipelineElementUnion;
@@ -58,8 +60,6 @@ export class PipelineElementIconStandRowComponent implements OnInit {
currentMouseOver = false;
- constructor(private editorService: EditorService) {}
-
ngOnInit(): void {
const activeType = PipelineElementTypeUtils.fromClassName(
this.element['@class'],
diff --git a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts
index e5864ad192..8c5f62b3ea 100644
--- a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { AfterViewInit, Component, Input, OnInit } from '@angular/core';
+import { AfterViewInit, Component, Input, OnInit, inject } from '@angular/core';
import {
PeCategory,
PipelineElementType,
@@ -78,6 +78,9 @@ import { PipelineElementTypeFilterPipe } from '../../services/pipeline-element-t
export class PipelineElementIconStandComponent
implements OnInit, AfterViewInit
{
+ private editorService = inject(EditorService);
+ private router = inject(Router);
+
availableTypes = [
{
title: 'Data Streams',
@@ -114,11 +117,6 @@ export class PipelineElementIconStandComponent
description: '',
};
- constructor(
- private editorService: EditorService,
- private router: Router,
- ) {}
-
ngOnInit(): void {
this.loadOptions();
}
diff --git a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
index 0222cc6774..e251d03133 100644
--- a/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-options/pipeline-element-options.component.ts
@@ -25,6 +25,7 @@ import {
OnDestroy,
OnInit,
Output,
+ inject,
} from '@angular/core';
import { PipelineElementRecommendationService } from '../../services/pipeline-element-recommendation.service';
import { ObjectProvider } from '../../services/object-provider.service';
@@ -66,6 +67,15 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineElementOptionsComponent implements OnInit, OnDestroy {
+ private objectProvider = inject(ObjectProvider);
+ private pipelineElementRecommendationService = inject(
+ PipelineElementRecommendationService,
+ );
+ private dialogService = inject(DialogService);
+ private editorService = inject(EditorService);
+ private jsplumbFactoryService = inject(JsplumbFactoryService);
+ private restApi = inject(RestApi);
+
recommendationsAvailable: any = false;
possibleElements: PipelineElementUnion[];
isDataSource: boolean;
@@ -103,14 +113,7 @@ export class PipelineElementOptionsComponent implements OnInit, OnDestroy {
jsplumbBridge: JsplumbBridge;
- constructor(
- private objectProvider: ObjectProvider,
- private pipelineElementRecommendationService: PipelineElementRecommendationService,
- private dialogService: DialogService,
- private editorService: EditorService,
- private jsplumbFactoryService: JsplumbFactoryService,
- private restApi: RestApi,
- ) {
+ constructor() {
this.recommendationsAvailable = false;
this.possibleElements = [];
this.jsplumbBridge = this.jsplumbFactoryService.getJsplumbBridge(false);
diff --git a/ui/src/app/editor/components/pipeline-element-preview/pipeline-element-preview.component.ts b/ui/src/app/editor/components/pipeline-element-preview/pipeline-element-preview.component.ts
index c8e2ac84b6..6dc4d14dbf 100644
--- a/ui/src/app/editor/components/pipeline-element-preview/pipeline-element-preview.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-preview/pipeline-element-preview.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnDestroy, OnInit } from '@angular/core';
+import { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';
import { Subscription } from 'rxjs';
import { KeyValue, KeyValuePipe } from '@angular/common';
import {
@@ -45,6 +45,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class PipelineElementPreviewComponent implements OnInit, OnDestroy {
+ private livePreviewService = inject(LivePreviewService);
+
@Input()
pipelinePreview: PipelinePreviewModel;
@@ -55,8 +57,6 @@ export class PipelineElementPreviewComponent implements OnInit, OnDestroy {
runtimeDataError = false;
previewSub: Subscription;
- constructor(private livePreviewService: LivePreviewService) {}
-
ngOnInit(): void {
this.getLatestRuntimeInfo();
}
diff --git a/ui/src/app/editor/components/pipeline/pipeline.component.ts b/ui/src/app/editor/components/pipeline/pipeline.component.ts
index 726a6e06d9..4ae6f00109 100644
--- a/ui/src/app/editor/components/pipeline/pipeline.component.ts
+++ b/ui/src/app/editor/components/pipeline/pipeline.component.ts
@@ -30,6 +30,7 @@ import {
OnDestroy,
OnInit,
Output,
+ inject,
} from '@angular/core';
import {
InvocablePipelineElementUnion,
@@ -94,6 +95,19 @@ import { EnabledPipelineElementFilter } from '../../filter/enabled-pipeline-elem
],
})
export class PipelineComponent implements OnInit, OnDestroy {
+ private jsplumbService = inject(JsplumbService);
+ private pipelineEditorService = inject(PipelineEditorService);
+ private jsplumbFactoryService = inject(JsplumbFactoryService);
+ private objectProvider = inject(ObjectProvider);
+ private editorService = inject(EditorService);
+ private idGeneratorService = inject(IdGeneratorService);
+ private shepherdService = inject(ShepherdService);
+ private pipelineStyleService = inject(PipelineStyleService);
+ private pipelineValidationService = inject(PipelineValidationService);
+ private dialogService = inject(DialogService);
+ private dialog = inject(MatDialog);
+ private ngZone = inject(NgZone);
+
@Input()
pipelineValid: boolean;
@@ -133,20 +147,7 @@ export class PipelineComponent implements OnInit, OnDestroy {
shouldOpenCustomizeSettings = false;
- constructor(
- private jsplumbService: JsplumbService,
- private pipelineEditorService: PipelineEditorService,
- private jsplumbFactoryService: JsplumbFactoryService,
- private objectProvider: ObjectProvider,
- private editorService: EditorService,
- private idGeneratorService: IdGeneratorService,
- private shepherdService: ShepherdService,
- private pipelineStyleService: PipelineStyleService,
- private pipelineValidationService: PipelineValidationService,
- private dialogService: DialogService,
- private dialog: MatDialog,
- private ngZone: NgZone,
- ) {
+ constructor() {
this.currentPipelineModel = new Pipeline();
this.idCounter = 0;
diff --git a/ui/src/app/editor/dialog/add-template-dialog/add-template-dialog.component.ts b/ui/src/app/editor/dialog/add-template-dialog/add-template-dialog.component.ts
index 3857fe75d5..5187c594e3 100644
--- a/ui/src/app/editor/dialog/add-template-dialog/add-template-dialog.component.ts
+++ b/ui/src/app/editor/dialog/add-template-dialog/add-template-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
CompactPipelineTemplate,
PipelineTemplateGenerationRequest,
@@ -47,12 +47,11 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class AddTemplateDialogComponent implements OnInit {
- pipelineTemplates: CompactPipelineTemplate[] = [];
+ private pipelineTemplateService = inject(PipelineTemplateService);
+ private dialogRef =
+ inject<DialogRef<AddTemplateDialogComponent>>(DialogRef);
- constructor(
- private pipelineTemplateService: PipelineTemplateService,
- private dialogRef: DialogRef<AddTemplateDialogComponent>,
- ) {}
+ pipelineTemplates: CompactPipelineTemplate[] = [];
ngOnInit() {
this.pipelineTemplateService
diff --git a/ui/src/app/editor/dialog/compatible-elements/compatible-elements.component.ts b/ui/src/app/editor/dialog/compatible-elements/compatible-elements.component.ts
index 1e221bef76..a4b88f47ec 100644
--- a/ui/src/app/editor/dialog/compatible-elements/compatible-elements.component.ts
+++ b/ui/src/app/editor/dialog/compatible-elements/compatible-elements.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
DialogRef,
FormLabelComponent,
@@ -53,6 +53,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class CompatibleElementsComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<CompatibleElementsComponent>>(DialogRef);
+ private JsPlumbService = inject(JsplumbService);
+
@Input()
rawPipelineModel: PipelineElementConfig[];
@@ -64,11 +68,6 @@ export class CompatibleElementsComponent implements OnInit {
styles: any[] = [];
- constructor(
- private dialogRef: DialogRef<CompatibleElementsComponent>,
- private JsPlumbService: JsplumbService,
- ) {}
-
ngOnInit() {
this.possibleElements.sort((a, b) => a.name.localeCompare(b.name));
this.possibleElements.forEach(pe => {
diff --git a/ui/src/app/editor/dialog/customize/customize.component.ts b/ui/src/app/editor/dialog/customize/customize.component.ts
index 014f259894..2e9cb750c8 100644
--- a/ui/src/app/editor/dialog/customize/customize.component.ts
+++ b/ui/src/app/editor/dialog/customize/customize.component.ts
@@ -23,6 +23,7 @@ import {
Input,
OnInit,
ViewEncapsulation,
+ inject,
} from '@angular/core';
import {
InvocablePipelineElementUnion,
@@ -94,6 +95,17 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class CustomizeComponent implements OnInit, AfterViewInit {
+ private dialogRef = inject<DialogRef<CustomizeComponent>>(DialogRef);
+ private jsPlumbService = inject(JsplumbService);
+ private shepherdService = inject(ShepherdService);
+ private fb = inject(UntypedFormBuilder);
+ private changeDetectorRef = inject(ChangeDetectorRef);
+ private pipelineElementTemplateService = inject(
+ PipelineElementTemplateService,
+ );
+ private pipelineStyleService = inject(PipelineStyleService);
+ private staticPropertyUtils = inject(StaticPropertyUtilService);
+
@Input()
pipelineElement: PipelineElementConfig;
@@ -122,17 +134,6 @@ export class CustomizeComponent implements OnInit, AfterViewInit {
templateConfigs: Map<string, any>[] = [];
completedConfigurations: ConfigurationInfo[] = [];
- constructor(
- private dialogRef: DialogRef<CustomizeComponent>,
- private jsPlumbService: JsplumbService,
- private shepherdService: ShepherdService,
- private fb: UntypedFormBuilder,
- private changeDetectorRef: ChangeDetectorRef,
- private pipelineElementTemplateService: PipelineElementTemplateService,
- private pipelineStyleService: PipelineStyleService,
- private staticPropertyUtils: StaticPropertyUtilService,
- ) {}
-
ngOnInit(): void {
this.originalDialogWidth = this.dialogRef.currentConfig().width;
this.cachedPipelineElement = this.jsPlumbService.clone(
diff --git a/ui/src/app/editor/dialog/matching-error/matching-error.component.ts b/ui/src/app/editor/dialog/matching-error/matching-error.component.ts
index d0d7c39afe..4257ca9e42 100644
--- a/ui/src/app/editor/dialog/matching-error/matching-error.component.ts
+++ b/ui/src/app/editor/dialog/matching-error/matching-error.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { DialogRef, SpAlertBannerComponent } from '@streampipes/shared-ui';
import { Notification } from '@streampipes/platform-services';
import { LayoutDirective } from '@ngbracket/ngx-layout/flex';
@@ -36,14 +36,14 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class MatchingErrorComponent {
+ private dialogRef = inject<DialogRef<MatchingErrorComponent>>(DialogRef);
+
@Input()
notifications: Notification[];
msg: any;
statusDetailsVisible: any;
- constructor(private dialogRef: DialogRef<MatchingErrorComponent>) {}
-
close() {
this.dialogRef.close();
}
diff --git a/ui/src/app/editor/dialog/missing-elements-for-tutorial/missing-elements-for-tutorial.component.ts b/ui/src/app/editor/dialog/missing-elements-for-tutorial/missing-elements-for-tutorial.component.ts
index cf62365d1e..b88d0820f4 100644
--- a/ui/src/app/editor/dialog/missing-elements-for-tutorial/missing-elements-for-tutorial.component.ts
+++ b/ui/src/app/editor/dialog/missing-elements-for-tutorial/missing-elements-for-tutorial.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
import { MatDivider } from '@angular/material/divider';
@@ -35,13 +35,12 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class MissingElementsForTutorialComponent {
+ private dialogRef =
+ inject<DialogRef<MissingElementsForTutorialComponent>>(DialogRef);
+
@Input()
missingElementsForTutorial: any[];
- constructor(
- private dialogRef: DialogRef<MissingElementsForTutorialComponent>,
- ) {}
-
close() {
this.dialogRef.close();
}
diff --git a/ui/src/app/editor/dialog/pipeline-element-discovery/pipeline-element-discovery.component.ts b/ui/src/app/editor/dialog/pipeline-element-discovery/pipeline-element-discovery.component.ts
index c4d14f4ca1..1fe4bb8cec 100644
--- a/ui/src/app/editor/dialog/pipeline-element-discovery/pipeline-element-discovery.component.ts
+++ b/ui/src/app/editor/dialog/pipeline-element-discovery/pipeline-element-discovery.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
DialogRef,
FormLabelComponent,
@@ -55,6 +55,10 @@ import { MatButton } from '@angular/material/button';
],
})
export class PipelineElementDiscoveryComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<PipelineElementDiscoveryComponent>>(DialogRef);
+ private JsPlumbService = inject(JsplumbService);
+
@Input()
rawPipelineModel: PipelineElementConfig[];
@@ -63,11 +67,6 @@ export class PipelineElementDiscoveryComponent implements OnInit {
styles: any[] = [];
- constructor(
- private dialogRef: DialogRef<PipelineElementDiscoveryComponent>,
- private JsPlumbService: JsplumbService,
- ) {}
-
ngOnInit() {
this.currentElements.sort((a, b) => a.name.localeCompare(b.name));
this.currentElements.forEach(pe => {
diff --git a/ui/src/app/editor/editor.component.ts b/ui/src/app/editor/editor.component.ts
index 2aeccfdb7e..5a381a5342 100644
--- a/ui/src/app/editor/editor.component.ts
+++ b/ui/src/app/editor/editor.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
Pipeline,
PipelineCanvasMetadata,
@@ -64,6 +64,16 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class EditorComponent implements OnInit {
+ private pipelineElementService = inject(PipelineElementService);
+ private activatedRoute = inject(ActivatedRoute);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private editorService = inject(EditorService);
+ private pipelineService = inject(PipelineService);
+ private jsplumbService = inject(JsplumbService);
+ private pipelineCanvasMetadataService = inject(
+ PipelineCanvasMetadataService,
+ );
+
allElements: PipelineElementUnion[] = [];
rawPipelineModel: PipelineElementConfig[] = [];
@@ -74,16 +84,6 @@ export class EditorComponent implements OnInit {
pipelineCanvasMetadata: PipelineCanvasMetadata;
pipelineCanvasMetadataAvailable: boolean;
- constructor(
- private pipelineElementService: PipelineElementService,
- private activatedRoute: ActivatedRoute,
- private breadcrumbService: SpBreadcrumbService,
- private editorService: EditorService,
- private pipelineService: PipelineService,
- private jsplumbService: JsplumbService,
- private pipelineCanvasMetadataService: PipelineCanvasMetadataService,
- ) {}
-
ngOnInit() {
const pipelineId = this.activatedRoute.snapshot.params.pipelineId;
if (pipelineId) {
diff --git a/ui/src/app/editor/services/editor.service.ts b/ui/src/app/editor/services/editor.service.ts
index b232d8ca08..733a0103a2 100644
--- a/ui/src/app/editor/services/editor.service.ts
+++ b/ui/src/app/editor/services/editor.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient, HttpContext, HttpEvent } from '@angular/common/http';
import {
DataProcessorInvocation,
@@ -47,6 +47,11 @@ import { TopicsComponent } from '../../core-ui/topics/topics.component';
@Injectable({ providedIn: 'root' })
export class EditorService {
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
+ private dialogService = inject(DialogService);
+ private pipelineService = inject(PipelineService);
+
private pipelineElementConfigured = new Subject<string>();
public pipelineElementConfigured$ =
@@ -54,13 +59,6 @@ export class EditorService {
pipelineAssemblyEmpty = true;
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- private dialogService: DialogService,
- private pipelineService: PipelineService,
- ) {}
-
get apiBasePath() {
return this.platformServicesCommons.apiBasePath;
}
diff --git a/ui/src/app/editor/services/jsplumb-endpoint.service.ts b/ui/src/app/editor/services/jsplumb-endpoint.service.ts
index 31e0438ef0..55c311e9f7 100644
--- a/ui/src/app/editor/services/jsplumb-endpoint.service.ts
+++ b/ui/src/app/editor/services/jsplumb-endpoint.service.ts
@@ -16,12 +16,12 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { JsplumbConfigService } from './jsplumb-config.service';
@Injectable({ providedIn: 'root' })
export class JsplumbEndpointService {
- constructor(private jsplumbConfigService: JsplumbConfigService) {}
+ private jsplumbConfigService = inject(JsplumbConfigService);
getJsplumbConfig(): any {
return this.jsplumbConfigService.getEditorConfig();
diff --git a/ui/src/app/editor/services/jsplumb-factory.service.ts b/ui/src/app/editor/services/jsplumb-factory.service.ts
index 9d554cae82..f8541d361e 100644
--- a/ui/src/app/editor/services/jsplumb-factory.service.ts
+++ b/ui/src/app/editor/services/jsplumb-factory.service.ts
@@ -22,21 +22,21 @@ import {
JsPlumbInstance,
newInstance,
} from '@jsplumb/browser-ui';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { JsplumbBridge } from './jsplumb-bridge.service';
import { PipelineElementDraggedService } from './pipeline-element-dragged.service';
import { JsplumbConfigService } from './jsplumb-config.service';
@Injectable({ providedIn: 'root' })
export class JsplumbFactoryService {
+ private pipelineElementDraggedService = inject(
+ PipelineElementDraggedService,
+ );
+ private jsplumbConfigService = inject(JsplumbConfigService);
+
pipelineEditorInstance: BrowserJsPlumbInstance;
pipelineEditorBridge: JsplumbBridge;
- constructor(
- private pipelineElementDraggedService: PipelineElementDraggedService,
- private jsplumbConfigService: JsplumbConfigService,
- ) {}
-
getJsplumbBridge(previewConfig: boolean): JsplumbBridge {
if (!this.pipelineEditorBridge) {
this.pipelineEditorInstance = previewConfig
diff --git a/ui/src/app/editor/services/jsplumb.service.ts b/ui/src/app/editor/services/jsplumb.service.ts
index 890018531a..787e246b92 100644
--- a/ui/src/app/editor/services/jsplumb.service.ts
+++ b/ui/src/app/editor/services/jsplumb.service.ts
@@ -17,7 +17,7 @@
*/
import { JsplumbBridge } from './jsplumb-bridge.service';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
InvocablePipelineElementUnion,
PipelineElementConfig,
@@ -37,13 +37,11 @@ import { IdGeneratorService } from '../../core-services/id-generator/id-generato
@Injectable({ providedIn: 'root' })
export class JsplumbService {
- idCounter = 0;
+ private jsplumbFactory = inject(JsplumbFactoryService);
+ private jsplumbEndpointService = inject(JsplumbEndpointService);
+ private idGeneratorService = inject(IdGeneratorService);
- constructor(
- private jsplumbFactory: JsplumbFactoryService,
- private jsplumbEndpointService: JsplumbEndpointService,
- private idGeneratorService: IdGeneratorService,
- ) {}
+ idCounter = 0;
isFullyConnected(
pipelineElementConfig: PipelineElementConfig,
diff --git a/ui/src/app/editor/services/object-provider.service.ts b/ui/src/app/editor/services/object-provider.service.ts
index bb5123f529..0fcc1f0bb7 100644
--- a/ui/src/app/editor/services/object-provider.service.ts
+++ b/ui/src/app/editor/services/object-provider.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { PipelineElementConfig } from '../model/editor.model';
import {
DataProcessorInvocation,
@@ -29,10 +29,8 @@ import { JsplumbFactoryService } from './jsplumb-factory.service';
@Injectable({ providedIn: 'root' })
export class ObjectProvider {
- constructor(
- private editorService: EditorService,
- private jsplumbFactoryService: JsplumbFactoryService,
- ) {}
+ private editorService = inject(EditorService);
+ private jsplumbFactoryService = inject(JsplumbFactoryService);
preparePipeline(): Pipeline {
const pipeline = new Pipeline();
diff --git a/ui/src/app/editor/services/pipeline-positioning.service.ts b/ui/src/app/editor/services/pipeline-positioning.service.ts
index 853568d11f..440ef54c68 100644
--- a/ui/src/app/editor/services/pipeline-positioning.service.ts
+++ b/ui/src/app/editor/services/pipeline-positioning.service.ts
@@ -19,7 +19,7 @@
import * as dagre from 'dagre';
import { JsplumbBridge } from './jsplumb-bridge.service';
import { JsplumbService } from './jsplumb.service';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { PipelineElementConfig } from '../model/editor.model';
import {
DataProcessorInvocation,
@@ -34,11 +34,9 @@ import { Connection } from '@jsplumb/browser-ui';
@Injectable({ providedIn: 'root' })
export class PipelinePositioningService {
- constructor(
- private jsplumbService: JsplumbService,
- private jsplumbFactoryService: JsplumbFactoryService,
- private objectProvider: ObjectProvider,
- ) {}
+ private jsplumbService = inject(JsplumbService);
+ private jsplumbFactoryService = inject(JsplumbFactoryService);
+ private objectProvider = inject(ObjectProvider);
collectPipelineElementPositions(
pipelineCanvasMetadata: PipelineCanvasMetadata,
diff --git a/ui/src/app/editor/services/pipeline-style.service.ts b/ui/src/app/editor/services/pipeline-style.service.ts
index 7dc5e212a3..71da6b8344 100644
--- a/ui/src/app/editor/services/pipeline-style.service.ts
+++ b/ui/src/app/editor/services/pipeline-style.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { JsplumbConfigService } from './jsplumb-config.service';
import {
EdgeValidationStatus,
@@ -31,10 +31,8 @@ import {
@Injectable({ providedIn: 'root' })
export class PipelineStyleService {
- constructor(
- private jsPlumbConfigService: JsplumbConfigService,
- private jsplumbFactoryService: JsplumbFactoryService,
- ) {}
+ private jsPlumbConfigService = inject(JsplumbConfigService);
+ private jsplumbFactoryService = inject(JsplumbFactoryService);
updateAllConnectorStyles(edgeValidations: PipelineEdgeValidation[]) {
edgeValidations.forEach(edgeValidation =>
diff --git a/ui/src/app/editor/services/pipeline-validation.service.ts b/ui/src/app/editor/services/pipeline-validation.service.ts
index fffb402232..7c36bce2c3 100644
--- a/ui/src/app/editor/services/pipeline-validation.service.ts
+++ b/ui/src/app/editor/services/pipeline-validation.service.ts
@@ -18,7 +18,7 @@
import * as dagre from 'dagre';
import { JsplumbBridge } from './jsplumb-bridge.service';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
PipelineElementConfig,
PipelineElementConfigurationStatus,
@@ -34,6 +34,8 @@ import { Connection } from '@jsplumb/browser-ui';
@Injectable({ providedIn: 'root' })
export class PipelineValidationService {
+ private jsplumbFactoryService = inject(JsplumbFactoryService);
+
errorMessages: any = [];
pipelineValid = false;
@@ -64,8 +66,6 @@ export class PipelineValidationService {
),
];
- constructor(private jsplumbFactoryService: JsplumbFactoryService) {}
-
isValidPipeline(
rawPipelineModel: PipelineElementConfig[],
previewConfig: boolean,
diff --git a/ui/src/app/editor/utils/style-sanitizer.ts b/ui/src/app/editor/utils/style-sanitizer.ts
index 1ddbd79c3f..9a59cff291 100644
--- a/ui/src/app/editor/utils/style-sanitizer.ts
+++ b/ui/src/app/editor/utils/style-sanitizer.ts
@@ -16,12 +16,12 @@
*
*/
-import { Pipe, PipeTransform } from '@angular/core';
+import { Pipe, PipeTransform, inject } from '@angular/core';
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
@Pipe({ name: 'safeCss' })
export class SafeCss implements PipeTransform {
- constructor(private domSanitizer: DomSanitizer) {}
+ private domSanitizer = inject(DomSanitizer);
transform(value: any): SafeStyle {
return this.domSanitizer.bypassSecurityTrustStyle(value);
(streampipes) 08/24: migrate info UI to inject()
Posted by ze...@apache.org.
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 5093fc85ba728d8d51cb41b8d43af3448bd8e862
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:58:16 2026 +0100
migrate info UI to inject()
---
ui/src/app/info/info.component.ts | 4 ++--
ui/src/app/info/versions/versions.component.ts | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/ui/src/app/info/info.component.ts b/ui/src/app/info/info.component.ts
index 9c86729bfd..220230cc81 100644
--- a/ui/src/app/info/info.component.ts
+++ b/ui/src/app/info/info.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
SpBasicViewComponent,
SpBreadcrumbService,
@@ -28,7 +28,7 @@ import { VersionsComponent } from './versions/versions.component';
imports: [SpBasicViewComponent, VersionsComponent],
})
export class InfoComponent implements OnInit {
- constructor(private breadcrumbService: SpBreadcrumbService) {}
+ private breadcrumbService = inject(SpBreadcrumbService);
ngOnInit() {
this.breadcrumbService.updateBreadcrumb([{ label: 'Info' }]);
diff --git a/ui/src/app/info/versions/versions.component.ts b/ui/src/app/info/versions/versions.component.ts
index 9611c50670..165815c3b9 100644
--- a/ui/src/app/info/versions/versions.component.ts
+++ b/ui/src/app/info/versions/versions.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { VersionInfo } from './service/version-info.model';
import { SystemInfo } from './service/system-info.model';
import { RestApi } from '../../services/rest-api.service';
@@ -43,10 +43,12 @@ import { SpBasicInnerPanelComponent } from '@streampipes/shared-ui';
],
})
export class VersionsComponent {
+ private restApi = inject(RestApi);
+
versionInfo: VersionInfo;
systemInfo: SystemInfo;
- constructor(private restApi: RestApi) {
+ constructor() {
this.getVersionInfo();
this.getSystemInfo();
}
(streampipes) 24/24: migrate shared UI services to inject()
Posted by ze...@apache.org.
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 5e90a44ae1ee0416b2a27b88ea17a6cbc9375b82
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 11:13:08 2026 +0100
migrate shared UI services to inject()
---
.../streampipes/shared-ui/src/lib/services/current-user.service.ts | 4 ++--
.../streampipes/shared-ui/src/lib/services/date-format.service.ts | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ui/projects/streampipes/shared-ui/src/lib/services/current-user.service.ts b/ui/projects/streampipes/shared-ui/src/lib/services/current-user.service.ts
index 2eb4e5b051..885edf6d89 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/services/current-user.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/services/current-user.service.ts
@@ -18,12 +18,12 @@
import { BehaviorSubject } from 'rxjs';
import { UserInfo } from '@streampipes/platform-services';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { JwtTokenStorageService } from './jwt-token-storage.service';
@Injectable({ providedIn: 'root' })
export class CurrentUserService {
- constructor(private jwtTokenStorageService: JwtTokenStorageService) {}
+ private jwtTokenStorageService = inject(JwtTokenStorageService);
public authToken$: BehaviorSubject<string> = new BehaviorSubject<string>(
undefined,
diff --git a/ui/projects/streampipes/shared-ui/src/lib/services/date-format.service.ts b/ui/projects/streampipes/shared-ui/src/lib/services/date-format.service.ts
index 539fdf14f7..f25b857dbc 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/services/date-format.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/services/date-format.service.ts
@@ -15,14 +15,14 @@
* limitations under the License.
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
@Injectable({
providedIn: 'root',
})
export class DateFormatService {
- constructor(private translateService: TranslateService) {}
+ private translateService = inject(TranslateService);
formatDate(timestamp?: number): string {
if (!timestamp) {
(streampipes) 12/24: migrate chart shared UI to inject()
Posted by ze...@apache.org.
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 353f1bdb1fbf2aa89cb5a9e36ab3c0f01a8a8c31
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:59:53 2026 +0100
migrate chart shared UI to inject()
---
.../color-mapping-options-config.component.ts | 5 +++--
.../echarts-widget-appearance-config.component.ts | 8 +++----
.../select-color-properties-config.component.ts | 15 ++++++++-----
.../chart-container/chart-container.component.ts | 25 ++++++++++-----------
.../components/chart-container/chart.directive.ts | 4 ++--
.../gauge/config/gauge-widget-config.component.ts | 10 ++++-----
.../config/heatmap-widget-config.component.ts | 10 ++++-----
.../indicator-appearance-config.component.ts | 8 +++----
.../map/config/map-widget-config.component.ts | 10 ++++-----
.../config/pie-chart-widget-config.component.ts | 10 ++++-----
.../status-heatmap-widget-config.component.ts | 10 ++++-----
.../config/status-widget-config.component.ts | 10 ++++-----
.../table/config/table-widget-config.component.ts | 10 ++++-----
.../charts/table/table-widget.component.ts | 14 +++++++-----
.../time-series-appearance-config.component.ts | 8 +++----
.../time-series-chart-widget-config.component.ts | 10 ++++-----
.../traffic-light-widget-config.component.ts | 8 +++----
.../registry/chart-registry.service.ts | 26 +++++++++++-----------
.../chart-shared/services/chart-routing.service.ts | 6 ++---
19 files changed, 105 insertions(+), 102 deletions(-)
diff --git a/ui/src/app/chart-shared/components/chart-config/color-mapping-options-config/color-mapping-options-config.component.ts b/ui/src/app/chart-shared/components/chart-config/color-mapping-options-config/color-mapping-options-config.component.ts
index 8990edfa7a..03380eddb0 100644
--- a/ui/src/app/chart-shared/components/chart-config/color-mapping-options-config/color-mapping-options-config.component.ts
+++ b/ui/src/app/chart-shared/components/chart-config/color-mapping-options-config/color-mapping-options-config.component.ts
@@ -24,6 +24,7 @@ import {
OnInit,
Output,
SimpleChanges,
+ inject,
} from '@angular/core';
import { ColorMappingService } from '../../../services/color-mapping.service';
import { DataExplorerField } from '@streampipes/platform-services';
@@ -67,6 +68,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ColorMappingOptionsConfigComponent implements OnInit, OnChanges {
+ private colorMappingService = inject(ColorMappingService);
+
@Input() colorMapping: { value: string; label: string; color: string }[];
@Input() selectedProperty: DataExplorerField;
@@ -86,8 +89,6 @@ export class ColorMappingOptionsConfigComponent implements OnInit, OnChanges {
protected isSelectedPropertyBoolean: boolean;
private wasPreviousFieldBoolean: boolean;
- constructor(private colorMappingService: ColorMappingService) {}
-
ngOnInit(): void {
this.isSelectedPropertyBoolean = this.isBooleanPropertySelected();
this.resetColorMappings();
diff --git a/ui/src/app/chart-shared/components/chart-config/echarts-widget-appearance-config/echarts-widget-appearance-config.component.ts b/ui/src/app/chart-shared/components/chart-config/echarts-widget-appearance-config/echarts-widget-appearance-config.component.ts
index 238c48f884..5c5ab4da66 100644
--- a/ui/src/app/chart-shared/components/chart-config/echarts-widget-appearance-config/echarts-widget-appearance-config.component.ts
+++ b/ui/src/app/chart-shared/components/chart-config/echarts-widget-appearance-config/echarts-widget-appearance-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { WidgetEchartsAppearanceConfig } from '../../../models/dataview-dashboard.model';
import { ChartConfigurationService } from '../../../services/chart-configuration.service';
import { SplitSectionComponent } from '@streampipes/shared-ui';
@@ -30,13 +30,11 @@ import { TranslatePipe } from '@ngx-translate/core';
imports: [SplitSectionComponent, MatCheckbox, FormsModule, TranslatePipe],
})
export class SpEchartsWidgetAppearanceConfigComponent implements OnInit {
+ private widgetConfigurationService = inject(ChartConfigurationService);
+
@Input()
appearanceConfig: WidgetEchartsAppearanceConfig;
- constructor(
- private widgetConfigurationService: ChartConfigurationService,
- ) {}
-
ngOnInit() {
this.appearanceConfig.chartAppearance ??= {
showLegend: true,
diff --git a/ui/src/app/chart-shared/components/chart-config/select-color-properties-config/select-color-properties-config.component.ts b/ui/src/app/chart-shared/components/chart-config/select-color-properties-config/select-color-properties-config.component.ts
index 94b92b43d6..ffe177b5ba 100644
--- a/ui/src/app/chart-shared/components/chart-config/select-color-properties-config/select-color-properties-config.component.ts
+++ b/ui/src/app/chart-shared/components/chart-config/select-color-properties-config/select-color-properties-config.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { ChartConfigurationService } from '../../../services/chart-configuration.service';
import { DataExplorerField } from '@streampipes/platform-services';
import { TimeSeriesChartWidgetModel } from '../../charts/time-series-chart/model/time-series-chart-widget.model';
@@ -39,6 +46,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SelectColorPropertiesConfigComponent implements OnInit {
+ protected widgetConfigurationService = inject(ChartConfigurationService);
+
@Output() changeSelectedProperties: EventEmitter<DataExplorerField[]> =
new EventEmitter();
@@ -46,10 +55,6 @@ export class SelectColorPropertiesConfigComponent implements OnInit {
@Input() selectedProperties: DataExplorerField[];
@Input() currentlyConfiguredWidget: TimeSeriesChartWidgetModel;
- constructor(
- protected widgetConfigurationService: ChartConfigurationService,
- ) {}
-
ngOnInit(): void {
if (!this.selectedProperties) {
this.selectedProperties = [];
diff --git a/ui/src/app/chart-shared/components/chart-container/chart-container.component.ts b/ui/src/app/chart-shared/components/chart-container/chart-container.component.ts
index 735874318d..c35ee55b03 100644
--- a/ui/src/app/chart-shared/components/chart-container/chart-container.component.ts
+++ b/ui/src/app/chart-shared/components/chart-container/chart-container.component.ts
@@ -30,6 +30,7 @@ import {
Output,
SimpleChanges,
ViewChild,
+ inject,
} from '@angular/core';
import {
ClientDashboardItem,
@@ -109,6 +110,17 @@ import { TranslatePipe } from '@ngx-translate/core';
export class ChartContainerComponent
implements OnInit, OnDestroy, OnChanges, AfterViewInit
{
+ private chartRegistryService = inject(ChartRegistry);
+ private dashboardService = inject(ChartSharedService);
+ private componentFactoryResolver = inject(ComponentFactoryResolver);
+ private widgetTypeService = inject(ChartTypeService);
+ private authService = inject(AuthService);
+ private currentUserService = inject(CurrentUserService);
+ private timeSelectionService = inject(TimeSelectionService);
+ private nameChangeService = inject(NameChangeService);
+ private el = inject<ElementRef<HTMLDivElement>>(ElementRef);
+ private resizeService = inject(ResizeService);
+
@ViewChild('menuTrigger') menu: MatMenuTrigger;
@ViewChild('timeSelectorMenu')
timeSelectorMenu: TimeRangeSelectorMenuComponent;
@@ -194,19 +206,6 @@ export class ChartContainerComponent
@ViewChild(ChartDirective, { static: true }) widgetHost!: ChartDirective;
- constructor(
- private chartRegistryService: ChartRegistry,
- private dashboardService: ChartSharedService,
- private componentFactoryResolver: ComponentFactoryResolver,
- private widgetTypeService: ChartTypeService,
- private authService: AuthService,
- private currentUserService: CurrentUserService,
- private timeSelectionService: TimeSelectionService,
- private nameChangeService: NameChangeService,
- private el: ElementRef<HTMLDivElement>,
- private resizeService: ResizeService,
- ) {}
-
resizeObserver: ResizeObserver;
resizeTimeout: any;
diff --git a/ui/src/app/chart-shared/components/chart-container/chart.directive.ts b/ui/src/app/chart-shared/components/chart-container/chart.directive.ts
index 5f9da6929f..aa50d8b914 100644
--- a/ui/src/app/chart-shared/components/chart-container/chart.directive.ts
+++ b/ui/src/app/chart-shared/components/chart-container/chart.directive.ts
@@ -16,9 +16,9 @@
*
*/
-import { Directive, ViewContainerRef } from '@angular/core';
+import { Directive, ViewContainerRef, inject } from '@angular/core';
@Directive({ selector: '[spWidgetHost]' })
export class ChartDirective {
- constructor(public viewContainerRef: ViewContainerRef) {}
+ viewContainerRef = inject(ViewContainerRef);
}
diff --git a/ui/src/app/chart-shared/components/charts/gauge/config/gauge-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/gauge/config/gauge-widget-config.component.ts
index 5e1ac40b16..90af46b7b0 100644
--- a/ui/src/app/chart-shared/components/charts/gauge/config/gauge-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/gauge/config/gauge-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import { ChartFieldProviderService } from '../../../../services/chart-field-provider.service';
@@ -53,10 +53,10 @@ export class GaugeWidgetConfigComponent extends BaseWidgetConfig<
GaugeWidgetModel,
GaugeVisConfig
> {
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/heatmap/config/heatmap-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/heatmap/config/heatmap-widget-config.component.ts
index 3ef1aa3781..c40a0f6234 100644
--- a/ui/src/app/chart-shared/components/charts/heatmap/config/heatmap-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/heatmap/config/heatmap-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import {
@@ -56,10 +56,10 @@ export class HeatmapWidgetConfigComponent extends BaseWidgetConfig<
HeatmapWidgetModel,
HeatmapVisConfig
> {
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/indicator/appearance-config/indicator-appearance-config.component.ts b/ui/src/app/chart-shared/components/charts/indicator/appearance-config/indicator-appearance-config.component.ts
index ceaf45c7e3..d7f05fe5d7 100644
--- a/ui/src/app/chart-shared/components/charts/indicator/appearance-config/indicator-appearance-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/indicator/appearance-config/indicator-appearance-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import { IndicatorAppearanceConfig } from '../model/indicator-chart-widget.model';
import {
@@ -43,13 +43,11 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class IndicatorAppearanceConfigComponent implements OnInit {
+ private widgetConfigurationService = inject(ChartConfigurationService);
+
@Input()
appearanceConfig: IndicatorAppearanceConfig;
- constructor(
- private widgetConfigurationService: ChartConfigurationService,
- ) {}
-
ngOnInit(): void {
this.ensureAppearanceConfig();
}
diff --git a/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.ts
index 30c8f1836d..9f80242c75 100644
--- a/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/map/config/map-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import { ChartFieldProviderService } from '../../../../services/chart-field-provider.service';
@@ -67,10 +67,10 @@ export class MapWidgetConfigComponent extends BaseWidgetConfig<
markerOrTrace: string[];
markerType: string[];
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/pie/config/pie-chart-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/pie/config/pie-chart-widget-config.component.ts
index 21ada175d1..6e01a2e153 100644
--- a/ui/src/app/chart-shared/components/charts/pie/config/pie-chart-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/pie/config/pie-chart-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import {
PieChartVisConfig,
@@ -60,10 +60,10 @@ export class SpPieChartWidgetConfigComponent extends BaseWidgetConfig<
PieChartWidgetModel,
PieChartVisConfig
> {
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/status-heatmap/config/status-heatmap-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/status-heatmap/config/status-heatmap-widget-config.component.ts
index 420f239bf1..c0519b0895 100644
--- a/ui/src/app/chart-shared/components/charts/status-heatmap/config/status-heatmap-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/status-heatmap/config/status-heatmap-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import {
@@ -46,10 +46,10 @@ export class StatusHeatmapWidgetConfigComponent extends BaseWidgetConfig<
StatusHeatmapWidgetModel,
StatusHeatmapVisConfig
> {
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/status/config/status-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/status/config/status-widget-config.component.ts
index b97789ce30..83b0212dba 100644
--- a/ui/src/app/chart-shared/components/charts/status/config/status-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/status/config/status-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import {
@@ -63,10 +63,10 @@ export class StatusWidgetConfigComponent extends BaseWidgetConfig<
StatusWidgetModel,
StatusVisConfig
> {
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/table/config/table-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/table/config/table-widget-config.component.ts
index 2b311bdfde..8957d5adbe 100644
--- a/ui/src/app/chart-shared/components/charts/table/config/table-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/table/config/table-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import { TableVisConfig, TableWidgetModel } from '../model/table-widget.model';
@@ -80,10 +80,10 @@ export class TableWidgetConfigComponent extends BaseWidgetConfig<
'#9333EA',
];
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts b/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts
index 850b9531e1..4aceeec541 100644
--- a/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts
+++ b/ui/src/app/chart-shared/components/charts/table/table-widget.component.ts
@@ -17,7 +17,13 @@
*/
import { DatePipe, NgClass, NgStyle } from '@angular/common';
-import { Component, ElementRef, HostListener, ViewChild } from '@angular/core';
+import {
+ Component,
+ ElementRef,
+ HostListener,
+ ViewChild,
+ inject,
+} from '@angular/core';
import { MatIcon } from '@angular/material/icon';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatCheckbox } from '@angular/material/checkbox';
@@ -102,6 +108,8 @@ const TIMESTAMP_MASK = 'yyyy-mm-dd HH:mm:ss.SSS';
],
})
export class TableWidgetComponent extends BaseDataExplorerWidgetDirective<TableWidgetModel> {
+ private elRef = inject(ElementRef);
+
private static readonly DEFAULT_PAGE_SIZE = 20;
@ViewChild(MatPaginator) paginator: MatPaginator;
@@ -129,10 +137,6 @@ export class TableWidgetComponent extends BaseDataExplorerWidgetDirective<TableW
dropdownStyle: Record<string, string> = {};
filterListScrollEnd = true;
- constructor(private elRef: ElementRef) {
- super();
- }
-
@HostListener('document:click', ['$event'])
onDocumentClick(event: MouseEvent): void {
if (!this.openFilterColumn) return;
diff --git a/ui/src/app/chart-shared/components/charts/time-series-chart/appearance-config/time-series-appearance-config.component.ts b/ui/src/app/chart-shared/components/charts/time-series-chart/appearance-config/time-series-appearance-config.component.ts
index 707499b8b9..0903c8fcef 100644
--- a/ui/src/app/chart-shared/components/charts/time-series-chart/appearance-config/time-series-appearance-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/time-series-chart/appearance-config/time-series-appearance-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { TimeSeriesAppearanceConfig } from '../../../../models/dataview-dashboard.model';
import { ChartConfigurationService } from '../../../../services/chart-configuration.service';
import { LayoutDirective } from '@ngbracket/ngx-layout/flex';
@@ -33,13 +33,11 @@ import { SpDataZoomConfigComponent } from '../../../chart-config/data-zoom-confi
],
})
export class SpTimeSeriesAppearanceConfigComponent {
+ private widgetConfigurationService = inject(ChartConfigurationService);
+
@Input()
appearanceConfig: TimeSeriesAppearanceConfig;
- constructor(
- private widgetConfigurationService: ChartConfigurationService,
- ) {}
-
triggerViewUpdate() {
this.widgetConfigurationService.notify({
refreshView: true,
diff --git a/ui/src/app/chart-shared/components/charts/time-series-chart/config/time-series-chart-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/time-series-chart/config/time-series-chart-widget-config.component.ts
index 8502428b85..9e70d349e4 100644
--- a/ui/src/app/chart-shared/components/charts/time-series-chart/config/time-series-chart-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/time-series-chart/config/time-series-chart-widget-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { BaseWidgetConfig } from '../../base/base-widget-config';
import {
TimeSeriesChartVisConfig,
@@ -50,10 +50,10 @@ export class TimeSeriesChartWidgetConfigComponent extends BaseWidgetConfig<
TimeSeriesChartWidgetModel,
TimeSeriesChartVisConfig
> {
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
diff --git a/ui/src/app/chart-shared/components/charts/traffic-light/config/traffic-light-widget-config.component.ts b/ui/src/app/chart-shared/components/charts/traffic-light/config/traffic-light-widget-config.component.ts
index 51bb7e578d..adb56b7652 100644
--- a/ui/src/app/chart-shared/components/charts/traffic-light/config/traffic-light-widget-config.component.ts
+++ b/ui/src/app/chart-shared/components/charts/traffic-light/config/traffic-light-widget-config.component.ts
@@ -61,10 +61,10 @@ export class TrafficLightWidgetConfigComponent extends BaseWidgetConfig<
TrafficLightVisConfig
> {
translateService: TranslateService = inject(TranslateService);
- constructor(
- widgetConfigurationService: ChartConfigurationService,
- fieldService: ChartFieldProviderService,
- ) {
+ constructor() {
+ const widgetConfigurationService = inject(ChartConfigurationService);
+ const fieldService = inject(ChartFieldProviderService);
+
super(widgetConfigurationService, fieldService);
}
warningRangeInterval: string;
diff --git a/ui/src/app/chart-shared/registry/chart-registry.service.ts b/ui/src/app/chart-shared/registry/chart-registry.service.ts
index 5b16d99c08..2a4cc8643c 100644
--- a/ui/src/app/chart-shared/registry/chart-registry.service.ts
+++ b/ui/src/app/chart-shared/registry/chart-registry.service.ts
@@ -17,7 +17,7 @@
*/
import { IWidget } from '../models/dataview-dashboard.model';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { TableWidgetConfigComponent } from '../components/charts/table/config/table-widget-config.component';
import { TableWidgetComponent } from '../components/charts/table/table-widget.component';
import { MapWidgetConfigComponent } from '../components/charts/map/config/map-widget-config.component';
@@ -63,20 +63,20 @@ import { TranslateService } from '@ngx-translate/core';
@Injectable({ providedIn: 'root' })
export class ChartRegistry {
+ private gaugeRenderer = inject(SpGaugeRendererService);
+ private heatmapRenderer = inject(SpHeatmapRendererService);
+ private statusHeatmapRenderer = inject(SpStatusHeatmapRendererService);
+ private histogramRenderer = inject(SpHistogramRendererService);
+ private pieRenderer = inject(SpPieRendererService);
+ private valueHeatmapRenderer = inject(SpValueHeatmapRendererService);
+ private scatterRenderer = inject(SpScatterRendererService);
+ private densityRenderer = inject(SpDensityRendererService);
+ private timeseriesRenderer = inject(SpTimeseriesRendererService);
+ private translateService = inject(TranslateService);
+
chartTypes: IWidget<any>[] = [];
- constructor(
- private gaugeRenderer: SpGaugeRendererService,
- private heatmapRenderer: SpHeatmapRendererService,
- private statusHeatmapRenderer: SpStatusHeatmapRendererService,
- private histogramRenderer: SpHistogramRendererService,
- private pieRenderer: SpPieRendererService,
- private valueHeatmapRenderer: SpValueHeatmapRendererService,
- private scatterRenderer: SpScatterRendererService,
- private densityRenderer: SpDensityRendererService,
- private timeseriesRenderer: SpTimeseriesRendererService,
- private translateService: TranslateService,
- ) {
+ constructor() {
this.chartTypes = [
{
id: 'gauge',
diff --git a/ui/src/app/chart-shared/services/chart-routing.service.ts b/ui/src/app/chart-shared/services/chart-routing.service.ts
index d8346bdf97..d4d4c5d66a 100644
--- a/ui/src/app/chart-shared/services/chart-routing.service.ts
+++ b/ui/src/app/chart-shared/services/chart-routing.service.ts
@@ -16,16 +16,16 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { Router } from '@angular/router';
@Injectable({ providedIn: 'root' })
export class ChartRoutingService {
+ private router = inject(Router);
+
private chartPath = ['chart'];
private dashboardPath = ['dashboard'];
- constructor(private router: Router) {}
-
navigateToDataViewOverview(omitConfirm: boolean = false): void {
this.navigateToOverview(this.chartPath, omitConfirm);
}
(streampipes) 13/24: migrate home UI to inject()
Posted by ze...@apache.org.
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 798b2a557a7eed62f483b70c9c1c78e52ccb5dc7
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:00:14 2026 +0100
migrate home UI to inject()
---
.../app/home/dialog/welcome-tour/welcome-tour.component.ts | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/ui/src/app/home/dialog/welcome-tour/welcome-tour.component.ts b/ui/src/app/home/dialog/welcome-tour/welcome-tour.component.ts
index dbcada85b8..b867c56daf 100644
--- a/ui/src/app/home/dialog/welcome-tour/welcome-tour.component.ts
+++ b/ui/src/app/home/dialog/welcome-tour/welcome-tour.component.ts
@@ -17,7 +17,7 @@
*/
import { DialogRef } from '@streampipes/shared-ui';
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { AppConstants } from '../../../services/app.constants';
import { AuthService } from '../../../services/auth.service';
import { UserAccount, UserInfo } from '@streampipes/platform-services';
@@ -43,18 +43,16 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class WelcomeTourComponent implements OnInit {
+ private authService = inject(AuthService);
+ private dialogRef = inject<DialogRef<WelcomeTourComponent>>(DialogRef);
+ private profileService = inject(ProfileService);
+ appConstants = inject(AppConstants);
+
@Input()
userInfo: UserInfo;
currentUser: UserAccount;
- constructor(
- private authService: AuthService,
- private dialogRef: DialogRef<WelcomeTourComponent>,
- private profileService: ProfileService,
- public appConstants: AppConstants,
- ) {}
-
ngOnInit(): void {
this.profileService
.getUserProfile(this.userInfo.username)
(streampipes) 01/24: migrate app shell to inject()
Posted by ze...@apache.org.
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 a7197d3333c250ea29c52b150844137372f3fa55
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:39:13 2026 +0100
migrate app shell to inject()
---
ui/src/app/app.component.ts | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts
index 50f986441c..7b246bcec3 100644
--- a/ui/src/app/app.component.ts
+++ b/ui/src/app/app.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { slideInAnimation } from './animation';
import { Title } from '@angular/platform-browser';
@@ -31,11 +31,13 @@ import { LoadingBarModule } from '@ngx-loading-bar/core';
imports: [LoadingBarModule, RouterOutlet],
})
export class AppComponent implements OnInit {
- constructor(
- private titleService: Title,
- private appConstants: AppConstants,
- private translate: TranslateService,
- ) {
+ private titleService = inject(Title);
+ private appConstants = inject(AppConstants);
+ private translate = inject(TranslateService);
+
+ constructor() {
+ const translate = this.translate;
+
const supportedLanguages = ['de', 'en', 'pl'];
const defaultLanguage = 'en';
this.translate.addLangs(supportedLanguages);
(streampipes) 11/24: migrate dashboard shared services to inject()
Posted by ze...@apache.org.
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 a9f34c46e192bfcf725e48ea390508516ef11e50
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:59:32 2026 +0100
migrate dashboard shared services to inject()
---
ui/src/app/dashboard-shared/services/dashboard.service.ts | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/ui/src/app/dashboard-shared/services/dashboard.service.ts b/ui/src/app/dashboard-shared/services/dashboard.service.ts
index efa9ba8ab1..7a27d70ebc 100644
--- a/ui/src/app/dashboard-shared/services/dashboard.service.ts
+++ b/ui/src/app/dashboard-shared/services/dashboard.service.ts
@@ -19,15 +19,13 @@
import { Dashboard } from '@streampipes/platform-services';
import { EditDashboardDialogComponent } from '../../dashboard/dialogs/edit-dashboard/edit-dashboard-dialog.component';
import { DialogService, PanelType } from '@streampipes/shared-ui';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
@Injectable({ providedIn: 'root' })
export class DataExplorerDashboardService {
- constructor(
- private dialogService: DialogService,
- private translateService: TranslateService,
- ) {}
+ private dialogService = inject(DialogService);
+ private translateService = inject(TranslateService);
openDashboardModificationDialog(createMode: boolean, dashboard: Dashboard) {
return this.dialogService.open(EditDashboardDialogComponent, {
(streampipes) 07/24: migrate core guards to inject()
Posted by ze...@apache.org.
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 e55fc796adedf4d2545d666cb38ee81dc4dc6bd2
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:57:53 2026 +0100
migrate core guards to inject()
---
ui/src/app/core/auth/guards/auth.can-activate-children.guard.ts | 4 ++--
ui/src/app/core/auth/guards/page-auth.can-activate.guard.ts | 4 ++--
ui/src/app/core/setup/guards/configured.can-activate.guard.ts | 7 +++++--
.../core/setup/guards/registration-allowed.can-activate.guard.ts | 8 +++-----
.../setup/guards/restore-password-allowed.can-activate.guard.ts | 8 +++-----
5 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/ui/src/app/core/auth/guards/auth.can-activate-children.guard.ts b/ui/src/app/core/auth/guards/auth.can-activate-children.guard.ts
index a9440317a4..8ff7fc0c09 100644
--- a/ui/src/app/core/auth/guards/auth.can-activate-children.guard.ts
+++ b/ui/src/app/core/auth/guards/auth.can-activate-children.guard.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
ActivatedRouteSnapshot,
CanActivateChild,
@@ -28,7 +28,7 @@ import { AuthService } from '../../../services/auth.service';
@Injectable({ providedIn: 'root' })
export class AuthCanActivateChildrenGuard implements CanActivateChild {
- constructor(private authService: AuthService) {}
+ private authService = inject(AuthService);
canActivateChild(
childRoute: ActivatedRouteSnapshot,
diff --git a/ui/src/app/core/auth/guards/page-auth.can-activate.guard.ts b/ui/src/app/core/auth/guards/page-auth.can-activate.guard.ts
index 93f14bb7f1..e87c2151ec 100644
--- a/ui/src/app/core/auth/guards/page-auth.can-activate.guard.ts
+++ b/ui/src/app/core/auth/guards/page-auth.can-activate.guard.ts
@@ -25,11 +25,11 @@ import {
RouterStateSnapshot,
} from '@angular/router';
import { AuthService } from '../../../services/auth.service';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class PageAuthGuard implements CanActivate, CanActivateChild {
- constructor(private authService: AuthService) {}
+ private authService = inject(AuthService);
canActivate(
route: ActivatedRouteSnapshot,
diff --git a/ui/src/app/core/setup/guards/configured.can-activate.guard.ts b/ui/src/app/core/setup/guards/configured.can-activate.guard.ts
index 341a37b9c8..573e265416 100644
--- a/ui/src/app/core/setup/guards/configured.can-activate.guard.ts
+++ b/ui/src/app/core/setup/guards/configured.can-activate.guard.ts
@@ -16,14 +16,17 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { Router, UrlTree } from '@angular/router';
import { AuthService } from '../../../services/auth.service';
import { BaseConfiguredCanActivateGuard } from './base-configured.can-activate.guard';
@Injectable({ providedIn: 'root' })
export class ConfiguredCanActivateGuard extends BaseConfiguredCanActivateGuard {
- constructor(router: Router, authService: AuthService) {
+ constructor() {
+ const router = inject(Router);
+ const authService = inject(AuthService);
+
super(router, authService);
}
diff --git a/ui/src/app/core/setup/guards/registration-allowed.can-activate.guard.ts b/ui/src/app/core/setup/guards/registration-allowed.can-activate.guard.ts
index 62e64b0fe7..22963fe820 100644
--- a/ui/src/app/core/setup/guards/registration-allowed.can-activate.guard.ts
+++ b/ui/src/app/core/setup/guards/registration-allowed.can-activate.guard.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
ActivatedRouteSnapshot,
Router,
@@ -29,10 +29,8 @@ import { map } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class RegistrationAllowedCanActivateGuard {
- constructor(
- private router: Router,
- private loginService: LoginService,
- ) {}
+ private router = inject(Router);
+ private loginService = inject(LoginService);
canActivate(
route: ActivatedRouteSnapshot,
diff --git a/ui/src/app/core/setup/guards/restore-password-allowed.can-activate.guard.ts b/ui/src/app/core/setup/guards/restore-password-allowed.can-activate.guard.ts
index 1240e471ab..1e06442176 100644
--- a/ui/src/app/core/setup/guards/restore-password-allowed.can-activate.guard.ts
+++ b/ui/src/app/core/setup/guards/restore-password-allowed.can-activate.guard.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
ActivatedRouteSnapshot,
Router,
@@ -29,10 +29,8 @@ import { map } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class RestorePasswordAllowedCanActivateGuard {
- constructor(
- private router: Router,
- private loginService: LoginService,
- ) {}
+ private router = inject(Router);
+ private loginService = inject(LoginService);
canActivate(
route: ActivatedRouteSnapshot,
(streampipes) 23/24: migrate shared UI dialogs to inject()
Posted by ze...@apache.org.
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 bbecbd7fc5cc425af10f35d6df25d39fe8d4201e
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 11:13:06 2026 +0100
migrate shared UI dialogs to inject()
---
.../src/lib/dialog/base-dialog/base-dialog.service.ts | 8 +++-----
.../components/download/download.component.ts | 6 +++---
.../data-download-dialog/data-download-dialog.component.ts | 10 ++++------
.../data-download-dialog/services/data-export.service.ts | 12 +++++-------
.../pipeline-element-help/pipeline-element-help.component.ts | 5 +++--
5 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts
index 70db47f46b..8f3243feaf 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/base-dialog/base-dialog.service.ts
@@ -17,7 +17,7 @@
*/
import { ComponentType, Overlay, OverlayRef } from '@angular/cdk/overlay';
-import { ComponentRef, Injectable, Injector } from '@angular/core';
+import { ComponentRef, Injectable, Injector, inject } from '@angular/core';
import { DialogRef } from './dialog-ref';
import { ComponentPortal } from '@angular/cdk/portal';
import {
@@ -37,10 +37,8 @@ import { CardDialogConfig } from '../card-dialog/card-dialog-config';
providedIn: 'root',
})
export class DialogService {
- constructor(
- private overlay: Overlay,
- private injector: Injector,
- ) {}
+ private overlay = inject(Overlay);
+ private injector = inject(Injector);
public open<T>(
component: ComponentType<T>,
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
index 0b832c26c3..4b1fb79479 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Component, OnDestroy, OnInit, inject } from '@angular/core';
import { DataExportService } from '../../services/data-export.service';
import { DownloadProgress } from '../../model/download-progress.model';
import { Subscription } from 'rxjs';
@@ -49,11 +49,11 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class DownloadComponent implements OnInit, OnDestroy {
+ dataExportService = inject(DataExportService);
+
downloadProgress: DownloadProgress;
downloadProgressSubscription: Subscription;
- constructor(public dataExportService: DataExportService) {}
-
ngOnInit(): void {
this.downloadProgress = {
downloadedMBs: 0,
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
index cf8519b861..7a904a494e 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit, ViewChild } from '@angular/core';
+import { Component, Input, OnInit, ViewChild, inject } from '@angular/core';
import { MatStep, MatStepLabel, MatStepper } from '@angular/material/stepper';
import { DialogRef } from '../base-dialog/dialog-ref';
import { ExportConfig } from './model/export-config.model';
@@ -48,6 +48,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class DataDownloadDialogComponent implements OnInit {
+ dialogRef = inject<DialogRef<DataDownloadDialogComponent>>(DialogRef);
+ dataExportService = inject(DataExportService);
+
@Input() dataDownloadDialogModel: DataDownloadDialogModel;
@ViewChild('downloadDialogStepper', { static: true })
@@ -56,11 +59,6 @@ export class DataDownloadDialogComponent implements OnInit {
@Input()
exportConfig: ExportConfig;
- constructor(
- public dialogRef: DialogRef<DataDownloadDialogComponent>,
- public dataExportService: DataExportService,
- ) {}
-
ngOnInit() {
const measurementName =
this.dataDownloadDialogModel.measureName !== undefined
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
index a014ed97f9..2faab75280 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { EventEmitter, Injectable } from '@angular/core';
+import { EventEmitter, Injectable, inject } from '@angular/core';
import { ExportConfig } from '../model/export-config.model';
import {
DatalakeQueryParameters,
@@ -32,15 +32,13 @@ import { FileNameService } from './file-name.service';
providedIn: 'root',
})
export class DataExportService {
+ dataLakeRestService = inject(DatalakeRestService);
+ dataViewQueryGeneratorService = inject(DataViewQueryGeneratorService);
+ fileNameService = inject(FileNameService);
+
public updateDownloadProgress: EventEmitter<DownloadProgress> =
new EventEmitter();
- constructor(
- public dataLakeRestService: DatalakeRestService,
- public dataViewQueryGeneratorService: DataViewQueryGeneratorService,
- public fileNameService: FileNameService,
- ) {}
-
public downloadData(
exportConfig: ExportConfig,
dataDownloadDialogModel: DataDownloadDialogModel,
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts
index afe42a07cc..a9addf9cc2 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts
@@ -53,6 +53,9 @@ import { MatButton } from '@angular/material/button';
],
})
export class PipelineElementHelpComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<PipelineElementHelpComponent>>(DialogRef);
+
selectedTabIndex = 0;
translateService = inject(TranslateService);
@@ -72,8 +75,6 @@ export class PipelineElementHelpComponent implements OnInit {
isDataStream: boolean;
- constructor(private dialogRef: DialogRef<PipelineElementHelpComponent>) {}
-
ngOnInit() {
if (this.pipelineElement instanceof SpDataStream) {
this.tabs = this.availableTabs;
(streampipes) 03/24: migrate http interceptor to inject()
Posted by ze...@apache.org.
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 ee0d6b4d142cc075d488e0650c7daa1c5a05d9b8
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:56:19 2026 +0100
migrate http interceptor to inject()
---
ui/src/app/http-interceptor.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ui/src/app/http-interceptor.ts b/ui/src/app/http-interceptor.ts
index 5d41ae147f..48471fe8bb 100644
--- a/ui/src/app/http-interceptor.ts
+++ b/ui/src/app/http-interceptor.ts
@@ -23,12 +23,12 @@ import {
HttpRequest,
} from '@angular/common/http';
import { Observable } from 'rxjs';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { CurrentUserService } from '@streampipes/shared-ui';
@Injectable()
export class HttpInterceptorProvider implements HttpInterceptor {
- constructor(private currentUserService: CurrentUserService) {}
+ private currentUserService = inject(CurrentUserService);
intercept(
req: HttpRequest<any>,
(streampipes) 21/24: migrate configuration UI to inject()
Posted by ze...@apache.org.
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 45ad9e030c5cc355006f54643e3ff5ae938baefc
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:05:11 2026 +0100
migrate configuration UI to inject()
---
.../extensions-installation.component.ts | 13 +-
.../extensions-service-details-dialog.component.ts | 9 +-
.../file-rename/file-rename-dialog.component.ts | 8 +-
.../file-upload/file-upload-dialog.component.ts | 8 +-
.../email-configuration.component.ts | 16 +-
.../email-template-configuration.component.ts | 8 +-
.../export/data-export-import.component.ts | 16 +-
.../configuration/export/data-export.service.ts | 8 +-
.../export-dialog/data-export-dialog.component.ts | 11 +-
.../import-dialog/data-import-dialog.component.ts | 9 +-
.../endpoint-item/endpoint-item.component.ts | 27 ++-
.../extensions-installation.component.ts | 18 +-
.../extensions-installation.service.ts | 8 +-
.../extensions-service-configuration.component.ts | 6 +-
.../service-configs-boolean.component.ts | 5 +-
.../service-configs-number.component.ts | 5 +-
.../service-configs-password.component.ts | 6 +-
.../service-configs-text.component.ts | 5 +-
.../extensions-service-management.component.ts | 10 +-
.../registered-extensions-services.component.ts | 12 +-
.../files/file-overview/file-overview.component.ts | 12 +-
ui/src/app/configuration/files/files.component.ts | 14 +-
.../general-configuration.component.ts | 20 +-
.../label-configuration.component.ts | 12 +-
.../authentication-configuration.component.ts | 4 +-
.../edit-group-dialog.component.ts | 20 +-
.../edit-role-dialog/edit-role-dialog.component.ts | 14 +-
.../edit-user-dialog/edit-user-dialog.component.ts | 32 +--
.../role-configuration.component.ts | 14 +-
.../user-group-configuration.component.ts | 14 +-
.../configuration/shared/configuration.service.ts | 226 ++++++++++-----------
.../location-features-configuration.component.ts | 14 +-
.../site-area-configuration.component.ts | 12 +-
33 files changed, 300 insertions(+), 316 deletions(-)
diff --git a/ui/src/app/configuration/dialog/extensions-installation/extensions-installation.component.ts b/ui/src/app/configuration/dialog/extensions-installation/extensions-installation.component.ts
index 2913618dc0..efc89cbd58 100644
--- a/ui/src/app/configuration/dialog/extensions-installation/extensions-installation.component.ts
+++ b/ui/src/app/configuration/dialog/extensions-installation/extensions-installation.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import {
ExtensionInstallationService,
@@ -43,6 +43,11 @@ import { MatButton } from '@angular/material/button';
],
})
export class SpExtensionsInstallationDialogComponent {
+ private dialogRef =
+ inject<DialogRef<SpExtensionsInstallationDialogComponent>>(DialogRef);
+ private extensionInstallationService = inject(ExtensionInstallationService);
+ private translateService = inject(TranslateService);
+
endpointItems: ExtensionItemDescription[];
@Input()
@@ -61,11 +66,7 @@ export class SpExtensionsInstallationDialogComponent {
installAsPublicElement = true;
- constructor(
- private dialogRef: DialogRef<SpExtensionsInstallationDialogComponent>,
- private extensionInstallationService: ExtensionInstallationService,
- private translateService: TranslateService,
- ) {
+ constructor() {
this.installationStatus = [];
this.installationFinished = false;
this.page = 'preview';
diff --git a/ui/src/app/configuration/dialog/extensions-service-details/extensions-service-details-dialog.component.ts b/ui/src/app/configuration/dialog/extensions-service-details/extensions-service-details-dialog.component.ts
index fef9b789e5..30b9660dee 100644
--- a/ui/src/app/configuration/dialog/extensions-service-details/extensions-service-details-dialog.component.ts
+++ b/ui/src/app/configuration/dialog/extensions-service-details/extensions-service-details-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import { SpServiceRegistration } from '@streampipes/platform-services';
import {
@@ -42,13 +42,12 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpExtensionsServiceDetailsDialogComponent {
+ private dialogRef =
+ inject<DialogRef<SpExtensionsServiceDetailsDialogComponent>>(DialogRef);
+
@Input()
serviceReg: SpServiceRegistration;
- constructor(
- private dialogRef: DialogRef<SpExtensionsServiceDetailsDialogComponent>,
- ) {}
-
close() {
this.dialogRef.close();
}
diff --git a/ui/src/app/configuration/dialog/file-rename/file-rename-dialog.component.ts b/ui/src/app/configuration/dialog/file-rename/file-rename-dialog.component.ts
index 5676b720aa..4a43a443f5 100644
--- a/ui/src/app/configuration/dialog/file-rename/file-rename-dialog.component.ts
+++ b/ui/src/app/configuration/dialog/file-rename/file-rename-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Inject } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { DialogRef } from '@angular/cdk/dialog';
import { MAT_DIALOG_DATA, MatDialogClose } from '@angular/material/dialog';
import {
@@ -49,10 +49,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class FileRenameDialogComponent {
- constructor(
- private dialogRef: DialogRef<FileRenameDialogComponent>,
- @Inject(MAT_DIALOG_DATA) public fileName: string,
- ) {}
+ private dialogRef = inject<DialogRef<FileRenameDialogComponent>>(DialogRef);
+ fileName = inject(MAT_DIALOG_DATA);
cancel() {
this.dialogRef.close();
diff --git a/ui/src/app/configuration/dialog/file-upload/file-upload-dialog.component.ts b/ui/src/app/configuration/dialog/file-upload/file-upload-dialog.component.ts
index 6555a252c6..de2d8af2cd 100644
--- a/ui/src/app/configuration/dialog/file-upload/file-upload-dialog.component.ts
+++ b/ui/src/app/configuration/dialog/file-upload/file-upload-dialog.component.ts
@@ -60,6 +60,9 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class FileUploadDialogComponent {
+ private dialogRef = inject<DialogRef<FileUploadDialogComponent>>(DialogRef);
+ private filesService = inject(FilesService);
+
private translateService = inject(TranslateService);
inputValue: string;
fileNames: string[] = [];
@@ -76,11 +79,6 @@ export class FileUploadDialogComponent {
uploadError = false;
uploadErrorMessage = '';
- constructor(
- private dialogRef: DialogRef<FileUploadDialogComponent>,
- private filesService: FilesService,
- ) {}
-
handleFileInput(files: FileList) {
this.selectedUploadFiles = files;
for (let i = 0; i < files.length; i++) {
diff --git a/ui/src/app/configuration/email-configuration/email-configuration.component.ts b/ui/src/app/configuration/email-configuration/email-configuration.component.ts
index dbda4a3069..4b10c9e5c2 100644
--- a/ui/src/app/configuration/email-configuration/email-configuration.component.ts
+++ b/ui/src/app/configuration/email-configuration/email-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
@@ -78,6 +78,12 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class EmailConfigurationComponent implements OnInit {
+ private fb = inject(UntypedFormBuilder);
+ private mailConfigService = inject(MailConfigService);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private tabService = inject(SpConfigurationTabsService);
+ private translateService = inject(TranslateService);
+
tabs: SpNavigationItem[] = [];
parentForm: UntypedFormGroup;
@@ -91,14 +97,6 @@ export class EmailConfigurationComponent implements OnInit {
sendingTestMailSuccess = false;
sendingEmailErrorMessage = '';
- constructor(
- private fb: UntypedFormBuilder,
- private mailConfigService: MailConfigService,
- private breadcrumbService: SpBreadcrumbService,
- private tabService: SpConfigurationTabsService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.tabs = this.tabService.getTabs();
this.breadcrumbService.updateBreadcrumb([
diff --git a/ui/src/app/configuration/email-configuration/email-template-configuration/email-template-configuration.component.ts b/ui/src/app/configuration/email-configuration/email-template-configuration/email-template-configuration.component.ts
index 7280a64b67..79e73e0cf4 100644
--- a/ui/src/app/configuration/email-configuration/email-template-configuration/email-template-configuration.component.ts
+++ b/ui/src/app/configuration/email-configuration/email-template-configuration/email-template-configuration.component.ts
@@ -56,6 +56,9 @@ import type { editor as MonacoEditor } from 'monaco-editor';
],
})
export class SpEmailTemplateConfigurationComponent implements OnInit {
+ private fb = inject(UntypedFormBuilder);
+ private mailConfigService = inject(MailConfigService);
+
template: EmailTemplate;
originalTemplate: string;
templateLoaded = false;
@@ -97,11 +100,6 @@ export class SpEmailTemplateConfigurationComponent implements OnInit {
},
];
- constructor(
- private fb: UntypedFormBuilder,
- private mailConfigService: MailConfigService,
- ) {}
-
ngOnInit(): void {
this.loadTemplate();
}
diff --git a/ui/src/app/configuration/export/data-export-import.component.ts b/ui/src/app/configuration/export/data-export-import.component.ts
index c78c913f5c..4b979170c0 100644
--- a/ui/src/app/configuration/export/data-export-import.component.ts
+++ b/ui/src/app/configuration/export/data-export-import.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
DialogService,
PanelType,
@@ -58,19 +58,17 @@ import { MatButton } from '@angular/material/button';
],
})
export class SpDataExportImportComponent implements OnInit {
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private assetManagementService = inject(AssetManagementService);
+ private dialogService = inject(DialogService);
+ private tabService = inject(SpConfigurationTabsService);
+ private translateService = inject(TranslateService);
+
tabs: SpNavigationItem[] = [];
assets: SpAsset[];
selectedAssets: string[] = [];
- constructor(
- private breadcrumbService: SpBreadcrumbService,
- private assetManagementService: AssetManagementService,
- private dialogService: DialogService,
- private tabService: SpConfigurationTabsService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.tabs = this.tabService.getTabs();
this.breadcrumbService.updateBreadcrumb([
diff --git a/ui/src/app/configuration/export/data-export.service.ts b/ui/src/app/configuration/export/data-export.service.ts
index 61082b7612..05501336b7 100644
--- a/ui/src/app/configuration/export/data-export.service.ts
+++ b/ui/src/app/configuration/export/data-export.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
AssetExportConfiguration,
ExportConfiguration,
@@ -33,10 +33,8 @@ import { map } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class DataExportService {
- constructor(
- private platformServicesCommons: PlatformServicesCommons,
- private http: HttpClient,
- ) {}
+ private platformServicesCommons = inject(PlatformServicesCommons);
+ private http = inject(HttpClient);
getExportPreview(assetIds: string[]): Observable<ExportConfiguration> {
return this.http
diff --git a/ui/src/app/configuration/export/export-dialog/data-export-dialog.component.ts b/ui/src/app/configuration/export/export-dialog/data-export-dialog.component.ts
index 3e8d5156f7..55282c7145 100644
--- a/ui/src/app/configuration/export/export-dialog/data-export-dialog.component.ts
+++ b/ui/src/app/configuration/export/export-dialog/data-export-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { DialogRef } from '@streampipes/shared-ui';
import { DataExportService } from '../data-export.service';
import { ExportConfiguration } from '@streampipes/platform-services';
@@ -48,17 +48,16 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpDataExportDialogComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<SpDataExportDialogComponent>>(DialogRef);
+ private dataExportService = inject(DataExportService);
+
@Input()
selectedAssets: string[];
preview: ExportConfiguration;
exportInProgress = false;
- constructor(
- private dialogRef: DialogRef<SpDataExportDialogComponent>,
- private dataExportService: DataExportService,
- ) {}
-
ngOnInit(): void {
this.dataExportService
.getExportPreview(this.selectedAssets)
diff --git a/ui/src/app/configuration/export/import-dialog/data-import-dialog.component.ts b/ui/src/app/configuration/export/import-dialog/data-import-dialog.component.ts
index 1011c4f32c..45093e3416 100644
--- a/ui/src/app/configuration/export/import-dialog/data-import-dialog.component.ts
+++ b/ui/src/app/configuration/export/import-dialog/data-import-dialog.component.ts
@@ -79,6 +79,10 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class SpDataImportDialogComponent {
+ private dialogRef =
+ inject<DialogRef<SpDataImportDialogComponent>>(DialogRef);
+ private dataExportService = inject(DataExportService);
+
private translateService = inject(TranslateService);
currentImportStep = 0;
@@ -94,11 +98,6 @@ export class SpDataImportDialogComponent {
uploadStatus = 0;
uploadError = false;
- constructor(
- private dialogRef: DialogRef<SpDataImportDialogComponent>,
- private dataExportService: DataExportService,
- ) {}
-
handleFileInput(files: any) {
this.hasInput = true;
this.uploadError = false;
diff --git a/ui/src/app/configuration/extensions-installation/endpoint-item/endpoint-item.component.ts b/ui/src/app/configuration/extensions-installation/endpoint-item/endpoint-item.component.ts
index 24920fef24..c05a9b9bf1 100644
--- a/ui/src/app/configuration/extensions-installation/endpoint-item/endpoint-item.component.ts
+++ b/ui/src/app/configuration/extensions-installation/endpoint-item/endpoint-item.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import {
@@ -65,6 +72,14 @@ import { MatIcon } from '@angular/material/icon';
],
})
export class EndpointItemComponent implements OnInit {
+ private snackBar = inject(MatSnackBar);
+ private extensionInstallationService = inject(ExtensionInstallationService);
+ private addService = inject(ExtensionsInstallationService);
+ private sanitizer = inject(DomSanitizer);
+ appConstants = inject(AppConstants);
+ private dialogService = inject(DialogService);
+ private translateService = inject(TranslateService);
+
@Input()
item: ExtensionItemDescription;
@@ -89,16 +104,6 @@ export class EndpointItemComponent implements OnInit {
@Output()
triggerInstallation: EventEmitter<any> = new EventEmitter<any>();
- constructor(
- private snackBar: MatSnackBar,
- private extensionInstallationService: ExtensionInstallationService,
- private addService: ExtensionsInstallationService,
- private sanitizer: DomSanitizer,
- public appConstants: AppConstants,
- private dialogService: DialogService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.findItemTypeTitle();
this.findItemStyle();
diff --git a/ui/src/app/configuration/extensions-installation/extensions-installation.component.ts b/ui/src/app/configuration/extensions-installation/extensions-installation.component.ts
index bfd5f1179d..1ec6d98159 100644
--- a/ui/src/app/configuration/extensions-installation/extensions-installation.component.ts
+++ b/ui/src/app/configuration/extensions-installation/extensions-installation.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
+import { ChangeDetectorRef, Component, OnInit, inject } from '@angular/core';
import {
DialogRef,
DialogService,
@@ -85,6 +85,13 @@ import { PipelineElementTypeFilter } from './filter/pipeline-element-type.pipe';
],
})
export class SpExtensionsInstallationComponent implements OnInit {
+ private addService = inject(ExtensionsInstallationService);
+ private dialogService = inject(DialogService);
+ private changeDetectorRef = inject(ChangeDetectorRef);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private tabService = inject(SpConfigurationTabsService);
+ private translateService = inject(TranslateService);
+
tabs: SpNavigationItem[] = [];
activeLink: string;
@@ -101,14 +108,7 @@ export class SpExtensionsInstallationComponent implements OnInit {
_filterTerm = '';
_selectedInstallationStatus = 'all';
- constructor(
- private addService: ExtensionsInstallationService,
- private dialogService: DialogService,
- private changeDetectorRef: ChangeDetectorRef,
- private breadcrumbService: SpBreadcrumbService,
- private tabService: SpConfigurationTabsService,
- private translateService: TranslateService,
- ) {
+ constructor() {
this.results = [];
this.loading = false;
this.endpointItems = [];
diff --git a/ui/src/app/configuration/extensions-installation/extensions-installation.service.ts b/ui/src/app/configuration/extensions-installation/extensions-installation.service.ts
index 4e0109a42f..11698b4714 100644
--- a/ui/src/app/configuration/extensions-installation/extensions-installation.service.ts
+++ b/ui/src/app/configuration/extensions-installation/extensions-installation.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {
ExtensionItemDescription,
@@ -27,10 +27,8 @@ import { map } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class ExtensionsInstallationService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
getExtensionItems(): Observable<ExtensionItemDescription[]> {
return this.http
diff --git a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/extensions-service-configuration.component.ts b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/extensions-service-configuration.component.ts
index 2f90c334d8..4fda7afd55 100644
--- a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/extensions-service-configuration.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/extensions-service-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, ViewChild } from '@angular/core';
+import { Component, ViewChild, inject } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import {
MatCell,
@@ -90,6 +90,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpExtensionsServiceConfigurationComponent {
+ private configurationService = inject(ConfigurationService);
+
displayedColumns: string[] = ['group', 'name', 'action'];
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
dataSource = new MatTableDataSource<SpServiceConfiguration>();
@@ -97,7 +99,7 @@ export class SpExtensionsServiceConfigurationComponent {
expandedElement: any;
serviceConfiguration: SpServiceConfiguration[];
- constructor(private configurationService: ConfigurationService) {
+ constructor() {
this.getConfigurationServices();
}
diff --git a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-boolean/service-configs-boolean.component.ts b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-boolean/service-configs-boolean.component.ts
index 022bce1b42..5638d6cbbe 100644
--- a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-boolean/service-configs-boolean.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-boolean/service-configs-boolean.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { ConfigurationService } from '../../../../shared/configuration.service';
import { ConfigItem } from '@streampipes/platform-services';
import {
@@ -44,6 +44,7 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class ServiceConfigsBooleanComponent {
+ configService = inject(ConfigurationService);
+
@Input() configuration: ConfigItem;
- constructor(public configService: ConfigurationService) {}
}
diff --git a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-number/service-configs-number.component.ts b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-number/service-configs-number.component.ts
index 4883422451..87b16e31ef 100644
--- a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-number/service-configs-number.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-number/service-configs-number.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { ConfigurationService } from '../../../../shared/configuration.service';
import { ConfigItem } from '@streampipes/platform-services';
import { MatFormField } from '@angular/material/form-field';
@@ -30,6 +30,7 @@ import { FormsModule } from '@angular/forms';
imports: [MatFormField, FlexDirective, MatInput, FormsModule],
})
export class ServiceConfigsNumberComponent {
+ configService = inject(ConfigurationService);
+
@Input() configuration: ConfigItem;
- constructor(public configService: ConfigurationService) {}
}
diff --git a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-password/service-configs-password.component.ts b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-password/service-configs-password.component.ts
index e567ffcd89..d793747b68 100644
--- a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-password/service-configs-password.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-password/service-configs-password.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { ConfigurationService } from '../../../../shared/configuration.service';
import { ConfigItem } from '@streampipes/platform-services';
import {
@@ -51,6 +51,8 @@ const hiddenPasswordString = '*****';
],
})
export class ServiceConfigsPasswordComponent {
+ configService = inject(ConfigurationService);
+
@Input() configuration: ConfigItem;
password: string;
@@ -58,7 +60,7 @@ export class ServiceConfigsPasswordComponent {
className: string;
private hide: boolean;
- constructor(public configService: ConfigurationService) {
+ constructor() {
this.password = hiddenPasswordString;
this.show = false;
this.className = 'hideText';
diff --git a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-text/service-configs-text.component.ts b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-text/service-configs-text.component.ts
index 06a701077b..651c9cafa1 100644
--- a/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-text/service-configs-text.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/extensions-service-configuration/service-configs/service-configs-text/service-configs-text.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { ConfigurationService } from '../../../../shared/configuration.service';
import { ConfigItem } from '@streampipes/platform-services';
import { MatFormField, MatSuffix } from '@angular/material/form-field';
@@ -41,6 +41,7 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class ServiceConfigsTextComponent {
+ configService = inject(ConfigurationService);
+
@Input() configuration: ConfigItem;
- constructor(public configService: ConfigurationService) {}
}
diff --git a/ui/src/app/configuration/extensions-service-management/extensions-service-management.component.ts b/ui/src/app/configuration/extensions-service-management/extensions-service-management.component.ts
index 56be884e2a..20a639093d 100644
--- a/ui/src/app/configuration/extensions-service-management/extensions-service-management.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/extensions-service-management.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { SpConfigurationTabsService } from '../configuration-tabs.service';
import {
SpBasicNavTabsComponent,
@@ -51,12 +51,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ExtensionsServiceManagementComponent implements OnInit {
- tabs: SpNavigationItem[] = [];
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private tabService = inject(SpConfigurationTabsService);
- constructor(
- private breadcrumbService: SpBreadcrumbService,
- private tabService: SpConfigurationTabsService,
- ) {}
+ tabs: SpNavigationItem[] = [];
ngOnInit() {
this.tabs = this.tabService.getTabs();
diff --git a/ui/src/app/configuration/extensions-service-management/registered-extensions-services/registered-extensions-services.component.ts b/ui/src/app/configuration/extensions-service-management/registered-extensions-services/registered-extensions-services.component.ts
index bd1179b48a..9492e12313 100644
--- a/ui/src/app/configuration/extensions-service-management/registered-extensions-services/registered-extensions-services.component.ts
+++ b/ui/src/app/configuration/extensions-service-management/registered-extensions-services/registered-extensions-services.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, ViewChild } from '@angular/core';
+import { Component, ViewChild, inject } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import {
MatCell,
@@ -70,15 +70,15 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class SpRegisteredExtensionsServiceComponent {
+ private configurationService = inject(ConfigurationService);
+ private dialogService = inject(DialogService);
+ private translateService = inject(TranslateService);
+
displayedColumns: string[] = ['status', 'name', 'group', 'action'];
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
dataSource = new MatTableDataSource<SpServiceRegistration>();
- constructor(
- private configurationService: ConfigurationService,
- private dialogService: DialogService,
- private translateService: TranslateService,
- ) {
+ constructor() {
this.getRegisteredServices();
}
diff --git a/ui/src/app/configuration/files/file-overview/file-overview.component.ts b/ui/src/app/configuration/files/file-overview/file-overview.component.ts
index 5a9edb947b..99bb8b7809 100644
--- a/ui/src/app/configuration/files/file-overview/file-overview.component.ts
+++ b/ui/src/app/configuration/files/file-overview/file-overview.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { FileMetadata, FilesService } from '@streampipes/platform-services';
import {
MatCell,
@@ -65,6 +65,10 @@ import { DatePipe } from '@angular/common';
],
})
export class FileOverviewComponent implements OnInit {
+ private filesService = inject(FilesService);
+ private dialog = inject(MatDialog);
+ private translateService = inject(TranslateService);
+
displayedColumns: string[] = ['filename', 'filetype', 'uploaded', 'action'];
dataSource: MatTableDataSource<FileMetadata> = new MatTableDataSource();
@@ -72,12 +76,6 @@ export class FileOverviewComponent implements OnInit {
private fileTypeColors: { [key: string]: string } = {};
- constructor(
- private filesService: FilesService,
- private dialog: MatDialog,
- private translateService: TranslateService,
- ) {}
-
ngOnInit() {
this.refreshFiles();
}
diff --git a/ui/src/app/configuration/files/files.component.ts b/ui/src/app/configuration/files/files.component.ts
index 6de5567e32..a0d455ace3 100644
--- a/ui/src/app/configuration/files/files.component.ts
+++ b/ui/src/app/configuration/files/files.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild, inject } from '@angular/core';
import {
DialogService,
PanelType,
@@ -54,17 +54,15 @@ import { FileOverviewComponent } from './file-overview/file-overview.component';
],
})
export class FilesComponent implements OnInit {
+ private dialogService = inject(DialogService);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private tabService = inject(SpConfigurationTabsService);
+ private translateService = inject(TranslateService);
+
tabs: SpNavigationItem[] = [];
@ViewChild('fileOverviewComponent') fileOverviewComponent;
- constructor(
- private dialogService: DialogService,
- private breadcrumbService: SpBreadcrumbService,
- private tabService: SpConfigurationTabsService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit() {
this.tabs = this.tabService.getTabs();
this.breadcrumbService.updateBreadcrumb([
diff --git a/ui/src/app/configuration/general-configuration/general-configuration.component.ts b/ui/src/app/configuration/general-configuration/general-configuration.component.ts
index 714c5b4c84..44e037561b 100644
--- a/ui/src/app/configuration/general-configuration/general-configuration.component.ts
+++ b/ui/src/app/configuration/general-configuration/general-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
@@ -99,6 +99,14 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class GeneralConfigurationComponent implements OnInit {
+ private fb = inject(UntypedFormBuilder);
+ private generalConfigService = inject(GeneralConfigService);
+ private mailConfigService = inject(MailConfigService);
+ private availableRolesService = inject(AvailableRolesService);
+ private appConstants = inject(AppConstants);
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private tabService = inject(SpConfigurationTabsService);
+
tabs: SpNavigationItem[] = [];
parentForm: UntypedFormGroup;
@@ -109,16 +117,6 @@ export class GeneralConfigurationComponent implements OnInit {
availableRoles$: Observable<Role[]>;
- constructor(
- private fb: UntypedFormBuilder,
- private generalConfigService: GeneralConfigService,
- private mailConfigService: MailConfigService,
- private availableRolesService: AvailableRolesService,
- private appConstants: AppConstants,
- private breadcrumbService: SpBreadcrumbService,
- private tabService: SpConfigurationTabsService,
- ) {}
-
ngOnInit(): void {
this.tabs = this.tabService.getTabs();
this.breadcrumbService.updateBreadcrumb([
diff --git a/ui/src/app/configuration/label-configuration/label-configuration.component.ts b/ui/src/app/configuration/label-configuration/label-configuration.component.ts
index 0d8fedede7..1206f7d41e 100644
--- a/ui/src/app/configuration/label-configuration/label-configuration.component.ts
+++ b/ui/src/app/configuration/label-configuration/label-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild, inject } from '@angular/core';
import { SpConfigurationTabsService } from '../configuration-tabs.service';
import { LabelsService, SpLabel } from '@streampipes/platform-services';
import { SpConfigurationRoutes } from '../configuration.breadcrumb';
@@ -76,6 +76,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpLabelConfigurationComponent implements OnInit {
+ private breadcrumbService = inject(SpBreadcrumbService);
+ private labelsService = inject(LabelsService);
+ private tabService = inject(SpConfigurationTabsService);
+
tabs: SpNavigationItem[] = [];
allLabels: SpLabel[] = [];
@@ -91,12 +95,6 @@ export class SpLabelConfigurationComponent implements OnInit {
editedLabels: string[] = [];
- constructor(
- private breadcrumbService: SpBreadcrumbService,
- private labelsService: LabelsService,
- private tabService: SpConfigurationTabsService,
- ) {}
-
ngOnInit(): void {
this.tabs = this.tabService.getTabs();
this.breadcrumbService.updateBreadcrumb([
diff --git a/ui/src/app/configuration/security-configuration/authentication-configuration/authentication-configuration.component.ts b/ui/src/app/configuration/security-configuration/authentication-configuration/authentication-configuration.component.ts
index 90e09e1794..67d7c566ab 100644
--- a/ui/src/app/configuration/security-configuration/authentication-configuration/authentication-configuration.component.ts
+++ b/ui/src/app/configuration/security-configuration/authentication-configuration/authentication-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component } from '@angular/core';
+import { Component, inject } from '@angular/core';
import { ConfigurationService } from '../../shared/configuration.service';
import * as FileSaver from 'file-saver';
import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
@@ -30,7 +30,7 @@ import { TranslatePipe } from '@ngx-translate/core';
imports: [FlexDirective, LayoutDirective, MatButton, TranslatePipe],
})
export class SecurityAuthenticationConfigurationComponent {
- constructor(private configurationService: ConfigurationService) {}
+ private configurationService = inject(ConfigurationService);
generateKeyPair() {
this.configurationService.generateKeyPair().subscribe(result => {
diff --git a/ui/src/app/configuration/security-configuration/edit-group-dialog/edit-group-dialog.component.ts b/ui/src/app/configuration/security-configuration/edit-group-dialog/edit-group-dialog.component.ts
index 63b15c7801..6704dbd0e9 100644
--- a/ui/src/app/configuration/security-configuration/edit-group-dialog/edit-group-dialog.component.ts
+++ b/ui/src/app/configuration/security-configuration/edit-group-dialog/edit-group-dialog.component.ts
@@ -16,7 +16,13 @@
*
*/
-import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
+import {
+ Component,
+ Input,
+ OnInit,
+ ViewEncapsulation,
+ inject,
+} from '@angular/core';
import { Group, Role, UserGroupService } from '@streampipes/platform-services';
import {
FormsModule,
@@ -67,6 +73,11 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class EditGroupDialogComponent implements OnInit {
+ private fb = inject(UntypedFormBuilder);
+ private availableRolesService = inject(AvailableRolesService);
+ private dialogRef = inject<DialogRef<EditGroupDialogComponent>>(DialogRef);
+ private userGroupService = inject(UserGroupService);
+
@Input()
group: Group;
@@ -77,13 +88,6 @@ export class EditGroupDialogComponent implements OnInit {
availableRoles$: Observable<Role[]>;
clonedGroup: Group;
- constructor(
- private fb: UntypedFormBuilder,
- private availableRolesService: AvailableRolesService,
- private dialogRef: DialogRef<EditGroupDialogComponent>,
- private userGroupService: UserGroupService,
- ) {}
-
ngOnInit(): void {
this.availableRoles$ = this.availableRolesService
.getAvailableRoles()
diff --git a/ui/src/app/configuration/security-configuration/edit-role-dialog/edit-role-dialog.component.ts b/ui/src/app/configuration/security-configuration/edit-role-dialog/edit-role-dialog.component.ts
index 833519985d..6a1de2a870 100644
--- a/ui/src/app/configuration/security-configuration/edit-role-dialog/edit-role-dialog.component.ts
+++ b/ui/src/app/configuration/security-configuration/edit-role-dialog/edit-role-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
Privilege,
PrivilegeService,
@@ -75,6 +75,11 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class EditRoleDialogComponent implements OnInit {
+ private fb = inject(FormBuilder);
+ private privilegeService = inject(PrivilegeService);
+ private dialogRef = inject<DialogRef<EditRoleDialogComponent>>(DialogRef);
+ private roleService = inject(RoleService);
+
@Input()
role: Role;
@@ -86,13 +91,6 @@ export class EditRoleDialogComponent implements OnInit {
selectedPrivileges: Privilege[] = [];
clonedRole: Role;
- constructor(
- private fb: FormBuilder,
- private privilegeService: PrivilegeService,
- private dialogRef: DialogRef<EditRoleDialogComponent>,
- private roleService: RoleService,
- ) {}
-
ngOnInit() {
this.privilegeService.findAll().subscribe(privileges => {
this.selectedPrivileges = privileges.filter(
diff --git a/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts b/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts
index 7fab1f3791..4eb0782587 100644
--- a/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts
+++ b/ui/src/app/configuration/security-configuration/edit-user-dialog/edit-user-dialog.component.ts
@@ -16,7 +16,13 @@
*
*/
-import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
+import {
+ Component,
+ Input,
+ OnInit,
+ ViewEncapsulation,
+ inject,
+} from '@angular/core';
import {
CurrentUserService,
DialogRef,
@@ -83,6 +89,17 @@ import { AsyncPipe } from '@angular/common';
],
})
export class EditUserDialogComponent implements OnInit {
+ private dialogRef = inject<DialogRef<EditUserDialogComponent>>(DialogRef);
+ private availableRolesService = inject(AvailableRolesService);
+ private fb = inject(UntypedFormBuilder);
+ private userService = inject(UserService);
+ private userGroupService = inject(UserGroupService);
+ private currentUserService = inject(CurrentUserService);
+ private authService = inject(AuthService);
+ private router = inject(Router);
+ private mailConfigService = inject(MailConfigService);
+ private translateService = inject(TranslateService);
+
@Input()
user: any;
@@ -105,19 +122,6 @@ export class EditUserDialogComponent implements OnInit {
emailConfigured = false;
formAvailable = false;
- constructor(
- private dialogRef: DialogRef<EditUserDialogComponent>,
- private availableRolesService: AvailableRolesService,
- private fb: UntypedFormBuilder,
- private userService: UserService,
- private userGroupService: UserGroupService,
- private currentUserService: CurrentUserService,
- private authService: AuthService,
- private router: Router,
- private mailConfigService: MailConfigService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.initRoleFilter();
this.loadInitialData();
diff --git a/ui/src/app/configuration/security-configuration/role-configuration/role-configuration.component.ts b/ui/src/app/configuration/security-configuration/role-configuration/role-configuration.component.ts
index 2369f77921..ec413f3158 100644
--- a/ui/src/app/configuration/security-configuration/role-configuration/role-configuration.component.ts
+++ b/ui/src/app/configuration/security-configuration/role-configuration/role-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild, inject } from '@angular/core';
import { Role, RoleService } from '@streampipes/platform-services';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort, MatSortHeader } from '@angular/material/sort';
@@ -71,6 +71,11 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class SecurityRoleConfigComponent implements OnInit {
+ private roleService = inject(RoleService);
+ private dialogService = inject(DialogService);
+ private dialog = inject(MatDialog);
+ private translateService = inject(TranslateService);
+
private static readonly ASSET_USER_ROLE = 'ROLE_ASSET_USER';
@ViewChild(MatPaginator) paginator: MatPaginator;
@@ -81,13 +86,6 @@ export class SecurityRoleConfigComponent implements OnInit {
displayedColumns: string[] = ['roleName', 'roleType', 'edit'];
- constructor(
- private roleService: RoleService,
- private dialogService: DialogService,
- private dialog: MatDialog,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.loadRoles();
}
diff --git a/ui/src/app/configuration/security-configuration/user-group-configuration/user-group-configuration.component.ts b/ui/src/app/configuration/security-configuration/user-group-configuration/user-group-configuration.component.ts
index 1e622f8648..fd4ee78e7d 100644
--- a/ui/src/app/configuration/security-configuration/user-group-configuration/user-group-configuration.component.ts
+++ b/ui/src/app/configuration/security-configuration/user-group-configuration/user-group-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { Group, UserGroupService } from '@streampipes/platform-services';
import {
MatCell,
@@ -68,17 +68,15 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class SecurityUserGroupConfigComponent implements OnInit {
+ private userGroupService = inject(UserGroupService);
+ private dialogService = inject(DialogService);
+ private dialog = inject(MatDialog);
+ private translateService = inject(TranslateService);
+
dataSource: MatTableDataSource<Group>;
displayedColumns: string[] = ['groupName', 'groupId', 'edit'];
- constructor(
- private userGroupService: UserGroupService,
- private dialogService: DialogService,
- private dialog: MatDialog,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.loadAllGroups();
}
diff --git a/ui/src/app/configuration/shared/configuration.service.ts b/ui/src/app/configuration/shared/configuration.service.ts
index e827ff944e..474d5d8a30 100644
--- a/ui/src/app/configuration/shared/configuration.service.ts
+++ b/ui/src/app/configuration/shared/configuration.service.ts
@@ -1,113 +1,113 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { Observable } from 'rxjs';
-import { map } from 'rxjs/operators';
-import { MultipartUtils } from './multipart-utils';
-import {
- MessagingSettings,
- SpServiceConfiguration,
- SpServiceRegistration,
-} from '@streampipes/platform-services';
-
-@Injectable({ providedIn: 'root' })
-export class ConfigurationService {
- constructor(private http: HttpClient) {}
-
- getServerUrl() {
- return '/streampipes-backend';
- }
-
- generateKeyPair(): Observable<string[]> {
- return this.http
- .get(this.getServerUrl() + '/api/v2/admin/general-config/keys', {
- responseType: 'text',
- observe: 'response',
- })
- .pipe(
- map(response => {
- return new MultipartUtils().extractMultipartPlainTextContent(
- response,
- );
- }),
- );
- }
-
- getMessagingSettings(): Observable<MessagingSettings> {
- return this.http.get(this.getServerUrl() + '/api/v2/messaging').pipe(
- map(response => {
- return response as MessagingSettings;
- }),
- );
- }
-
- getRegisteredExtensionsServices(): Observable<SpServiceRegistration[]> {
- return this.http
- .get(this.getServerUrl() + '/api/v2/extensions-services')
- .pipe(
- map(response => {
- return response as SpServiceRegistration[];
- }),
- );
- }
-
- getExtensionsServiceConfigs(): Observable<SpServiceConfiguration[]> {
- return this.http
- .get(
- this.getServerUrl() +
- '/api/v2/extensions-services-configurations',
- )
- .pipe(
- map(response => {
- return response as SpServiceConfiguration[];
- }),
- );
- }
-
- updateExtensionsServiceConfigs(
- config: SpServiceConfiguration,
- ): Observable<object> {
- return this.http.put(
- this.getServerUrl() +
- `/api/v2/extensions-services-configurations/${config.serviceGroup}`,
- config,
- );
- }
-
- updateMessagingSettings(
- messagingSettings: MessagingSettings,
- ): Observable<object> {
- return this.http.post(
- this.getServerUrl() + '/api/v2/messaging',
- messagingSettings,
- );
- }
-
- adjustConfigurationKey(key) {
- const removedKey = key.substr(key.lastIndexOf('/') + 1, key.length);
-
- let str1 = removedKey.replace(/SP/g, '');
- str1 = str1.replace(/_/g, ' ');
- if (str1.startsWith(' ')) {
- str1 = str1.slice(1, str1.length);
- }
- return str1;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { Injectable, inject } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
+import { MultipartUtils } from './multipart-utils';
+import {
+ MessagingSettings,
+ SpServiceConfiguration,
+ SpServiceRegistration,
+} from '@streampipes/platform-services';
+
+@Injectable({ providedIn: 'root' })
+export class ConfigurationService {
+ private http = inject(HttpClient);
+
+ getServerUrl() {
+ return '/streampipes-backend';
+ }
+
+ generateKeyPair(): Observable<string[]> {
+ return this.http
+ .get(this.getServerUrl() + '/api/v2/admin/general-config/keys', {
+ responseType: 'text',
+ observe: 'response',
+ })
+ .pipe(
+ map(response => {
+ return new MultipartUtils().extractMultipartPlainTextContent(
+ response,
+ );
+ }),
+ );
+ }
+
+ getMessagingSettings(): Observable<MessagingSettings> {
+ return this.http.get(this.getServerUrl() + '/api/v2/messaging').pipe(
+ map(response => {
+ return response as MessagingSettings;
+ }),
+ );
+ }
+
+ getRegisteredExtensionsServices(): Observable<SpServiceRegistration[]> {
+ return this.http
+ .get(this.getServerUrl() + '/api/v2/extensions-services')
+ .pipe(
+ map(response => {
+ return response as SpServiceRegistration[];
+ }),
+ );
+ }
+
+ getExtensionsServiceConfigs(): Observable<SpServiceConfiguration[]> {
+ return this.http
+ .get(
+ this.getServerUrl() +
+ '/api/v2/extensions-services-configurations',
+ )
+ .pipe(
+ map(response => {
+ return response as SpServiceConfiguration[];
+ }),
+ );
+ }
+
+ updateExtensionsServiceConfigs(
+ config: SpServiceConfiguration,
+ ): Observable<object> {
+ return this.http.put(
+ this.getServerUrl() +
+ `/api/v2/extensions-services-configurations/${config.serviceGroup}`,
+ config,
+ );
+ }
+
+ updateMessagingSettings(
+ messagingSettings: MessagingSettings,
+ ): Observable<object> {
+ return this.http.post(
+ this.getServerUrl() + '/api/v2/messaging',
+ messagingSettings,
+ );
+ }
+
+ adjustConfigurationKey(key) {
+ const removedKey = key.substr(key.lastIndexOf('/') + 1, key.length);
+
+ let str1 = removedKey.replace(/SP/g, '');
+ str1 = str1.replace(/_/g, ' ');
+ if (str1.startsWith(' ')) {
+ str1 = str1.slice(1, str1.length);
+ }
+ return str1;
+ }
+}
diff --git a/ui/src/app/configuration/sites-configuration/location-features-configuration/location-features-configuration.component.ts b/ui/src/app/configuration/sites-configuration/location-features-configuration/location-features-configuration.component.ts
index 64471e01c0..556544ebc0 100644
--- a/ui/src/app/configuration/sites-configuration/location-features-configuration/location-features-configuration.component.ts
+++ b/ui/src/app/configuration/sites-configuration/location-features-configuration/location-features-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnDestroy, OnInit } from '@angular/core';
+import { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
@@ -67,6 +67,11 @@ import { MatIcon } from '@angular/material/icon';
export class LocationFeaturesConfigurationComponent
implements OnInit, OnDestroy
{
+ private fb = inject(UntypedFormBuilder);
+ private snackBar = inject(MatSnackBar);
+ private locationConfigService = inject(LocationConfigService);
+ private translateService = inject(TranslateService);
+
@Input()
locationConfig: LocationConfig;
@@ -74,13 +79,6 @@ export class LocationFeaturesConfigurationComponent
formSubscription: Subscription;
showLocationDetails = false;
- constructor(
- private fb: UntypedFormBuilder,
- private snackBar: MatSnackBar,
- private locationConfigService: LocationConfigService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit(): void {
this.locationForm = this.fb.group({});
this.showLocationDetails = this.locationConfig.locationEnabled;
diff --git a/ui/src/app/configuration/sites-configuration/site-area-configuration/site-area-configuration.component.ts b/ui/src/app/configuration/sites-configuration/site-area-configuration/site-area-configuration.component.ts
index 559c25299a..0b9e86dbbc 100644
--- a/ui/src/app/configuration/sites-configuration/site-area-configuration/site-area-configuration.component.ts
+++ b/ui/src/app/configuration/sites-configuration/site-area-configuration/site-area-configuration.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit, ViewChild } from '@angular/core';
+import { Component, Input, OnInit, ViewChild, inject } from '@angular/core';
import {
AssetConstants,
AssetSiteDesc,
@@ -71,6 +71,10 @@ import { MatTooltip } from '@angular/material/tooltip';
],
})
export class SiteAreaConfigurationComponent implements OnInit {
+ private genericStorageService = inject(GenericStorageService);
+ private dialogService = inject(DialogService);
+ private translateService = inject(TranslateService);
+
@Input()
locationConfig: LocationConfig;
@@ -84,12 +88,6 @@ export class SiteAreaConfigurationComponent implements OnInit {
sort: MatSort;
displayedColumns = ['name', 'areas', 'actions'];
- constructor(
- private genericStorageService: GenericStorageService,
- private dialogService: DialogService,
- private translateService: TranslateService,
- ) {}
-
ngOnInit() {
this.loadSites();
this.dataSource.sortingDataAccessor = (site, column) => {
(streampipes) 15/24: migrate core UI utilities to inject()
Posted by ze...@apache.org.
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 d526b157145b0f0f107c8536488a7fb959b99563
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:01:00 2026 +0100
migrate core UI utilities to inject()
---
.../pipeline-element-template-config.component.ts | 10 +++++-----
.../static-alternatives/static-alternatives.component.ts | 7 +++----
.../add-to-collection/add-to-collection.component.ts | 4 ++--
.../static-color-picker/static-color-picker.component.ts | 6 ++----
.../static-file-input/static-file-input.component.ts | 10 +++-------
.../static-mapping-nary/static-mapping-nary.component.ts | 6 ++----
.../static-properties/static-property-util.service.ts | 4 ++--
.../static-runtime-resolvable-any-input.component.ts | 6 ++++--
.../static-runtime-resolvable-group.component.ts | 5 ++++-
.../runtime-resolvable.service.ts | 8 +++-----
.../static-runtime-resolvable-oneof-input.component.ts | 6 ++++--
.../static-runtime-resolvable-tree-input.component.ts | 13 ++++++++-----
.../static-tree-input-browse-nodes.component.ts | 9 +++++----
.../static-secret-input/static-secret-input.component.ts | 6 ++----
ui/src/app/core-ui/topics/topics.component.ts | 4 ++--
15 files changed, 51 insertions(+), 53 deletions(-)
diff --git a/ui/src/app/core-ui/pipeline-element-template-config/pipeline-element-template-config.component.ts b/ui/src/app/core-ui/pipeline-element-template-config/pipeline-element-template-config.component.ts
index 604e17816d..f8a2e888e1 100644
--- a/ui/src/app/core-ui/pipeline-element-template-config/pipeline-element-template-config.component.ts
+++ b/ui/src/app/core-ui/pipeline-element-template-config/pipeline-element-template-config.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
PipelineElementTemplate,
PipelineElementTemplateService,
@@ -63,6 +63,10 @@ import { PipelineElementTemplatePipe } from './pipeline-element-template.pipe';
],
})
export class PipelineElementTemplateConfigComponent implements OnInit {
+ private pipelineElementTemplateService = inject(
+ PipelineElementTemplateService,
+ );
+
@Input()
template: PipelineElementTemplate;
@@ -77,10 +81,6 @@ export class PipelineElementTemplateConfigComponent implements OnInit {
existingTemplates: PipelineElementTemplate[] = [];
- constructor(
- private pipelineElementTemplateService: PipelineElementTemplateService,
- ) {}
-
ngOnInit(): void {
this.loadTemplates();
this.template.basePipelineElementAppId = this.appId;
diff --git a/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.ts b/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.ts
index f241917146..c2544d36d8 100644
--- a/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-alternatives/static-alternatives.component.ts
@@ -22,6 +22,7 @@ import {
Input,
OnInit,
TemplateRef,
+ inject,
} from '@angular/core';
import { AbstractStaticPropertyRenderer } from '../base/abstract-static-property';
import {
@@ -63,6 +64,8 @@ export class StaticAlternativesComponent
extends AbstractStaticPropertyRenderer<StaticPropertyAlternatives>
implements OnInit
{
+ private changeDetectorRef = inject(ChangeDetectorRef);
+
@Input()
deploymentConfiguration: ExtensionDeploymentConfiguration;
@@ -76,10 +79,6 @@ export class StaticAlternativesComponent
completedAlternativeConfigurations: ConfigurationInfo[] = [];
- constructor(private changeDetectorRef: ChangeDetectorRef) {
- super();
- }
-
ngOnInit() {
this.staticProperty.alternatives.forEach(al => {
if (al.staticProperty) {
diff --git a/ui/src/app/core-ui/static-properties/static-collection/add-to-collection/add-to-collection.component.ts b/ui/src/app/core-ui/static-properties/static-collection/add-to-collection/add-to-collection.component.ts
index 36762ab9aa..f6c1437980 100644
--- a/ui/src/app/core-ui/static-properties/static-collection/add-to-collection/add-to-collection.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-collection/add-to-collection/add-to-collection.component.ts
@@ -57,6 +57,8 @@ import { MatProgressBar } from '@angular/material/progress-bar';
],
})
export class AddToCollectionComponent {
+ private staticPropertyUtil = inject(StaticPropertyUtilService);
+
translateService = inject(TranslateService);
@Input()
@@ -75,8 +77,6 @@ export class AddToCollectionComponent {
public hasError = false;
public errorMessage = this.translateService.instant('This is a test');
- constructor(private staticPropertyUtil: StaticPropertyUtilService) {}
-
add() {
const clone = this.staticPropertyUtil.clone(
this.staticPropertyTemplate,
diff --git a/ui/src/app/core-ui/static-properties/static-color-picker/static-color-picker.component.ts b/ui/src/app/core-ui/static-properties/static-color-picker/static-color-picker.component.ts
index 3b46e52881..c9f2a6f66d 100644
--- a/ui/src/app/core-ui/static-properties/static-color-picker/static-color-picker.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-color-picker/static-color-picker.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { StaticPropertyUtilService } from '../static-property-util.service';
import {
FormsModule,
@@ -47,9 +47,7 @@ export class StaticColorPickerComponent
extends AbstractValidatedStaticPropertyRenderer<ColorPickerStaticProperty>
implements OnInit
{
- constructor(public staticPropertyUtil: StaticPropertyUtilService) {
- super();
- }
+ staticPropertyUtil = inject(StaticPropertyUtilService);
presetColors: any[] = [
'#39B54A',
diff --git a/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts b/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
index 86f8754f69..d0bc38dd0b 100644
--- a/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
@@ -80,6 +80,9 @@ export class StaticFileInputComponent
extends AbstractValidatedStaticPropertyRenderer<FileStaticProperty>
implements OnInit
{
+ private filesService = inject(FilesService);
+ dialog = inject(MatDialog);
+
public chooseExistingFileControl = new UntypedFormControl();
translateService = inject(TranslateService);
@@ -100,13 +103,6 @@ export class StaticFileInputComponent
filesLoaded = false;
- constructor(
- private filesService: FilesService,
- public dialog: MatDialog,
- ) {
- super();
- }
-
ngOnInit() {
this.fetchFileMetadata(this.staticProperty.locationPath);
this.addValidator(
diff --git a/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts b/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts
index ed075ce8c5..22c797296d 100644
--- a/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-mapping-nary/static-mapping-nary.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { StaticMappingComponent } from '../static-mapping/static-mapping';
import { MappingPropertyNary } from '@streampipes/platform-services';
import { DisplayRecommendedPipe } from '../filter/display-recommended.pipe';
@@ -49,9 +49,7 @@ export class StaticMappingNaryComponent
extends StaticMappingComponent<MappingPropertyNary>
implements OnInit
{
- constructor(private displayRecommendedPipe: DisplayRecommendedPipe) {
- super();
- }
+ private displayRecommendedPipe = inject(DisplayRecommendedPipe);
ngOnInit() {
this.extractPossibleSelections();
diff --git a/ui/src/app/core-ui/static-properties/static-property-util.service.ts b/ui/src/app/core-ui/static-properties/static-property-util.service.ts
index 314d20d915..67fcd60271 100644
--- a/ui/src/app/core-ui/static-properties/static-property-util.service.ts
+++ b/ui/src/app/core-ui/static-properties/static-property-util.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import {
AnyStaticProperty,
CodeInputStaticProperty,
@@ -41,7 +41,7 @@ import { ConfigurationInfo } from '../../connect/model/ConfigurationInfo';
@Injectable({ providedIn: 'root' })
export class StaticPropertyUtilService {
- constructor(private idGeneratorService: IdGeneratorService) {}
+ private idGeneratorService = inject(IdGeneratorService);
public initializeCompletedConfigurations(
configs: StaticProperty[],
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts
index c8399181c7..8d90951e48 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-any-input/static-runtime-resolvable-any-input.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
Option,
RuntimeResolvableAnyStaticProperty,
@@ -60,7 +60,9 @@ export class StaticRuntimeResolvableAnyInputComponent
{
selectedOptions: Option[] = [];
- constructor(runtimeResolvableService: RuntimeResolvableService) {
+ constructor() {
+ const runtimeResolvableService = inject(RuntimeResolvableService);
+
super(runtimeResolvableService);
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts
index cfeae0f814..9329325022 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-group/static-runtime-resolvable-group.component.ts
@@ -24,6 +24,7 @@ import {
OnInit,
Output,
TemplateRef,
+ inject,
} from '@angular/core';
import { RuntimeResolvableService } from '../static-runtime-resolvable-input/runtime-resolvable.service';
import { BaseRuntimeResolvableInput } from '../static-runtime-resolvable-input/base-runtime-resolvable-input';
@@ -59,7 +60,9 @@ export class StaticRuntimeResolvableGroupComponent
@Input({ required: true })
renderStaticProperty!: TemplateRef<GroupRenderCtx>;
- constructor(runtimeResolvableService: RuntimeResolvableService) {
+ constructor() {
+ const runtimeResolvableService = inject(RuntimeResolvableService);
+
super(runtimeResolvableService);
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts
index b94c731f6d..a9bdfff11f 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts
@@ -24,14 +24,12 @@ import {
} from '@streampipes/platform-services';
import { map } from 'rxjs/operators';
import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class RuntimeResolvableService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
fetchRemoteOptionsForAdapter(
resolvableOptionsParameterRequest: RuntimeOptionsRequest,
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts
index a63c25fac9..223880abc9 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-oneof-input/static-runtime-resolvable-oneof-input.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnChanges, OnInit } from '@angular/core';
+import { Component, OnChanges, OnInit, inject } from '@angular/core';
import {
Option,
RuntimeResolvableOneOfStaticProperty,
@@ -56,7 +56,9 @@ export class StaticRuntimeResolvableOneOfInputComponent
extends BaseRuntimeResolvableSelectionInput<RuntimeResolvableOneOfStaticProperty>
implements OnInit, OnChanges
{
- constructor(runtimeResolvableService: RuntimeResolvableService) {
+ constructor() {
+ const runtimeResolvableService = inject(RuntimeResolvableService);
+
super(runtimeResolvableService);
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts
index ae9c6e8096..8c7694d7ce 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit, ViewChild } from '@angular/core';
+import { Component, OnInit, ViewChild, inject } from '@angular/core';
import { BaseRuntimeResolvableInput } from '../static-runtime-resolvable-input/base-runtime-resolvable-input';
import {
RuntimeResolvableTreeInputStaticProperty,
@@ -64,6 +64,10 @@ export class StaticRuntimeResolvableTreeInputComponent
extends BaseRuntimeResolvableInput<RuntimeResolvableTreeInputStaticProperty>
implements OnInit
{
+ private staticTreeInputServiceService = inject(
+ StaticTreeInputServiceService,
+ );
+
nodeDetails: TreeInputNode;
editorMode: 'tree' | 'text' = 'tree';
@@ -77,10 +81,9 @@ export class StaticRuntimeResolvableTreeInputComponent
@ViewChild('staticTreeInputBrowseNodesComponent')
private staticTreeInputBrowseNodesComponent: StaticTreeInputBrowseNodesComponent;
- constructor(
- runtimeResolvableService: RuntimeResolvableService,
- private staticTreeInputServiceService: StaticTreeInputServiceService,
- ) {
+ constructor() {
+ const runtimeResolvableService = inject(RuntimeResolvableService);
+
super(runtimeResolvableService);
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts
index 206d93df2f..90e13ebbfd 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts
@@ -22,6 +22,7 @@ import {
OnInit,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import {
RuntimeResolvableTreeInputStaticProperty,
@@ -75,6 +76,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class StaticTreeInputBrowseNodesComponent implements OnInit {
+ private staticTreeInputServiceService = inject(
+ StaticTreeInputServiceService,
+ );
+
@Input()
staticProperty: RuntimeResolvableTreeInputStaticProperty;
@@ -100,10 +105,6 @@ export class StaticTreeInputBrowseNodesComponent implements OnInit {
hasChild = (_: number, node: TreeInputNode) => !node.dataNode;
- constructor(
- private staticTreeInputServiceService: StaticTreeInputServiceService,
- ) {}
-
ngOnInit(): void {
this.dataSource = new MatTreeNestedDataSource<TreeInputNode>();
this.dataSource.data = [];
diff --git a/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts b/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts
index 68d442ba98..9b745e8dc2 100644
--- a/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-secret-input/static-secret-input.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import {
FormsModule,
ReactiveFormsModule,
@@ -48,9 +48,7 @@ export class StaticSecretInputComponent
extends AbstractValidatedStaticPropertyRenderer<SecretStaticProperty>
implements OnInit
{
- constructor(public staticPropertyUtil: StaticPropertyUtilService) {
- super();
- }
+ staticPropertyUtil = inject(StaticPropertyUtilService);
ngOnInit() {
this.addValidator(this.staticProperty.value, this.collectValidators());
diff --git a/ui/src/app/core-ui/topics/topics.component.ts b/ui/src/app/core-ui/topics/topics.component.ts
index 90f077a21b..c2bc931f90 100644
--- a/ui/src/app/core-ui/topics/topics.component.ts
+++ b/ui/src/app/core-ui/topics/topics.component.ts
@@ -79,6 +79,8 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class TopicsComponent implements OnInit {
+ private dialogRef = inject<DialogRef<TopicsComponent>>(DialogRef);
+
translateService = inject(TranslateService);
selectedTabIndex = 0;
@@ -93,8 +95,6 @@ export class TopicsComponent implements OnInit {
pipelineElement: PipelineElementUnion;
isDataStream: boolean;
- constructor(private dialogRef: DialogRef<TopicsComponent>) {}
-
ngOnInit() {
if (
this.pipelineElement instanceof SpDataStream ||
(streampipes) 02/24: migrate app services to inject()
Posted by ze...@apache.org.
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 ef67834196ce798d8842f2ddd13b4cf1db5dd0b0
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:48:53 2026 +0100
migrate app services to inject()
---
ui/src/app/services/auth.service.ts | 18 ++++++++++--------
ui/src/app/services/available-roles.service.ts | 6 ++++--
ui/src/app/services/notification-count-service.ts | 6 +++---
ui/src/app/services/rest-api.service.ts | 8 +++-----
ui/src/app/services/secure.pipe.ts | 10 ++++------
ui/src/app/services/tour/shepherd.service.ts | 12 +++++++-----
6 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/ui/src/app/services/auth.service.ts b/ui/src/app/services/auth.service.ts
index eab8325681..f086eebf7d 100644
--- a/ui/src/app/services/auth.service.ts
+++ b/ui/src/app/services/auth.service.ts
@@ -17,7 +17,7 @@
*/
import { RestApi } from './rest-api.service';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { Observable, of, timer } from 'rxjs';
import { JwtHelperService } from '@auth0/angular-jwt';
import {
@@ -38,15 +38,17 @@ import {
@Injectable({ providedIn: 'root' })
export class AuthService {
+ private restApi = inject(RestApi);
+ private tokenStorage = inject(JwtTokenStorageService);
+ private currentUserService = inject(CurrentUserService);
+ private router = inject(Router);
+ private loginService = inject(LoginService);
+
private refreshInFlight$?: Observable<boolean>;
- constructor(
- private restApi: RestApi,
- private tokenStorage: JwtTokenStorageService,
- private currentUserService: CurrentUserService,
- private router: Router,
- private loginService: LoginService,
- ) {
+ constructor() {
+ const tokenStorage = this.tokenStorage;
+
if (this.authenticated() && tokenStorage.getUser()) {
this.currentUserService.authToken$.next(tokenStorage.getToken());
this.currentUserService.user$.next(tokenStorage.getUser());
diff --git a/ui/src/app/services/available-roles.service.ts b/ui/src/app/services/available-roles.service.ts
index f7e1f99424..1dfa3d77c5 100644
--- a/ui/src/app/services/available-roles.service.ts
+++ b/ui/src/app/services/available-roles.service.ts
@@ -16,12 +16,14 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { Role, RoleService } from '@streampipes/platform-services';
import { BehaviorSubject, Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class AvailableRolesService {
+ private roleService = inject(RoleService);
+
private static readonly ASSET_USER_ROLE = 'ROLE_ASSET_USER';
private availableRolesSubject: BehaviorSubject<Role[]> =
@@ -29,7 +31,7 @@ export class AvailableRolesService {
public availableRoles$: Observable<Role[]> =
this.availableRolesSubject.asObservable();
- constructor(private roleService: RoleService) {
+ constructor() {
this.loadRoles();
}
diff --git a/ui/src/app/services/notification-count-service.ts b/ui/src/app/services/notification-count-service.ts
index 7ba1a04817..46dfb60498 100644
--- a/ui/src/app/services/notification-count-service.ts
+++ b/ui/src/app/services/notification-count-service.ts
@@ -15,18 +15,18 @@
* limitations under the License.
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { RestApi } from './rest-api.service';
import { BehaviorSubject } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class NotificationCountService {
+ private restApi = inject(RestApi);
+
public unreadNotificationCount$ = new BehaviorSubject(0);
lockNotificationId: string;
lockActive = false;
- constructor(private restApi: RestApi) {}
-
loadUnreadNotifications() {
this.restApi.getUnreadNotificationsCount().subscribe(response => {
this.unreadNotificationCount$.next(response.count);
diff --git a/ui/src/app/services/rest-api.service.ts b/ui/src/app/services/rest-api.service.ts
index 4df0f1c33f..6b23228e86 100644
--- a/ui/src/app/services/rest-api.service.ts
+++ b/ui/src/app/services/rest-api.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { PlatformServicesCommons } from '@streampipes/platform-services';
import { HttpClient, HttpContext } from '@angular/common/http';
import { Observable } from 'rxjs';
@@ -24,10 +24,8 @@ import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client';
@Injectable({ providedIn: 'root' })
export class RestApi {
- constructor(
- private platformServicesCommons: PlatformServicesCommons,
- private $http: HttpClient,
- ) {}
+ private platformServicesCommons = inject(PlatformServicesCommons);
+ private $http = inject(HttpClient);
getServerUrl() {
return this.platformServicesCommons.apiBasePath;
diff --git a/ui/src/app/services/secure.pipe.ts b/ui/src/app/services/secure.pipe.ts
index fae0b451ee..378d0cb1cb 100644
--- a/ui/src/app/services/secure.pipe.ts
+++ b/ui/src/app/services/secure.pipe.ts
@@ -16,7 +16,7 @@
*
*/
-import { Pipe, PipeTransform } from '@angular/core';
+import { Pipe, PipeTransform, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { map } from 'rxjs/operators';
@@ -25,11 +25,9 @@ import { CurrentUserService } from '@streampipes/shared-ui';
@Pipe({ name: 'secure' })
export class SecurePipe implements PipeTransform {
- constructor(
- private http: HttpClient,
- private sanitizer: DomSanitizer,
- private currentUserService: CurrentUserService,
- ) {}
+ private http = inject(HttpClient);
+ private sanitizer = inject(DomSanitizer);
+ private currentUserService = inject(CurrentUserService);
transform(url): Observable<SafeUrl> {
return this.http
diff --git a/ui/src/app/services/tour/shepherd.service.ts b/ui/src/app/services/tour/shepherd.service.ts
index bab7b97155..b52c6dd0a7 100644
--- a/ui/src/app/services/tour/shepherd.service.ts
+++ b/ui/src/app/services/tour/shepherd.service.ts
@@ -17,7 +17,7 @@
*/
import Shepherd from 'shepherd.js';
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { Router } from '@angular/router';
import { TourProviderService } from './tour-provider.service';
import Step from 'shepherd.js/src/types/step';
@@ -26,6 +26,9 @@ import StepOptions = Step.StepOptions;
@Injectable({ providedIn: 'root' })
export class ShepherdService {
+ private router = inject(Router);
+ private tourProviderService = inject(TourProviderService);
+
currentTour: Shepherd.Tour;
currentTourSettings: any;
timeWaitMillis: number;
@@ -33,10 +36,9 @@ export class ShepherdService {
public tutorialActive$ = new BehaviorSubject(false);
- constructor(
- private router: Router,
- private tourProviderService: TourProviderService,
- ) {
+ constructor() {
+ const tourProviderService = this.tourProviderService;
+
this.timeWaitMillis = tourProviderService.getTime();
}
(streampipes) 09/24: migrate notifications UI to inject()
Posted by ze...@apache.org.
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 <te...@users.noreply.github.com>
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,
(streampipes) 22/24: migrate shared UI components to inject()
Posted by ze...@apache.org.
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 2b4c21f150aaf44df8bad2caed901895bb8c7322
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 11:13:05 2026 +0100
migrate shared UI components to inject()
---
.../asset-browser-filter-type.component.ts | 6 +++---
.../asset-browser-filter.component.ts | 5 +++--
.../asset-link-configuration.component.ts | 13 +++++++++++--
.../basic-nav-tabs/basic-nav-tabs.component.ts | 6 +++---
.../components/basic-view/basic-view.component.ts | 6 +++---
.../input-schema-property.component.ts | 8 +++-----
.../pipeline-element-documentation.component.ts | 6 +++---
.../pipeline-element-runtime-info.component.ts | 11 +++++------
.../exception-details-dialog.component.ts | 9 ++++-----
.../sp-exception-message.component.ts | 4 ++--
.../lib/components/sp-label/sp-label.component.ts | 5 +++--
.../sp-table/sp-paginator/sp-paginator.service.ts | 6 ++++--
.../time-selector/time-range-selector.component.ts | 5 +++--
.../custom-time-range-selection.component.ts | 21 +++++++++++++++------
.../time-selector-menu.component.ts | 5 +++--
15 files changed, 68 insertions(+), 48 deletions(-)
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter-type/asset-browser-filter-type.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter-type/asset-browser-filter-type.component.ts
index 8e2a518828..e264958ad4 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter-type/asset-browser-filter-type.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter-type/asset-browser-filter-type.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
Isa95TypeDesc,
Isa95TypeService,
@@ -40,13 +40,13 @@ import { FormsModule } from '@angular/forms';
],
})
export class AssetBrowserFilterTypeComponent implements OnInit {
+ private typeService = inject(Isa95TypeService);
+
allAssetTypes: Isa95TypeDesc[] = [];
@Input()
activeFilters: AssetFilter;
- constructor(private typeService: Isa95TypeService) {}
-
ngOnInit() {
this.allAssetTypes = this.typeService
.getTypeDescriptions()
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter.component.ts
index 7dfabc9a53..59658c0e29 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/asset-browser/asset-browser-toolbar/asset-browser-filter/asset-browser-filter.component.ts
@@ -23,6 +23,7 @@ import {
OnDestroy,
OnInit,
Output,
+ inject,
} from '@angular/core';
import { AssetBrowserData, AssetFilter } from '../../asset-browser.model';
import { Subscription } from 'rxjs';
@@ -58,6 +59,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class AssetBrowserFilterComponent implements OnInit, OnDestroy {
+ private assetBrowserService = inject(SpAssetBrowserService);
+
@Input()
assetBrowserData: AssetBrowserData;
@@ -68,8 +71,6 @@ export class AssetBrowserFilterComponent implements OnInit, OnDestroy {
@Output()
closeMenu: EventEmitter<void> = new EventEmitter();
- constructor(private assetBrowserService: SpAssetBrowserService) {}
-
ngOnInit() {
this.filter$ = this.assetBrowserService.filter$.subscribe(
activeFilters => {
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/asset-link-configuration/asset-link-configuration.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/asset-link-configuration/asset-link-configuration.component.ts
index 502fb840f1..cde0c9e4d5 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/asset-link-configuration/asset-link-configuration.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/asset-link-configuration/asset-link-configuration.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { NestedTreeControl } from '@angular/cdk/tree';
import {
MatNestedTreeNode,
@@ -56,6 +63,8 @@ import { LayoutAlignDirective } from '@ngbracket/ngx-layout/flex';
],
})
export class AssetLinkConfigurationComponent implements OnInit {
+ private assetService = inject(AssetManagementService);
+
@Input() linkageData: LinkageData[] = [];
@Input() stepper: MatStepper;
@Input() isEdit: boolean;
@@ -79,7 +88,7 @@ export class AssetLinkConfigurationComponent implements OnInit {
deselectedAssets: SpAssetTreeNode[] = [];
originalAssets: SpAssetTreeNode[] = [];
- constructor(private assetService: AssetManagementService) {
+ constructor() {
this.treeControl = new NestedTreeControl<SpAssetTreeNode>(
node => node.assets,
);
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.ts
index d0134c4446..6f745e3310 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/basic-nav-tabs/basic-nav-tabs.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { Router } from '@angular/router';
import { SpNavigationItem } from '../../models/sp-navigation.model';
import {
@@ -52,6 +52,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpBasicNavTabsComponent {
+ private router = inject(Router);
+
@Input()
spNavigationItems: SpNavigationItem[];
@@ -67,8 +69,6 @@ export class SpBasicNavTabsComponent {
@Input()
padding = '10px';
- constructor(private router: Router) {}
-
navigateTo(spNavigationItem: SpNavigationItem) {
this.router.navigate(spNavigationItem.itemLink);
}
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.ts
index fb15c9430f..abaa5ce612 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/basic-view/basic-view.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { Router } from '@angular/router';
import {
FlexDirective,
@@ -47,6 +47,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpBasicViewComponent {
+ private router = inject(Router);
+
@Input()
padding = false;
@@ -62,8 +64,6 @@ export class SpBasicViewComponent {
@Input()
margin = '10px';
- constructor(private router: Router) {}
-
navigateBack() {
this.router.navigate(this.backLinkTarget);
}
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/input-schema-panel/input-schema-property/input-schema-property.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/input-schema-panel/input-schema-property/input-schema-property.component.ts
index 6b9ef026e3..41de4b1302 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/input-schema-panel/input-schema-property/input-schema-property.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/input-schema-panel/input-schema-property/input-schema-property.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { EventPropertyUnion } from '@streampipes/platform-services';
import { PipelineElementSchemaService } from '../../../services/pipeline-element-schema.service';
import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
@@ -27,15 +27,13 @@ import { FlexDirective, LayoutDirective } from '@ngbracket/ngx-layout/flex';
imports: [LayoutDirective, FlexDirective],
})
export class InputSchemaPropertyComponent implements OnInit {
+ private pipelineElementSchemaService = inject(PipelineElementSchemaService);
+
@Input()
property: EventPropertyUnion;
runtimeType: string;
- constructor(
- private pipelineElementSchemaService: PipelineElementSchemaService,
- ) {}
-
ngOnInit() {
this.runtimeType =
this.pipelineElementSchemaService.getFriendlyRuntimeType(
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-documentation/pipeline-element-documentation.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-documentation/pipeline-element-documentation.component.ts
index 8f044f1bf2..613d49c9cd 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-documentation/pipeline-element-documentation.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-documentation/pipeline-element-documentation.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { PipelineElementService } from '@streampipes/platform-services';
import { Lexer, Parser } from 'marked';
import { MarkdownComponent } from 'ngx-markdown';
@@ -31,6 +31,8 @@ import { TranslatePipe } from '@ngx-translate/core';
imports: [MarkdownComponent, NgClass, ClassDirective, TranslatePipe],
})
export class PipelineElementDocumentationComponent implements OnInit {
+ private pipelineElementService = inject(PipelineElementService);
+
@Input()
appId: string;
@@ -40,8 +42,6 @@ export class PipelineElementDocumentationComponent implements OnInit {
documentationMarkdown: any;
error: any;
- constructor(private pipelineElementService: PipelineElementService) {}
-
ngOnInit(): void {
this.pipelineElementService.getDocumentation(this.appId).subscribe({
next: msg => {
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts
index 8acab3c382..99ad69f956 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/pipeline-element-runtime-info/pipeline-element-runtime-info.component.ts
@@ -22,6 +22,7 @@ import {
Input,
OnDestroy,
OnInit,
+ inject,
} from '@angular/core';
import {
LivePreviewService,
@@ -41,6 +42,10 @@ import { LivePreviewErrorComponent } from './live-preview-error/live-preview-err
imports: [LivePreviewTableComponent, LivePreviewErrorComponent],
})
export class PipelineElementRuntimeInfoComponent implements OnInit, OnDestroy {
+ private restService = inject(PipelineElementRuntimeInfoService);
+ private livePreviewService = inject(LivePreviewService);
+ private pipelineELementSchemaService = inject(PipelineElementSchemaService);
+
@Input()
streamDescription: SpDataStream;
@@ -56,12 +61,6 @@ export class PipelineElementRuntimeInfoComponent implements OnInit, OnDestroy {
runtimeDataError = false;
runtimeSub: Subscription;
- constructor(
- private restService: PipelineElementRuntimeInfoService,
- private livePreviewService: LivePreviewService,
- private pipelineELementSchemaService: PipelineElementSchemaService,
- ) {}
-
ngOnInit(): void {
this.runtimeInfo = this.makeRuntimeInfo();
this.getLatestRuntimeInfo();
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/exception-details-dialog/exception-details-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/exception-details-dialog/exception-details-dialog.component.ts
index 4bea5c5714..a9ac9ea239 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/exception-details-dialog/exception-details-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/exception-details-dialog/exception-details-dialog.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { SpLogMessage } from '@streampipes/platform-services';
import { DialogRef } from '../../../dialog/base-dialog/dialog-ref';
import { SpExceptionDetailsComponent } from '../exception-details/exception-details.component';
@@ -41,6 +41,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class SpExceptionDetailsDialogComponent implements OnInit {
+ private dialogRef =
+ inject<DialogRef<SpExceptionDetailsDialogComponent>>(DialogRef);
+
@Input()
message: SpLogMessage;
@@ -53,10 +56,6 @@ export class SpExceptionDetailsDialogComponent implements OnInit {
@Input()
additionalButtonText = 'Button';
- constructor(
- private dialogRef: DialogRef<SpExceptionDetailsDialogComponent>,
- ) {}
-
close(additionalButtonClicked = false) {
this.dialogRef.close(additionalButtonClicked);
}
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.ts
index 314236f153..5d29ea4714 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.ts
@@ -38,6 +38,8 @@ import { DatePipe } from '@angular/common';
],
})
export class SpExceptionMessageComponent {
+ private dialogService = inject(DialogService);
+
translateService = inject(TranslateService);
@Input()
@@ -52,8 +54,6 @@ export class SpExceptionMessageComponent {
@Input()
messageTimestamp: number;
- constructor(private dialogService: DialogService) {}
-
openDetailsDialog() {
this.dialogService.open(SpExceptionDetailsDialogComponent, {
panelType: PanelType.STANDARD_PANEL,
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/sp-label/sp-label.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/sp-label/sp-label.component.ts
index ee7b2ffdb4..86c0c16c7e 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/sp-label/sp-label.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/sp-label/sp-label.component.ts
@@ -22,6 +22,7 @@ import {
Input,
OnChanges,
SimpleChanges,
+ inject,
} from '@angular/core';
import { SpColorizationService } from '../../services/colorization.service';
@@ -31,6 +32,8 @@ import { SpColorizationService } from '../../services/colorization.service';
styleUrls: ['./sp-label.component.scss'],
})
export class SpLabelComponent implements OnChanges {
+ private colorizationService = inject(SpColorizationService);
+
@Input()
labelText: string | number;
@@ -86,8 +89,6 @@ export class SpLabelComponent implements OnChanges {
neutral: 'var(--color-neutral)',
};
- constructor(private colorizationService: SpColorizationService) {}
-
ngOnChanges(changes: SimpleChanges) {
this.hostVariant = this.variant;
this.hostSize = this.size;
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-paginator/sp-paginator.service.ts b/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-paginator/sp-paginator.service.ts
index 6cfcb9a00c..db12a37eb4 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-paginator/sp-paginator.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-paginator/sp-paginator.service.ts
@@ -15,13 +15,15 @@
* limitations under the License.
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { MatPaginatorIntl } from '@angular/material/paginator';
import { TranslateService } from '@ngx-translate/core';
@Injectable({ providedIn: 'root' })
export class PaginatorService extends MatPaginatorIntl {
- constructor(private translateService: TranslateService) {
+ private translateService = inject(TranslateService);
+
+ constructor() {
super();
this.itemsPerPageLabel =
this.translateService.instant('Items per page');
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.ts
index b7c4f8679b..080b9e623b 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-range-selector.component.ts
@@ -27,6 +27,7 @@ import {
SimpleChanges,
ViewChild,
ViewEncapsulation,
+ inject,
} from '@angular/core';
import {
DashboardLiveSettings,
@@ -75,6 +76,8 @@ import { TranslatePipe } from '@ngx-translate/core';
export class TimeRangeSelectorComponent
implements OnInit, OnChanges, AfterViewInit
{
+ private timeSelectionService = inject(TimeSelectionService);
+
@ViewChild('menuTrigger') menu: MatMenuTrigger;
@ViewChild('timeSelectorMenu')
timeSelectorMenu: TimeRangeSelectorMenuComponent;
@@ -123,8 +126,6 @@ export class TimeRangeSelectorComponent
day: 'numeric',
};
- constructor(private timeSelectionService: TimeSelectionService) {}
-
ngOnInit() {
this.quickSelections ??=
this.timeSelectionService.defaultQuickTimeSelections;
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.ts
index 555a7554a1..d35976062e 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/custom-time-range-selection/custom-time-range-selection.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import {
TimeSelectionConstants,
TimeSettings,
@@ -59,6 +66,13 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class CustomTimeRangeSelectionComponent implements OnInit {
+ private readonly selectionModel = inject<MatRangeDateSelectionModel<Date>>(
+ MatRangeDateSelectionModel,
+ );
+ private readonly selectionStrategy = inject<
+ DefaultMatCalendarRangeStrategy<Date>
+ >(DefaultMatCalendarRangeStrategy);
+
@Input() timeSettings: TimeSettings;
@Input() labels: TimeSelectorLabel;
@@ -81,11 +95,6 @@ export class CustomTimeRangeSelectionComponent implements OnInit {
maxDateRangeError = false;
- constructor(
- private readonly selectionModel: MatRangeDateSelectionModel<Date>,
- private readonly selectionStrategy: DefaultMatCalendarRangeStrategy<Date>,
- ) {}
-
ngOnInit(): void {
this.initializeDateRange();
this.triggerDisplayUpdate();
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts
index 21c11b53b9..2dbc7b06e2 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/time-selector/time-selector-menu/time-selector-menu.component.ts
@@ -23,6 +23,7 @@ import {
OnInit,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import {
ExtendedTimeSettings,
@@ -56,6 +57,8 @@ import { MatDivider } from '@angular/material/divider';
],
})
export class TimeRangeSelectorMenuComponent implements OnInit {
+ private timeSelectionService = inject(TimeSelectionService);
+
@Input()
timeSettings: TimeSettings;
@@ -78,8 +81,6 @@ export class TimeRangeSelectorMenuComponent implements OnInit {
@ViewChild('timeRangeSelection')
timeRangeSelection: CustomTimeRangeSelectionComponent;
- constructor(private timeSelectionService: TimeSelectionService) {}
-
ngOnInit(): void {}
applyQuickSelection(quickSelection: QuickTimeSelection): void {
(streampipes) 18/24: migrate chart designer UI to inject()
Posted by ze...@apache.org.
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 53d9db944bd10971449d9a63a93ddc4cbaef47fa
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 10:02:37 2026 +0100
migrate chart designer UI to inject()
---
.../chart-appearance-settings.component.ts | 12 +++++-------
.../aggregate-configuration.component.ts | 4 ++--
.../data-settings/chart-data-settings.component.ts | 15 +++++++--------
.../field-selection-panel.component.ts | 17 +++++++++++------
.../field-selection/field-selection.component.ts | 13 ++++++++++---
...selection-panel-row-value-autocomplete.component.ts | 13 ++++++++++---
...filter-selection-panel-row-value-input.component.ts | 13 ++++++++++---
.../filter-selection-panel.component.ts | 18 +++++++++---------
.../group-selection-panel.component.ts | 10 ++++------
.../order-selection-panel.component.ts | 6 +++---
.../chart-visualisation-settings.component.ts | 9 ++++-----
11 files changed, 75 insertions(+), 55 deletions(-)
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/appearance-settings/chart-appearance-settings.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/appearance-settings/chart-appearance-settings.component.ts
index 667ebc4501..b8b2833d12 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/appearance-settings/chart-appearance-settings.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/appearance-settings/chart-appearance-settings.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnDestroy, OnInit } from '@angular/core';
+import { Component, Input, OnDestroy, OnInit, inject } from '@angular/core';
import { ChartConfigurationService } from '../../../../../chart-shared/services/chart-configuration.service';
import { DataExplorerWidgetModel } from '@streampipes/platform-services';
import { ChartTypeService } from '../../../../../chart-shared/services/chart-type.service';
@@ -51,6 +51,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ChartAppearanceSettingsComponent implements OnInit, OnDestroy {
+ private widgetTypeService = inject(ChartTypeService);
+ private widgetRegistryService = inject(ChartRegistry);
+ private widgetConfigurationService = inject(ChartConfigurationService);
+
@Input() currentlyConfiguredWidget: DataExplorerWidgetModel;
backgroundOption: 'default' | 'custom' = 'default';
@@ -72,12 +76,6 @@ export class ChartAppearanceSettingsComponent implements OnInit, OnDestroy {
widgetTypeSubscription: Subscription;
extendedAppearanceConfigComponent: any;
- constructor(
- private widgetTypeService: ChartTypeService,
- private widgetRegistryService: ChartRegistry,
- private widgetConfigurationService: ChartConfigurationService,
- ) {}
-
ngOnInit(): void {
this.findWidget(this.currentlyConfiguredWidget.widgetType);
this.widgetTypeSubscription =
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/aggregate-configuration/aggregate-configuration.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/aggregate-configuration/aggregate-configuration.component.ts
index 1da88458f6..77ee49957f 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/aggregate-configuration/aggregate-configuration.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/aggregate-configuration/aggregate-configuration.component.ts
@@ -49,6 +49,8 @@ import { FormsModule } from '@angular/forms';
],
})
export class AggregateConfigurationComponent {
+ private widgetConfigService = inject(ChartConfigurationService);
+
@Input() queryConfig: QueryConfig;
@Input() widgetId: string;
@@ -63,8 +65,6 @@ export class AggregateConfigurationComponent {
{ value: 'w', label: this.translateService.instant('Week') },
];
- constructor(private widgetConfigService: ChartConfigurationService) {}
-
triggerDataRefresh() {
if (this.widgetId) {
this.widgetConfigService.notify({
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts
index 89e108b7e8..0715e65e18 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/chart-data-settings.component.ts
@@ -23,6 +23,7 @@ import {
OnInit,
Output,
ViewChild,
+ inject,
} from '@angular/core';
import {
DataExplorerDataConfig,
@@ -110,6 +111,12 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ChartDataSettingsComponent implements OnInit {
+ private datalakeRestService = inject(DatalakeRestService);
+ private widgetConfigService = inject(ChartConfigurationService);
+ private fieldProviderService = inject(ChartFieldProviderService);
+ private widgetTypeService = inject(ChartTypeService);
+ private router = inject(Router);
+
@Input() dataConfig: DataExplorerDataConfig;
@Input() dataLakeMeasure: DataLakeMeasure;
@Input() newWidgetMode: boolean;
@@ -137,14 +144,6 @@ export class ChartDataSettingsComponent implements OnInit {
expandFieldsDataSource = true;
expandFieldsQuery = true;
- constructor(
- private datalakeRestService: DatalakeRestService,
- private widgetConfigService: ChartConfigurationService,
- private fieldProviderService: ChartFieldProviderService,
- private widgetTypeService: ChartTypeService,
- private router: Router,
- ) {}
-
ngOnInit(): void {
this.loadPipelinesAndMeasurements();
}
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection-panel/field-selection-panel.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection-panel/field-selection-panel.component.ts
index 4fcce7eb0e..574fa479c7 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection-panel/field-selection-panel.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection-panel/field-selection-panel.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import {
EventPropertyUnion,
FieldConfig,
@@ -54,6 +61,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class FieldSelectionPanelComponent implements OnInit {
+ private fieldProvider = inject(ChartFieldProviderService);
+ private widgetConfigService = inject(ChartConfigurationService);
+
MAX_INITIAL_FIELDS = 3;
@Input() sourceConfig: SourceConfig;
@@ -63,11 +73,6 @@ export class FieldSelectionPanelComponent implements OnInit {
expandFields = false;
- constructor(
- private fieldProvider: ChartFieldProviderService,
- private widgetConfigService: ChartConfigurationService,
- ) {}
-
ngOnInit() {
this.applyDefaultFields();
this.initialFieldSelectionEvent.emit();
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection/field-selection.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection/field-selection.component.ts
index 29da735763..b68cd07d85 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection/field-selection.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/field-selection/field-selection.component.ts
@@ -16,7 +16,14 @@
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import {
EventPropertyUnion,
FieldConfig,
@@ -51,14 +58,14 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class FieldSelectionComponent implements OnInit {
+ private widgetConfigService = inject(ChartConfigurationService);
+
@Input() field: FieldConfig;
@Input() sourceConfig: SourceConfig;
@Output() addFieldEmitter: EventEmitter<EventPropertyUnion> =
new EventEmitter<EventPropertyUnion>();
- constructor(private widgetConfigService: ChartConfigurationService) {}
-
ngOnInit() {
if (!this.field.aggregations) {
this.field.aggregations = [];
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input-autocomplete/filter-selection-panel-row-value-autocomplete.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input-autocomplete/filter-selection-panel-row-value-autocomplete.component.ts
index 6c57bce59c..3abbf0bad0 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input-autocomplete/filter-selection-panel-row-value-autocomplete.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input-autocomplete/filter-selection-panel-row-value-autocomplete.component.ts
@@ -15,7 +15,14 @@
* limitations under the License.
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { SelectedFilter } from '@streampipes/platform-services';
import { EscapeNumberFilterService } from '../escape-number-filter.service';
import { MatFormField } from '@angular/material/form-field';
@@ -43,6 +50,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class FilterSelectionPanelRowValueAutocompleteComponent implements OnInit {
+ private escapeNumberFilterService = inject(EscapeNumberFilterService);
+
@Input()
public filter: SelectedFilter;
@@ -54,8 +63,6 @@ export class FilterSelectionPanelRowValueAutocompleteComponent implements OnInit
public value: string;
- constructor(private escapeNumberFilterService: EscapeNumberFilterService) {}
-
ngOnInit(): void {
this.value = this.escapeNumberFilterService.removeEnclosingQuotes(
this.filter.value,
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input/filter-selection-panel-row-value-input.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input/filter-selection-panel-row-value-input.component.ts
index f4de3a53da..d87a994225 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input/filter-selection-panel-row-value-input.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel-row/panel-row-value-input/filter-selection-panel-row-value-input.component.ts
@@ -15,7 +15,14 @@
* limitations under the License.
*
*/
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import {
+ Component,
+ EventEmitter,
+ Input,
+ OnInit,
+ Output,
+ inject,
+} from '@angular/core';
import { SelectedFilter } from '@streampipes/platform-services';
import { EscapeNumberFilterService } from '../escape-number-filter.service';
import { MatFormField } from '@angular/material/form-field';
@@ -29,6 +36,8 @@ import { TranslatePipe } from '@ngx-translate/core';
imports: [MatFormField, MatInput, FormsModule, TranslatePipe],
})
export class FilterSelectionPanelRowValueInputComponent implements OnInit {
+ private escapeNumberFilterService = inject(EscapeNumberFilterService);
+
@Input()
public filter: SelectedFilter;
@@ -41,8 +50,6 @@ export class FilterSelectionPanelRowValueInputComponent implements OnInit {
public value: string;
- constructor(private escapeNumberFilterService: EscapeNumberFilterService) {}
-
ngOnInit(): void {
this.value = this.escapeNumberFilterService.removeEnclosingQuotes(
this.filter.value,
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel.component.ts
index d4d464d804..7c79ef42e2 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/filter-selection-panel/filter-selection-panel.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import {
DatalakeRestService,
FilterExpressionGroup,
@@ -60,18 +60,18 @@ import { FilterExpressionPreviewService } from './filter-expression-preview.serv
],
})
export class FilterSelectionPanelComponent implements OnInit {
+ private widgetConfigService = inject(ChartConfigurationService);
+ private fieldProviderService = inject(ChartFieldProviderService);
+ private dataLakeRestService = inject(DatalakeRestService);
+ private dialogService = inject(DialogService);
+ private filterExpressionPreviewService = inject(
+ FilterExpressionPreviewService,
+ );
+
@Input() sourceConfig: SourceConfig;
tagValues: Map<string, string[]> = new Map<string, string[]>();
- constructor(
- private widgetConfigService: ChartConfigurationService,
- private fieldProviderService: ChartFieldProviderService,
- private dataLakeRestService: DatalakeRestService,
- private dialogService: DialogService,
- private filterExpressionPreviewService: FilterExpressionPreviewService,
- ) {}
-
ngOnInit(): void {
this.sourceConfig.queryConfig.selectedFilters.forEach(filter => {
filter.chainingOperator ??= 'AND';
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
index 2ec13e3ef7..5e68ea025a 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/group-selection-panel/group-selection-panel.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { ChartFieldProviderService } from '../../../../../../chart-shared/services/chart-field-provider.service';
import { ChartConfigurationService } from '../../../../../../chart-shared/services/chart-configuration.service';
import {
@@ -44,12 +44,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class GroupSelectionPanelComponent implements OnInit {
- @Input() sourceConfig: SourceConfig;
+ private fieldProvider = inject(ChartFieldProviderService);
+ private widgetConfigService = inject(ChartConfigurationService);
- constructor(
- private fieldProvider: ChartFieldProviderService,
- private widgetConfigService: ChartConfigurationService,
- ) {}
+ @Input() sourceConfig: SourceConfig;
ngOnInit() {
const groupByFields = this.sourceConfig.queryConfig.groupBy;
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/order-selection-panel/order-selection-panel.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/order-selection-panel/order-selection-panel.component.ts
index 3feb00d07c..76871938d8 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/data-settings/order-selection-panel/order-selection-panel.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/data-settings/order-selection-panel/order-selection-panel.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, inject } from '@angular/core';
import { SourceConfig } from '@streampipes/platform-services';
import { ChartConfigurationService } from '../../../../../../chart-shared/services/chart-configuration.service';
import { SplitSectionComponent } from '@streampipes/shared-ui';
@@ -37,9 +37,9 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class OrderSelectionPanelComponent implements OnInit {
- @Input() sourceConfig: SourceConfig;
+ private widgetConfigService = inject(ChartConfigurationService);
- constructor(private widgetConfigService: ChartConfigurationService) {}
+ @Input() sourceConfig: SourceConfig;
ngOnInit(): void {
this.sourceConfig.queryConfig.order ??= 'DESC';
diff --git a/ui/src/app/chart/components/chart-view/designer-panel/visualisation-settings/chart-visualisation-settings.component.ts b/ui/src/app/chart/components/chart-view/designer-panel/visualisation-settings/chart-visualisation-settings.component.ts
index 3287537288..abf0ea29e5 100644
--- a/ui/src/app/chart/components/chart-view/designer-panel/visualisation-settings/chart-visualisation-settings.component.ts
+++ b/ui/src/app/chart/components/chart-view/designer-panel/visualisation-settings/chart-visualisation-settings.component.ts
@@ -22,6 +22,7 @@ import {
OnChanges,
OnInit,
SimpleChanges,
+ inject,
} from '@angular/core';
import { DataExplorerWidgetModel } from '@streampipes/platform-services';
import { ChartTypeService } from '../../../../../chart-shared/services/chart-type.service';
@@ -58,12 +59,10 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class ChartVisualisationSettingsComponent implements OnInit, OnChanges {
- @Input() currentlyConfiguredWidget: DataExplorerWidgetModel;
+ private widgetTypeService = inject(ChartTypeService);
+ private widgetRegistryService = inject(ChartRegistry);
- constructor(
- private widgetTypeService: ChartTypeService,
- private widgetRegistryService: ChartRegistry,
- ) {}
+ @Input() currentlyConfiguredWidget: DataExplorerWidgetModel;
availableWidgets: IWidget<any>[];
activeWidgetType: IWidget<any>;
(streampipes) 05/24: migrate login UI to inject()
Posted by ze...@apache.org.
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 60348e95f77112209a03d69f06129e2533915933
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Mar 24 09:57:08 2026 +0100
migrate login UI to inject()
---
ui/src/app/login/components/auth-box/auth-box.component.ts | 6 +++---
ui/src/app/login/components/startup/startup.component.ts | 12 +++++-------
ui/src/app/login/services/account-activation.service.ts | 8 +++-----
ui/src/app/login/services/login.service.ts | 8 +++-----
ui/src/app/login/services/restore-password.service.ts | 8 +++-----
5 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/ui/src/app/login/components/auth-box/auth-box.component.ts b/ui/src/app/login/components/auth-box/auth-box.component.ts
index 38d6771670..0972210948 100644
--- a/ui/src/app/login/components/auth-box/auth-box.component.ts
+++ b/ui/src/app/login/components/auth-box/auth-box.component.ts
@@ -16,7 +16,7 @@
*
*/
-import { Component, Input } from '@angular/core';
+import { Component, Input, inject } from '@angular/core';
import { AppConstants } from '../../../services/app.constants';
import { LinkSettings } from '@streampipes/platform-services';
import {
@@ -41,8 +41,8 @@ import { TranslatePipe } from '@ngx-translate/core';
],
})
export class AuthBoxComponent {
+ appConstants = inject(AppConstants);
+
@Input()
linkSettings: LinkSettings;
-
- constructor(public appConstants: AppConstants) {}
}
diff --git a/ui/src/app/login/components/startup/startup.component.ts b/ui/src/app/login/components/startup/startup.component.ts
index bcb5d14d3b..f167be07c4 100644
--- a/ui/src/app/login/components/startup/startup.component.ts
+++ b/ui/src/app/login/components/startup/startup.component.ts
@@ -17,7 +17,7 @@
*/
import { AuthService } from '../../../services/auth.service';
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, inject } from '@angular/core';
import { Router } from '@angular/router';
import { AppConstants } from '../../../services/app.constants';
import {
@@ -39,17 +39,15 @@ import { MatProgressBar } from '@angular/material/progress-bar';
],
})
export class StartupComponent implements OnInit {
+ private authService = inject(AuthService);
+ private router = inject(Router);
+ appConstants = inject(AppConstants);
+
progress = 0;
currentStep = 0;
maxLoadingTimeInSeconds = 100;
loadingIntervalInSeconds = 1;
- constructor(
- private authService: AuthService,
- private router: Router,
- public appConstants: AppConstants,
- ) {}
-
ngOnInit() {
this.checkStatus();
}
diff --git a/ui/src/app/login/services/account-activation.service.ts b/ui/src/app/login/services/account-activation.service.ts
index d4ae840b9e..36ab2ad40b 100644
--- a/ui/src/app/login/services/account-activation.service.ts
+++ b/ui/src/app/login/services/account-activation.service.ts
@@ -16,17 +16,15 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { PlatformServicesCommons } from '@streampipes/platform-services';
import { Observable } from 'rxjs';
@Injectable({ providedIn: 'root' })
export class AccountActivationService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
activateAccount(activationToken: string): Observable<any> {
return this.http.get(
diff --git a/ui/src/app/login/services/login.service.ts b/ui/src/app/login/services/login.service.ts
index fab0c0c03a..d5b17f1df1 100644
--- a/ui/src/app/login/services/login.service.ts
+++ b/ui/src/app/login/services/login.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient, HttpContext } from '@angular/common/http';
import { PlatformServicesCommons } from '@streampipes/platform-services';
import { Observable, shareReplay } from 'rxjs';
@@ -26,10 +26,8 @@ import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client';
@Injectable({ providedIn: 'root' })
export class LoginService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
private settings$?: Observable<LoginModel>;
diff --git a/ui/src/app/login/services/restore-password.service.ts b/ui/src/app/login/services/restore-password.service.ts
index 907c65e914..9bc47c3701 100644
--- a/ui/src/app/login/services/restore-password.service.ts
+++ b/ui/src/app/login/services/restore-password.service.ts
@@ -16,7 +16,7 @@
*
*/
-import { Injectable } from '@angular/core';
+import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { PlatformServicesCommons } from '@streampipes/platform-services';
import { Observable } from 'rxjs';
@@ -24,10 +24,8 @@ import { RegistrationModel } from '../components/register/registration.model';
@Injectable({ providedIn: 'root' })
export class RestorePasswordService {
- constructor(
- private http: HttpClient,
- private platformServicesCommons: PlatformServicesCommons,
- ) {}
+ private http = inject(HttpClient);
+ private platformServicesCommons = inject(PlatformServicesCommons);
checkRecoveryCode(recoveryCode: string): Observable<any> {
return this.http.get(