Skip to content

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

Create inherited work package view component

Oliver Günthere4b9aabf9127
diff --git a/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
index b1c2f5a90f5..20d947e6091 100644
--- a/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
@@ -106,6 +106,9 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
const isFirstLoad = !this.querySpace.initialized.hasValue();
this.refresh(isFirstLoad, isFirstLoad);
+ // Mark tableInformationLoaded when initially loading done
+ this.setupInformationLoadedListener();
+
// Load query on URL transitions
this.queryParamListener
.observe$
@@ -129,6 +132,18 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
});
}
+ protected setupInformationLoadedListener() {
+ this
+ .querySpace
+ .initialized
+ .values$()
+ .pipe(take(1))
+ .subscribe(() => {
+ this.tableInformationLoaded = true;
+ this.cdRef.detectChanges();
+ });
+ }
+
protected onQueryUpdated(query:QueryResource) {
// Update the title whenever the query changes
this.updateTitle(query);
diff --git a/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts b/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts
index ca82a8c66a8..6a80393f133 100644
--- a/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts
+++ b/frontend/src/app/modules/work_packages/routing/work-packages-routes.ts
@@ -38,8 +38,8 @@ import {WorkPackagesFullViewComponent} from "core-app/modules/work_packages/rout
import {WorkPackageSplitViewComponent} from "core-app/modules/work_packages/routing/wp-split-view/wp-split-view.component";
import {Ng2StateDeclaration} from "@uirouter/angular";
import {WorkPackagesBaseComponent} from "core-app/modules/work_packages/routing/wp-base/wp--base.component";
-import {WorkPackagePartitionedViewPageComponent} from "core-app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component";
import {WorkPackageListViewComponent} from "core-app/modules/work_packages/routing/wp-list-view/wp-list-view.component";
+import {WorkPackageViewPageComponent} from "core-app/modules/work_packages/routing/wp-view-page/wp-view-page.component";
const menuItemClass = 'work-packages-menu-item';
@@ -133,7 +133,7 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [
},
{
name: 'work-packages.partitioned',
- component: WorkPackagePartitionedViewPageComponent,
+ component: WorkPackageViewPageComponent,
url: '',
},
{
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.html b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.html
index 1928e70b259..f2c039bdcf9 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.html
+++ b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.html
@@ -1,10 +1,10 @@
<!-- (TABLE + TIMELINE) and FOOTER vertical split-->
<div class="result-overlay"
- *ngIf="showResultOverlay && showListView"></div>
+ *ngIf="wpView.showResultOverlay && showListView"></div>
<!-- TABLE + TIMELINE horizontal split -->
<wp-table *ngIf="tableInformationLoaded && showListView"
- [projectIdentifier]="projectIdentifier"
+ [projectIdentifier]="CurrentProject.identifier"
[configuration]="wpTableConfiguration"
class="work-packages-split-view--tabletimeline-content"></wp-table>
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
index 17fec484019..7660833a983 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
@@ -55,6 +55,8 @@ import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {DeviceService} from "core-app/modules/common/browser/device.service";
+import {WorkPackageViewPageComponent} from "core-app/modules/work_packages/routing/wp-view-page/wp-view-page.component";
+import {CurrentProjectService} from "core-components/projects/current-project.service";
@Component({
selector: 'wp-list-view',
@@ -67,11 +69,6 @@ import {DeviceService} from "core-app/modules/common/browser/device.service";
]
})
export class WorkPackageListViewComponent implements OnInit, OnDestroy {
- /** An overlay over the table shown for example when the filters are invalid */
- @Input() showResultOverlay:boolean;
-
- /** Current project identifier */
- @Input() projectIdentifier:string|undefined;
text = {
'jump_to_pagination': this.I18n.t('js.work_packages.jump_marks.pagination'),
@@ -79,12 +76,12 @@ export class WorkPackageListViewComponent implements OnInit, OnDestroy {
'button_settings': this.I18n.t('js.button_settings')
};
- /** Determine when query is initially loaded */
- tableInformationLoaded = false;
-
/** Switch between list and card view */
showListView:boolean = true;
+ /** Determine when query is initially loaded */
+ tableInformationLoaded = false;
+
/** */
readonly wpTableConfiguration:WorkPackageTableConfigurationObject = {
dragAndDropEnabled: true
@@ -92,13 +89,14 @@ export class WorkPackageListViewComponent implements OnInit, OnDestroy {
constructor(private I18n:I18nService,
private querySpace:IsolatedQuerySpace,
+ private wpView:WorkPackageViewPageComponent,
private deviceService:DeviceService,
+ private CurrentProject:CurrentProjectService,
private wpDisplayRepresentation:WorkPackageViewDisplayRepresentationService,
private cdRef:ChangeDetectorRef) {
}
ngOnInit() {
-
// Mark tableInformationLoaded when initially loading done
this.setupInformationLoadedListener();
@@ -110,10 +108,10 @@ export class WorkPackageListViewComponent implements OnInit, OnDestroy {
this.cdRef.detectChanges();
});
}
+
ngOnDestroy():void {
// Nothing to do
}
-
protected setupInformationLoadedListener() {
this
.querySpace
@@ -125,4 +123,5 @@ export class WorkPackageListViewComponent implements OnInit, OnDestroy {
this.cdRef.detectChanges();
});
}
+
}
diff --git a/frontend/src/app/modules/work_packages/routing/wp-view-page/wp-view-page.component.ts b/frontend/src/app/modules/work_packages/routing/wp-view-page/wp-view-page.component.ts
index fccd179fa2d..930aa2b8b56 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-view-page/wp-view-page.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-view-page/wp-view-page.component.ts
@@ -36,9 +36,12 @@ import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
import {PartitionedQuerySpacePageComponent} from "core-app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component";
@Component({
- selector: 'partitioned-view-page',
- templateUrl: './partitioned-view-page.component.html',
- styleUrls: ['./partitioned-view-page.component.sass'],
+ selector: 'wp-view-page',
+ templateUrl: '/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html',
+ styleUrls: [
+ // Absolute paths do not work for styleURLs :-(
+ '../partitioned-query-space-page/partitioned-query-space-page.component.sass'
+ ],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
/** We need to provide the wpNotification service here to get correct save notifications for WP resources */
@@ -49,7 +52,6 @@ import {PartitionedQuerySpacePageComponent} from "core-app/modules/work_packages
export class WorkPackageViewPageComponent extends PartitionedQuerySpacePageComponent implements OnInit {
@InjectField() bcfDetectorService:BcfDetectorService;
-
transitionListenerState = 'work-packages.partitioned.list';
ngOnInit() {