OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Pass projectIdentifier into component, preventing timing issue on initialization
Oliver Günther8698525d6a79
diff --git a/frontend/src/app/features/overview/overview.component.ts b/frontend/src/app/features/overview/overview.component.tsindex 05917e40d04..5c9547e0d5c 100644--- a/frontend/src/app/features/overview/overview.component.ts+++ b/frontend/src/app/features/overview/overview.component.ts@@ -26,20 +26,29 @@// See COPYRIGHT and LICENSE files for more details.//++-import { ChangeDetectionStrategy, Component } from '@angular/core';+import { ChangeDetectionStrategy, Component, ElementRef, inject, Input, OnInit } from '@angular/core';import { GridPageComponent } from 'core-app/shared/components/grids/grid/page/grid-page.component';import { GRID_PROVIDERS } from 'core-app/shared/components/grids/grid/grid.component';+import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';@Component({- selector: 'overview',changeDetection: ChangeDetectionStrategy.OnPush,templateUrl: '../../shared/components/grids/grid/page/grid-page.component.html',styleUrls: ['../../shared/components/grids/grid/page/grid-page.component.sass'],providers: GRID_PROVIDERS,standalone: false,})-export class OverviewComponent extends GridPageComponent {+export class OverviewComponent extends GridPageComponent implements OnInit {+ @Input() projectIdentifier:string;++ readonly elementRef = inject(ElementRef);++ ngOnInit() {+ populateInputsFromDataset(this);+ super.ngOnInit();+ }+protected gridScopePath():string {- return this.pathHelper.projectPath(this.currentProject.identifier ?? '');+ return this.pathHelper.projectPath(this.projectIdentifier);}}diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.tsindex e9314ca4812..78232c5798f 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts@@ -1,4 +1,4 @@-import { ChangeDetectorRef, Directive, OnDestroy, OnInit, Renderer2 } from '@angular/core';+import { ChangeDetectorRef, Directive, inject, OnDestroy, OnInit, Renderer2 } from '@angular/core';import { GridInitializationService } from 'core-app/shared/components/grids/grid/initialization.service';import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';import { GridResource } from 'core-app/features/hal/resources/grid-resource';@@ -9,17 +9,14 @@ import { ConfigurationService } from 'core-app/core/config/configuration.service@Directive()export abstract class GridPageComponent implements OnInit, OnDestroy {- constructor(- readonly gridInitialization:GridInitializationService,- // not used in the base class but will be used throughout the subclasses- readonly pathHelper:PathHelperService,- readonly currentProject:CurrentProjectService,- readonly cdRef:ChangeDetectorRef,- readonly addWidget:GridAddWidgetService,- readonly renderer:Renderer2,- readonly areas:GridAreaService,- readonly configurationService:ConfigurationService,- ) {}+ readonly gridInitialization = inject(GridInitializationService);+ readonly pathHelper = inject(PathHelperService);+ readonly currentProject = inject(CurrentProjectService);+ readonly cdRef = inject(ChangeDetectorRef);+ readonly addWidget = inject(GridAddWidgetService);+ readonly renderer = inject(Renderer2);+ readonly areas = inject(GridAreaService);+ readonly configurationService = inject(ConfigurationService);public grid:GridResource;diff --git a/modules/overviews/app/components/overviews/show_component.html.erb b/modules/overviews/app/components/overviews/show_component.html.erbindex fc4c5840c3b..41dd7d14e73 100644--- a/modules/overviews/app/components/overviews/show_component.html.erb+++ b/modules/overviews/app/components/overviews/show_component.html.erb@@ -73,6 +73,6 @@ See COPYRIGHT and LICENSE files for more details.)end- concat(angular_component_tag("opce-overview"))+ concat(angular_component_tag("opce-overview", inputs: { projectIdentifier: @project.identifier }))end%>