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
Create base partioned-query-space component
Oliver Günther673d0543f821
diff --git a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts b/frontend/src/app/modules/work_packages/openproject-work-packages.module.tsindex 4c9477160b9..161bdf5c6d4 100644--- a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts+++ b/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts@@ -163,8 +163,9 @@ import {HalResource} from "core-app/modules/hal/resources/hal-resource";import {WorkPackageChangeset} from "core-components/wp-edit/work-package-changeset";import {WorkPackageSingleCardComponent} from "core-components/wp-card-view/wp-single-card/wp-single-card.component";import { TimeEntryChangeset } from 'core-app/components/time-entries/time-entry-changeset';-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 {PartitionedQuerySpacePageComponent} from "core-app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component";+import {WorkPackageViewPageComponent} from "core-app/modules/work_packages/routing/wp-view-page/wp-view-page.component";@NgModule({@@ -227,7 +228,8 @@ import {WorkPackageListViewComponent} from "core-app/modules/work_packages/routideclarations: [// RoutingWorkPackagesBaseComponent,- WorkPackagePartitionedViewPageComponent,+ PartitionedQuerySpacePageComponent,+ WorkPackageViewPageComponent,// WP list sideWorkPackageListViewComponent,@@ -405,8 +407,6 @@ import {WorkPackageListViewComponent} from "core-app/modules/work_packages/routi// View representationsWorkPackagesBaseComponent,- WorkPackagePartitionedViewPageComponent,-WorkPackagesGridComponent,// WP newdiff --git a/frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.html b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.htmlsimilarity index 91%rename from frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.htmlrename to frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.htmlindex 0ef537dfd67..6ee2fde431c 100644--- a/frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.html+++ b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html@@ -61,13 +61,6 @@<filter-container (filtersCompleted)="updateResultVisibility($event)"></filter-container>- <accessible-by-keyboard- linkClass="hidden-for-sighted skip-navigation-link"- [linkAriaLabel]="text.text_jump_to_pagination"- (execute)="setAnchorToNextElement()">- <span [textContent]="text.jump_to_pagination"></span>- </accessible-by-keyboard>-<!-- Left content view --><div class="work-packages-partitioned-page--content-left loading-indicator--location"data-indicator-name="table"diff --git a/frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.sass b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sasssimilarity index 100%rename from frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.sassrename to frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sassdiff --git a/frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.ts b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.tssimilarity index 74%rename from frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.tsrename to frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.tsindex 7de4726c00a..b1c2f5a90f5 100644--- a/frontend/src/app/modules/work_packages/routing/wp-partitioned-view-page/wp-partitioned-view-page.component.ts+++ b/frontend/src/app/modules/work_packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts@@ -26,7 +26,7 @@// See docs/COPYRIGHT.rdoc for more details.// ++-import {ChangeDetectionStrategy, Component, HostBinding, OnDestroy} from "@angular/core";+import {ChangeDetectionStrategy, Component, HostBinding, OnDestroy, OnInit} from "@angular/core";import {untilComponentDestroyed} from 'ng2-rx-componentdestroyed';import {QueryResource} from 'core-app/modules/hal/resources/query-resource';import {OpTitleService} from "core-components/html/op-title.service";@@ -43,9 +43,9 @@ import {QueryParamListenerService} from "core-components/wp-query/query-param-liimport {InjectField} from "core-app/helpers/angular/inject-field.decorator";@Component({- selector: 'wp-partitioned-view-page',- templateUrl: './wp-partitioned-view-page.component.html',- styleUrls: ['./wp-partitioned-view-page.component.sass'],+ selector: 'partitioned-query-space-page',+ templateUrl: './partitioned-query-space-page.component.html',+ styleUrls: ['./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 */@@ -53,17 +53,18 @@ import {InjectField} from "core-app/helpers/angular/inject-field.decorator";QueryParamListenerService]})-export class WorkPackagePartitionedViewPageComponent extends WorkPackagesViewBase implements OnDestroy {+export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase implements OnInit, OnDestroy {@InjectField() titleService:OpTitleService;- @InjectField() bcfDetectorService:BcfDetectorService;@InjectField() queryParamListener:QueryParamListenerService;- text = {+ text:{[key:string]:string} = {'jump_to_pagination': this.I18n.t('js.work_packages.jump_marks.pagination'),'text_jump_to_pagination': this.I18n.t('js.work_packages.jump_marks.label_pagination'),- 'button_settings': this.I18n.t('js.button_settings')};+ /** Transition state to listen for query changes */+ transitionListenerState:string;+/** Whether the title can be edited */titleEditingEnabled:boolean;@@ -87,13 +88,6 @@ export class WorkPackagePartitionedViewPageComponent extends WorkPackagesViewBas/** An overlay over the table shown for example when the filters are invalid */showResultOverlay = false;- /** Switch between list and card view */- private _showListView:boolean = true;-- public readonly wpTableConfiguration:WorkPackageTableConfigurationObject = {- dragAndDropEnabled: true- };-// ToDo: Return correct valuepublic currentPartition():string {return '-split';@@ -121,11 +115,8 @@ export class WorkPackagePartitionedViewPageComponent extends WorkPackagesViewBasthis.refresh(true, true);});- // Mark tableInformationLoaded when initially loading done- this.setupInformationLoadedListener();-// Update title on entering this state- this.unRegisterTitleListener = this.$transitions.onSuccess({to: 'work-packages.partitioned.list'}, () => {+ this.unRegisterTitleListener = this.$transitions.onSuccess({to: this.transitionListenerState}, () => {if (this.selectedTitle) {this.titleService.setFirstPart(this.selectedTitle);}@@ -134,21 +125,18 @@ export class WorkPackagePartitionedViewPageComponent extends WorkPackagesViewBasthis.querySpace.query.values$().pipe(untilComponentDestroyed(this)).subscribe((query) => {- // Update the title whenever the query changes- this.updateTitle(query);- this.currentQuery = query;-- // Update the visible representation- if (this.deviceService.isMobile || this.wpDisplayRepresentation.valueFromQuery(query) === wpDisplayCardRepresentation) {- this.showListView = false;- } else {- this.showListView = true;- }-- this.cdRef.detectChanges();+ this.onQueryUpdated(query);});}+ protected onQueryUpdated(query:QueryResource) {+ // Update the title whenever the query changes+ this.updateTitle(query);+ this.currentQuery = query;++ this.cdRef.detectChanges();+ }+ngOnDestroy():void {super.ngOnDestroy();this.unRegisterTitleListener();@@ -156,22 +144,6 @@ export class WorkPackagePartitionedViewPageComponent extends WorkPackagesViewBasthis.queryParamListener.removeQueryChangeListener();}- public setAnchorToNextElement() {- // Skip to next when visible, otherwise skip to previous- const selectors = '#pagination--next-link, #pagination--prev-link, #pagination-empty-text';- const visibleLink = jQuery(selectors)- .not(':hidden')- .first();-- if (visibleLink.length) {- visibleLink.focus();- }- }-- public allowed(model:string, permission:string) {- return this.authorisationService.can(model, permission);- }-public saveQueryFromTitle(val:string) {if (this.currentQuery && this.currentQuery.persisted) {this.updateQueryName(val);@@ -218,43 +190,19 @@ export class WorkPackagePartitionedViewPageComponent extends WorkPackagesViewBasif (visibly) {this.loadingIndicator = promise.then(() => {- if (this.wpTableTimeline.isVisible) {- return this.querySpace.timelineRendered.pipe(take(1)).toPromise();- } else {- return this.querySpace.tableRendered.valuesPromise() as Promise<unknown>;- }+ return this.additionalLoadingTime();});}return promise;}- public updateResultVisibility(completed:boolean) {- this.showResultOverlay = !completed;+ protected additionalLoadingTime():Promise<unknown> {+ return Promise.resolve();}- public set showListView(val:boolean) {- this._showListView = val;- }-- public get showListView():boolean {- return this._showListView;- }-- public bcfActivated() {- return this.bcfDetectorService.isBcfActivated;- }-- protected setupInformationLoadedListener() {- this- .querySpace- .initialized- .values$()- .pipe(take(1))- .subscribe(() => {- this.tableInformationLoaded = true;- this.cdRef.detectChanges();- });+ public updateResultVisibility(completed:boolean) {+ this.showResultOverlay = !completed;}protected set loadingIndicator(promise:Promise<unknown>) {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.tsnew file mode 100644index 00000000000..fccd179fa2d--- /dev/null+++ b/frontend/src/app/modules/work_packages/routing/wp-view-page/wp-view-page.component.ts@@ -0,0 +1,74 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2020 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See docs/COPYRIGHT.rdoc for more details.+// ++++import {ChangeDetectionStrategy, Component, OnInit} from "@angular/core";+import {take} from "rxjs/operators";+import {BcfDetectorService} from "core-app/modules/bcf/helper/bcf-detector.service";+import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";+import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";+import {QueryParamListenerService} from "core-components/wp-query/query-param-listener.service";+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'],+ changeDetection: ChangeDetectionStrategy.OnPush,+ providers: [+ /** We need to provide the wpNotification service here to get correct save notifications for WP resources */+ {provide: HalResourceNotificationService, useClass: WorkPackageNotificationService},+ QueryParamListenerService+ ]+})+export class WorkPackageViewPageComponent extends PartitionedQuerySpacePageComponent implements OnInit {+ @InjectField() bcfDetectorService:BcfDetectorService;+++ transitionListenerState = 'work-packages.partitioned.list';++ ngOnInit() {+ super.ngOnInit();+ this.text.button_settings = this.I18n.t('js.button_settings');+ }++ public allowed(model:string, permission:string) {+ return this.authorisationService.can(model, permission);+ }++ public bcfActivated() {+ return this.bcfDetectorService.isBcfActivated;+ }+ protected additionalLoadingTime():Promise<unknown> {+ if (this.wpTableTimeline.isVisible) {+ return this.querySpace.timelineRendered.pipe(take(1)).toPromise();+ } else {+ return this.querySpace.tableRendered.valuesPromise() as Promise<unknown>;+ }+ }+}