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 <[email protected]> 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) =>
