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

[#39772] rebuild bcf module routes

Eric Schubert4cefa8f92e58
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index 3404c427103..2b04057084e 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -71,10 +71,10 @@ export class PathHelperService {
}
public bimDetailsPath(projectIdentifier:string, workPackageId:string, viewpoint:number|string|null = null) {
- let path = `${this.projectPath(projectIdentifier)}/bcf/split/details/${workPackageId}`;
+ let path = `${this.projectPath(projectIdentifier)}/bcf/details/${workPackageId}`;
if (viewpoint !== null) {
- path += `?query_props=%7B"t"%3A"id%3Adesc"%7D&viewpoint=${viewpoint}`;
+ path += `?query_props=%7B"t"%3A"id%3Adesc"%2C"dr"%3A"splitCards"%7D&viewpoint=${viewpoint}`;
}
return path;
diff --git a/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts b/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts
index 7d1974d11e8..8bf75d3e58b 100644
--- a/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts
+++ b/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts
@@ -10,20 +10,11 @@ export abstract class ViewerBridgeService {
@InjectField() state:StateService;
/**
- * Determine whether a viewer should be shown,
- * wether 'bim.partitioned.split' state/route should be activated
+ * Determine whether a viewer should be shown
*/
abstract shouldShowViewer:boolean;
- /**
- * Check if we are on a router state where there is a place
- * where the viewer could be shown
- */
- get routeWithViewer():boolean {
- return this.state.includes('bim.partitioned.split');
- }
-
- constructor(readonly injector:Injector) {}
+ protected constructor(readonly injector:Injector) {}
/**
* Get a viewpoint from the viewer
@@ -32,7 +23,6 @@ export abstract class ViewerBridgeService {
/**
* Show the given viewpoint JSON in the viewer
- * @param viewpoint
*/
abstract showViewpoint(workPackage:WorkPackageResource, index:number):void;
diff --git a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
index 380cff069d3..c2e56f704c6 100644
--- a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
+++ b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
@@ -1,3 +1,31 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2021 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 COPYRIGHT and LICENSE files for more details.
+//++
+
import {
AfterViewInit,
ChangeDetectionStrategy,
@@ -6,6 +34,7 @@ import {
Input,
OnDestroy,
OnInit,
+ Optional,
ViewChild,
} from '@angular/core';
import { StateService } from '@uirouter/core';
@@ -22,6 +51,8 @@ import { BcfAuthorizationService } from 'core-app/features/bim/bcf/api/bcf-autho
import { ViewpointsService } from 'core-app/features/bim/bcf/helper/viewpoints.service';
import { BcfViewpointItem } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface';
import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
+import { BcfViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
+import { filter, take } from 'rxjs/operators';
@Component({
templateUrl: './bcf-wp-attribute-group.component.html',
@@ -120,6 +151,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
readonly apiV3Service:APIV3Service,
readonly wpCreate:WorkPackageCreateService,
readonly toastService:ToastService,
+ @Optional() readonly bcfViewer:BcfViewService,
readonly cdRef:ChangeDetectorRef,
readonly I18n:I18nService,
readonly viewpointsService:ViewpointsService) {
@@ -131,7 +163,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
this.observeChanges();
}
- ngOnInit() {
+ ngOnInit():void {
this.viewerBridge.viewerVisible$.subscribe((visible:boolean) => {
if (visible) {
this.viewerVisible = true;
@@ -171,24 +203,47 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
this.cdRef.detectChanges();
}
- refreshViewpoints(viewpoints:HalLink[]) {
+ refreshViewpoints(viewpoints:HalLink[]):void {
this.viewpoints = viewpoints.map((el:HalLink) => ({ href: el.href, snapshotURL: `${el.href}/snapshot` }));
this.setViewpointsOnGallery(this.viewpoints);
}
- protected showViewpoint(workPackage:WorkPackageResource, index:number) {
- this.viewerBridge.showViewpoint(workPackage, index);
+ protected showViewpoint(workPackage:WorkPackageResource, index:number):void {
+ if (this.bcfViewer) {
+ // FIXME: This component shouldn't know about the state of the BCF module. bcfViewer is null, when outside of
+ // BCF module. Inside BCF module, we try to avoid hard transition, with sending an update to the bcf view
+ // state before showing a viewpoint.
+ switch (this.bcfViewer.currentViewerState()) {
+ case 'table':
+ this.bcfViewer.update('splitTable');
+ break;
+ case 'cards':
+ this.bcfViewer.update('splitCards');
+ break;
+ default:
+ }
+
+ // wait until viewer is visible after view state update before showing viewpoint
+ this.viewerBridge.viewerVisible$
+ .pipe(
+ filter((visible) => visible),
+ take(1),
+ )
+ .subscribe(() => this.viewerBridge.showViewpoint(workPackage, index));
+ } else {
+ this.viewerBridge.showViewpoint(workPackage, index);
+ }
}
- protected deleteViewpoint(workPackage:WorkPackageResource, index:number) {
+ protected deleteViewpoint(workPackage:WorkPackageResource, index:number):void {
if (!window.confirm(this.text.text_are_you_sure)) {
return;
}
this.viewpointsService
.deleteViewPoint$(workPackage, index)
- .subscribe((data) => {
+ .subscribe(() => {
this.toastService.addSuccess(this.text.notice_successful_delete);
this.gallery.preview.close();
});
@@ -197,7 +252,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
public saveViewpoint(workPackage:WorkPackageResource) {
this.viewpointsService
.saveViewpoint$(workPackage)
- .subscribe((viewpoint) => {
+ .subscribe(() => {
this.toastService.addSuccess(this.text.notice_successful_create);
this.showIndex = this.viewpoints.length;
});
@@ -209,7 +264,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
this.showViewpoint(workPackage, index);
this.showIndex = index;
this.selectViewpointInGallery();
- this.state.go('.', { ...this.state.params, viewpoint: undefined }, { reload: false });
+ void this.state.go('.', { ...this.state.params, viewpoint: undefined }, { reload: false });
}
}
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.html b/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.html
deleted file mode 100644
index 394ef5c4ec5..00000000000
--- a/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<div class="op-bcf-list-container--result-overlay"
- *ngIf="(showResultOverlay$ | async) && showTableView"></div>
-
-<!-- TABLE + TIMELINE horizontal split -->
-<div class="op-bcf-list-container--work-packages-split-view--tabletimeline-container"
- [ngClass]="{ '_with-resizer': showResizerInCardView() }"
- *ngIf="tableInformationLoaded && showTableView">
-<wp-resizer elementClass="work-packages-partitioned-page--content-right"
- localStorageKey="openProject-splitViewFlexBasis">
-</wp-resizer>
-
-<wp-table [projectIdentifier]="CurrentProject.identifier"
- [configuration]="wpTableConfiguration"
- (itemClicked)="handleWorkPackageClicked($event)"
- (stateLinkClicked)="openStateLink($event)"
- class="work-packages-split-view--tabletimeline-content">
-</wp-table>
-</div>
-
-<!-- GRID representation of the WP -->
-<div *ngIf="!showTableView"
- class="op-bcf-list-container--work-packages--card-view-container"
- [ngClass]="{ '_with-resizer': showResizerInCardView() }" >
-<wp-grid [configuration]="wpTableConfiguration"
- [showResizer]="showResizerInCardView()"
- (itemClicked)="handleWorkPackageCardClicked($event)"
- (stateLinkClicked)="openStateLink($event)"
- resizerClass="work-packages-partitioned-page--content-right"
- resizerStorageKey="openProject-splitViewFlexBasis">
-</wp-grid>
-</div>
-
-<!-- Footer -->
-<div class="work-packages-split-view--tabletimeline-footer hide-when-print"
- *ngIf="tableInformationLoaded">
-<wp-table-pagination></wp-table-pagination>
-</div>
\ No newline at end of file
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.html b/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.html
new file mode 100644
index 00000000000..31daa0e8a7f
--- /dev/null
+++ b/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.html
@@ -0,0 +1,38 @@
+<div class="op-bcf-list--result-overlay"
+ *ngIf="(showResultOverlay$ | async) && showTableView"></div>
+
+<!-- TABLE representation of the WP -->
+<div class="op-bcf-list--work-packages-split-view--tabletimeline-container"
+ [ngClass]="{ '_with-resizer': showResizerInCardView() }"
+ *ngIf="tableInformationLoaded && showTableView">
+ <wp-resizer *ngIf="showResizer"
+ elementClass="work-packages-partitioned-page--content-right"
+ localStorageKey="openProject-splitViewFlexBasis">
+ </wp-resizer>
+
+ <wp-table [projectIdentifier]="CurrentProject.identifier"
+ [configuration]="wpTableConfiguration"
+ (itemClicked)="handleWorkPackageClicked($event)"
+ (stateLinkClicked)="openStateLink($event)"
+ class="work-packages-split-view--tabletimeline-content">
+ </wp-table>
+</div>
+
+<!-- GRID representation of the WP -->
+<div *ngIf="!showTableView"
+ class="op-bcf-list--work-packages--card-view-container"
+ [ngClass]="{ '_with-resizer': showResizerInCardView() }">
+ <wp-grid [configuration]="wpTableConfiguration"
+ [showResizer]="showResizerInCardView()"
+ (itemClicked)="handleWorkPackageCardClicked($event)"
+ (stateLinkClicked)="openStateLink($event)"
+ resizerClass="work-packages-partitioned-page--content-right"
+ resizerStorageKey="openProject-splitViewFlexBasis">
+ </wp-grid>
+</div>
+
+<!-- Footer -->
+<div class="work-packages-split-view--tabletimeline-footer hide-when-print"
+ *ngIf="tableInformationLoaded">
+ <wp-table-pagination></wp-table-pagination>
+</div>
\ No newline at end of file
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.sass b/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.sass
similarity index 94%
rename from frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.sass
rename to frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.sass
index cfe0b13010b..6fe87f9e130 100644
--- a/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.sass
+++ b/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.sass
@@ -1,6 +1,6 @@
@import "src/assets/sass/helpers"
-.op-bcf-list-container
+.op-bcf-list
&--result-overlay
@include overlay-background
background-color: #FFFFFF
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts b/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.ts
similarity index 59%
rename from frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts
rename to frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.ts
index f28c949bdc9..51a406a4585 100644
--- a/frontend/src/app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component.ts
+++ b/frontend/src/app/features/bim/ifc_models/bcf/list/bcf-list.component.ts
@@ -1,39 +1,66 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2021 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 COPYRIGHT and LICENSE files for more details.
+//++
+
import {
- ChangeDetectionStrategy, Component, NgZone, OnInit,
+ ChangeDetectionStrategy, Component, Input, NgZone, OnInit,
} from '@angular/core';
import { WorkPackageListViewComponent } from 'core-app/features/work-packages/routing/wp-list-view/wp-list-view.component';
import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
import { WorkPackageNotificationService } from 'core-app/features/work-packages/services/notifications/work-package-notification.service';
import { DragAndDropService } from 'core-app/shared/helpers/drag-and-drop/drag-and-drop.service';
import { CausedUpdatesService } from 'core-app/features/boards/board/caused-updates/caused-updates.service';
-import {
- bimSplitViewCardsIdentifier,
- bimSplitViewListIdentifier,
- BimViewService,
-} from 'core-app/features/bim/ifc_models/pages/viewer/bim-view.service';
+import { BcfViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
import { IfcModelsDataService } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-models-data.service';
import { WorkPackageViewColumnsService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-columns.service';
import { UIRouterGlobals } from '@uirouter/core';
-import { distinctUntilChanged, pluck } from 'rxjs/operators';
import { States } from 'core-app/core/states/states.service';
import { BcfApiService } from 'core-app/features/bim/bcf/api/bcf-api.service';
import { splitViewRoute } from 'core-app/features/work-packages/routing/split-view-routes.helper';
import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { QueryResource } from 'core-app/features/hal/resources/query-resource';
@Component({
- templateUrl: './bcf-list-container.component.html',
- styleUrls: ['./bcf-list-container.component.sass'],
+ templateUrl: './bcf-list.component.html',
+ styleUrls: ['./bcf-list.component.sass'],
providers: [
{ provide: HalResourceNotificationService, useClass: WorkPackageNotificationService },
DragAndDropService,
CausedUpdatesService,
],
changeDetection: ChangeDetectionStrategy.OnPush,
+ selector: 'op-bcf-list',
})
-export class BcfListContainerComponent extends WorkPackageListViewComponent implements OnInit {
- @InjectField() bimView:BimViewService;
+export class BcfListComponent extends WorkPackageListViewComponent implements UntilDestroyedMixin, OnInit {
+ @Input() showResizer = false;
+
+ @InjectField() bcfView:BcfViewService;
@InjectField() ifcModelsService:IfcModelsDataService;
@@ -55,54 +82,33 @@ export class BcfListContainerComponent extends WorkPackageListViewComponent impl
public showViewPointInFlight:boolean;
- ngOnInit() {
+ ngOnInit():void {
super.ngOnInit();
-
- // Ensure we add a bcf thumbnail column
- // until we can load the initial query
- this.wpTableColumns
- .onReady()
- .then(() => this.wpTableColumns.addColumn('bcfThumbnail', 2));
-
- this.uIRouterGlobals
- .params$!
- .pipe(
- this.untilDestroyed(),
- pluck('cards'),
- distinctUntilChanged(),
- )
- .subscribe((cards:boolean) => {
- if (cards == null || cards || this.deviceService.isMobile) {
- this.showTableView = false;
- } else {
- this.showTableView = true;
- }
-
- this.cdRef.detectChanges();
- });
}
- protected updateViewRepresentation(query:QueryResource) {
- // Overwrite the parent method because we are setting the view
- // above through the cards parameter (showTableView)
+ protected updateViewRepresentation(query:QueryResource):void {
+ const viewerState = this.bcfView.valueFromQuery(query);
+ this.showTableView = !this.deviceService.isMobile
+ && (viewerState === 'table' || viewerState === 'splitTable');
}
public showResizerInCardView():boolean {
if (this.noResults && this.ifcModelsService.models.length === 0) {
return false;
}
- return this.bimView.currentViewerState() === bimSplitViewCardsIdentifier
- || this.bimView.currentViewerState() === bimSplitViewListIdentifier;
+
+ return this.bcfView.currentViewerState() === 'splitCards'
+ || this.bcfView.currentViewerState() === 'splitTable';
}
- handleWorkPackageClicked(event:{ workPackageId:string; double:boolean }) {
+ handleWorkPackageClicked(event:{ workPackageId:string; double:boolean }):void {
const { workPackageId, double } = event;
if (!this.showViewPointInFlight) {
this.showViewPointInFlight = true;
this.zone.runOutsideAngular(() => {
- setTimeout(() => this.showViewPointInFlight = false, 500);
+ setTimeout(() => { this.showViewPointInFlight = false; }, 500);
});
const wp = this.states.workPackages.get(workPackageId).value;
@@ -117,11 +123,11 @@ export class BcfListContainerComponent extends WorkPackageListViewComponent impl
}
}
- openStateLink(event:{ workPackageId:string; requestedState:string }) {
+ openStateLink(event:{ workPackageId:string; requestedState:string }):void {
this.goToWpDetailState(event.workPackageId, this.uIRouterGlobals.params.cards, true);
}
- goToWpDetailState(workPackageId:string, cards:boolean, focus?:boolean) {
+ goToWpDetailState(workPackageId:string, cards:boolean, focus?:boolean):void {
// Show the split view when there is a viewer (browser)
// Show only wp details when there is no viewer, plugin environment (ie: Revit)
const stateToGo = this.viewer.shouldShowViewer
@@ -131,6 +137,6 @@ export class BcfListContainerComponent extends WorkPackageListViewComponent impl
// it when going to 'bim.partitioned.show'
const params = { workPackageId, cards, focus };
- this.$state.go(stateToGo, params);
+ void this.$state.go(stateToGo, params);
}
}
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component.html b/frontend/src/app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component.html
deleted file mode 100644
index 5c089af78ca..00000000000
--- a/frontend/src/app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<div
- class="work-packages--details work-packages--new"
- *ngIf="newWorkPackage"
->
- <edit-form [resource]="newWorkPackage"
- [skippedFields]="['status', 'type']"
- [inEditMode]="true"
- (onSaved)="onSaved($event)">
- <div class="work-packages--details-content -create-mode">
- <div class="work-packages--new-details-header">
- <wp-type-status [workPackage]="newWorkPackage"></wp-type-status>
- </div>
- <wp-single-view [workPackage]="newWorkPackage"
- [showProject]="copying">
- </wp-single-view>
- </div>
-
- <div class="work-packages--details-toolbar-container">
- <wp-edit-actions-bar
- (onCancel)="cancelAndBackToList()">
- </wp-edit-actions-bar>
- </div>
- </edit-form>
-</div>
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.html b/frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.html
new file mode 100644
index 00000000000..711ad18b51a
--- /dev/null
+++ b/frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.html
@@ -0,0 +1,7 @@
+<op-ifc-viewer
+ *ngIf="showViewer$ | async"
+></op-ifc-viewer>
+
+<op-bcf-list
+ *ngIf="(showViewer$ | async) === false"
+></op-bcf-list>
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component.ts b/frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.ts
similarity index 61%
rename from frontend/src/app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component.ts
rename to frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.ts
index 40fca7aac31..d32fed1c105 100644
--- a/frontend/src/app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component.ts
+++ b/frontend/src/app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component.ts
@@ -26,23 +26,29 @@
// See COPYRIGHT and LICENSE files for more details.
//++
-import { WorkPackageCreateComponent } from 'core-app/features/work-packages/components/wp-new/wp-create.component';
-import { Component } from '@angular/core';
-import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
-import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
-import { IFCViewerService } from 'core-app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service';
+import {
+ ChangeDetectionStrategy,
+ Component,
+ OnInit,
+} from '@angular/core';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
+import { BcfViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
@Component({
- selector: 'bcf-new-split',
- templateUrl: './bcf-new-split.component.html',
+ templateUrl: './bcf-split-left.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ selector: 'op-bcf-content-left',
})
-export class BCFNewSplitComponent extends WorkPackageCreateComponent {
- public cancelState = '^';
+export class BcfSplitLeftComponent implements OnInit {
+ showViewer$:Observable<boolean>;
- @InjectField()
- readonly viewer:IFCViewerService;
+ constructor(private readonly bcfView:BcfViewService) {}
- public onSaved(params:{ savedResource:WorkPackageResource, isInitial:boolean }) {
- super.onSaved(params);
+ ngOnInit():void {
+ this.showViewer$ = this.bcfView.live$()
+ .pipe(
+ map((state) => state !== 'cards' && state !== 'table'),
+ );
}
}
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.html b/frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.html
new file mode 100644
index 00000000000..feb95468c73
--- /dev/null
+++ b/frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.html
@@ -0,0 +1,4 @@
+<op-bcf-list
+ [showResizer]="true"
+ *ngIf="showWorkPackages$ | async"
+></op-bcf-list>
diff --git a/frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.ts b/frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.ts
new file mode 100644
index 00000000000..46341840611
--- /dev/null
+++ b/frontend/src/app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component.ts
@@ -0,0 +1,54 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2021 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 COPYRIGHT and LICENSE files for more details.
+//++
+
+import {
+ ChangeDetectionStrategy,
+ Component,
+ OnInit,
+} from '@angular/core';
+import { Observable } from 'rxjs';
+import { BcfViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
+import { map } from 'rxjs/operators';
+
+@Component({
+ templateUrl: './bcf-split-right.component.html',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ selector: 'op-bcf-content-right',
+})
+export class BcfSplitRightComponent implements OnInit {
+ showWorkPackages$:Observable<boolean>;
+
+ constructor(private readonly bcfView:BcfViewService) {}
+
+ ngOnInit():void {
+ this.showWorkPackages$ = this.bcfView.live$()
+ .pipe(
+ map((state) => state === 'splitTable' || state === 'splitCards'),
+ );
+ }
+}
diff --git a/frontend/src/app/features/bim/ifc_models/empty/empty-component.ts b/frontend/src/app/features/bim/ifc_models/empty/empty-component.ts
deleted file mode 100644
index b687c04660d..00000000000
--- a/frontend/src/app/features/bim/ifc_models/empty/empty-component.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { Component } from '@angular/core';
-
-@Component({
- template: '<div></div>',
-})
-export class EmptyComponent {
-}
diff --git a/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts b/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
index f66e07a2b98..d899ecadf57 100644
--- a/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
+++ b/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
@@ -37,11 +37,11 @@ import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decora
import { ViewpointsService } from 'core-app/features/bim/bcf/helper/viewpoints.service';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
import { HttpClient } from '@angular/common/http';
-import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { IfcProjectDefinition } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-models-data.service';
import { BIMViewer } from '@xeokit/xeokit-bim-viewer/dist/xeokit-bim-viewer.es';
import { BcfViewpointData, CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
+import idFromLink from 'core-app/features/hal/helpers/id-from-link';
export interface XeokitElements {
canvasElement:HTMLElement;
@@ -88,7 +88,7 @@ type Controller = {
/**
* Wrapping type from xeokit module. Can be removed after we get a real type package.
*/
-type BimViewer = Controller&{
+type XeokitBimViewer = Controller&{
loadProject:(projectId:string) => void,
saveBCFViewpoint:(options:BCFCreationOptions) => CreateBcfViewpointData,
loadBCFViewpoint:(bcfViewpoint:BcfViewpointData, options:BCFLoadOptions) => void,
@@ -104,7 +104,7 @@ export class IFCViewerService extends ViewerBridgeService {
public inspectorVisible$ = new BehaviorSubject<boolean>(false);
- private bimViewer:BimViewer|undefined;
+ private xeokitViewer:XeokitBimViewer|undefined;
@InjectField() pathHelper:PathHelperService;
@@ -123,7 +123,7 @@ export class IFCViewerService extends ViewerBridgeService {
public newViewer(elements:XeokitElements, projects:IfcProjectDefinition[]):void {
const server = new XeokitServer(this.pathHelper);
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
- const viewerUI = new BIMViewer(server, elements) as BimViewer;
+ const viewerUI = new BIMViewer(server, elements) as XeokitBimViewer;
viewerUI.on('modelLoaded', () => this.viewerVisible$.next(true));
@@ -172,7 +172,7 @@ export class IFCViewerService extends ViewerBridgeService {
}
public destroy():void {
- this.viewerVisible$.complete();
+ this.viewerVisible$.next(false);
if (!this.viewer) {
return;
@@ -182,12 +182,12 @@ export class IFCViewerService extends ViewerBridgeService {
this.viewer = undefined;
}
- public get viewer():BimViewer|undefined {
- return this.bimViewer;
+ public get viewer():XeokitBimViewer|undefined {
+ return this.xeokitViewer;
}
- public set viewer(viewer:BimViewer|undefined) {
- this.bimViewer = viewer;
+ public set viewer(viewer:XeokitBimViewer|undefined) {
+ this.xeokitViewer = viewer;
}
public setKeyboardEnabled(val:boolean):void {
@@ -209,26 +209,20 @@ export class IFCViewerService extends ViewerBridgeService {
}
public showViewpoint(workPackage:WorkPackageResource, index:number):void {
- // Avoid reload the app when there is a place to show the viewer
- // ('bim.partitioned.split')
- if (this.routeWithViewer) {
- if (this.viewer) {
- const opts:BCFLoadOptions = { updateCompositeObjects: true, reverseClippingPlanes: true };
- this.viewpointsService
- .getViewPoint$(workPackage, index)
- .subscribe((viewpoint) => this.viewer?.loadBCFViewpoint(viewpoint, opts));
- }
+ if (this.viewerVisible()) {
+ const opts:BCFLoadOptions = { updateCompositeObjects: true, reverseClippingPlanes: true };
+ this.viewpointsService
+ .getViewPoint$(workPackage, index)
+ .subscribe((viewpoint) => {
+ this.viewer?.loadBCFViewpoint(viewpoint, opts);
+ });
} else {
- if (!workPackage.id) {
- return;
- }
-
- // Reload the whole app to get the correct menus and GON data
- // and redirect to a route with a place to show viewer
- // ('bim.partitioned.split')
+ // FIXME: When triggering showViewpoint from anywhere outside BCF module, there is no viewer shown and we have
+ // no means of setting it from here. Hence we must make a hard transition to bcf details route of the
+ // current work package.
window.location.href = this.pathHelper.bimDetailsPath(
idFromLink((workPackage.project as HalResource).href),
- workPackage.id,
+ workPackage.id || '',
index,
);
}
diff --git a/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.module.ts b/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.module.ts
index 730e0fba14a..f7613ad3aa3 100644
--- a/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.module.ts
+++ b/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.module.ts
@@ -31,19 +31,18 @@ import { UIRouterModule } from '@uirouter/angular';
import { OPSharedModule } from 'core-app/shared/shared.module';
import { IFC_ROUTES } from 'core-app/features/bim/ifc_models/openproject-ifc-models.routes';
import { IFCViewerPageComponent } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component';
-import { EmptyComponent } from 'core-app/features/bim/ifc_models/empty/empty-component';
-import { BimViewToggleButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-button.component';
-import { BimViewToggleDropdownDirective } from 'core-app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive';
+import { BcfViewToggleButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-button.component';
+import { BcfViewToggleDropdownDirective } from 'core-app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-dropdown.directive';
import { BimManageIfcModelsButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/manage-ifc-models-button/bim-manage-ifc-models-button.component';
import { IFCViewerService } from 'core-app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service';
import { OpenprojectFieldsModule } from 'core-app/shared/components/fields/openproject-fields.module';
-import { BCFNewSplitComponent } from 'core-app/features/bim/ifc_models/bcf/new-split/bcf-new-split.component';
-import { BcfListContainerComponent } from 'core-app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component';
-import { BimViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bim-view.service';
+import { BcfListComponent } from 'core-app/features/bim/ifc_models/bcf/list/bcf-list.component';
import { IfcModelsDataService } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-models-data.service';
import { OpenprojectBcfModule } from 'core-app/features/bim/bcf/openproject-bcf.module';
import { OpenprojectHalModule } from 'core-app/features/hal/openproject-hal.module';
import { IFCViewerComponent } from './ifc-viewer/ifc-viewer.component';
+import { BcfSplitLeftComponent } from 'core-app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component';
+import { BcfSplitRightComponent } from 'core-app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component';
@NgModule({
imports: [
@@ -58,7 +57,6 @@ import { IFCViewerComponent } from './ifc-viewer/ifc-viewer.component';
],
providers: [
IFCViewerService,
- BimViewService,
IfcModelsDataService,
],
declarations: [
@@ -66,15 +64,15 @@ import { IFCViewerComponent } from './ifc-viewer/ifc-viewer.component';
IFCViewerPageComponent,
// Regions of pages
- EmptyComponent,
- BcfListContainerComponent,
+ BcfSplitLeftComponent,
+ BcfSplitRightComponent,
+ BcfListComponent,
// Toolbar
BimManageIfcModelsButtonComponent,
- BimViewToggleButtonComponent,
- BimViewToggleDropdownDirective,
+ BcfViewToggleButtonComponent,
+ BcfViewToggleDropdownDirective,
- BCFNewSplitComponent,
IFCViewerComponent,
],
})
diff --git a/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.routes.ts b/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.routes.ts
index eb105fcd565..3a2575b95be 100644
--- a/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.routes.ts
+++ b/frontend/src/app/features/bim/ifc_models/openproject-ifc-models.routes.ts
@@ -25,16 +25,15 @@
//
// See COPYRIGHT and LICENSE files for more details.
//++
+
import { Ng2StateDeclaration } from '@uirouter/angular';
import { IFCViewerPageComponent } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component';
-import { IFCViewerComponent } from 'core-app/features/bim/ifc_models/ifc-viewer/ifc-viewer.component';
-import { WorkPackagesBaseComponent } from 'core-app/features/work-packages/routing/wp-base/wp--base.component';
-import { EmptyComponent } from 'core-app/features/bim/ifc_models/empty/empty-component';
import { makeSplitViewRoutes } from 'core-app/features/work-packages/routing/split-view-routes.template';
-import { BcfListContainerComponent } from 'core-app/features/bim/ifc_models/bcf/list-container/bcf-list-container.component';
import { WorkPackageSplitViewComponent } from 'core-app/features/work-packages/routing/wp-split-view/wp-split-view.component';
-import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';
import { WorkPackageNewFullViewComponent } from 'core-app/features/work-packages/components/wp-new/wp-new-full-view.component';
+import { WorkPackagesBaseComponent } from 'core-app/features/work-packages/routing/wp-base/wp--base.component';
+import { BcfSplitLeftComponent } from 'core-app/features/bim/ifc_models/bcf/split/left/bcf-split-left.component';
+import { BcfSplitRightComponent } from 'core-app/features/bim/ifc_models/bcf/split/right/bcf-split-right.component';
export const IFC_ROUTES:Ng2StateDeclaration[] = [
{
@@ -43,7 +42,7 @@ export const IFC_ROUTES:Ng2StateDeclaration[] = [
url: '/bcf?query_id&query_props&models&viewpoint',
abstract: true,
component: WorkPackagesBaseComponent,
- redirectTo: 'bim.partitioned',
+ redirectTo: 'bim.partitioned.list',
params: {
// Use custom encoder/decoder that ensures validity of URL string
query_id: { type: 'query', dynamic: true },
@@ -54,63 +53,22 @@ export const IFC_ROUTES:Ng2StateDeclaration[] = [
},
{
name: 'bim.partitioned',
+ redirectTo: 'bim.partitioned.list',
url: '',
component: IFCViewerPageComponent,
- redirectTo: (transition) => {
- const viewerBridgeService = transition.injector().get(ViewerBridgeService);
-
- return viewerBridgeService.shouldShowViewer
- ? 'bim.partitioned.split'
- : 'bim.partitioned.list';
- },
},
{
name: 'bim.partitioned.list',
- url: '/list?{cards:bool}',
- params: {
- cards: true,
- },
+ url: '',
data: {
baseRoute: 'bim.partitioned.list',
newRoute: 'bim.partitioned.list.new',
- partition: '-left-only',
- },
- reloadOnSearch: false,
- views: {
- 'content-left': { component: BcfListContainerComponent },
- },
- },
- {
- name: 'bim.partitioned.split',
- url: '/split?{cards:bool}',
- params: {
- cards: true,
- },
- data: {
- baseRoute: 'bim.partitioned.split',
partition: '-split',
- newRoute: 'bim.partitioned.split.new',
- bodyClasses: 'router--work-packages-partitioned-split-view',
- },
- reloadOnSearch: false,
- views: {
- 'content-left': { component: IFCViewerComponent },
- 'content-right': { component: BcfListContainerComponent },
- },
- },
- {
- name: 'bim.partitioned.model',
- url: '/model',
- data: {
- partition: '-left-only',
- newRoute: 'bim.partitioned.model.new',
},
reloadOnSearch: false,
views: {
- // Retarget and by that override the grandparent views
- // https://ui-router.github.io/guide/views#relative-parent-state{
- 'content-right': { component: EmptyComponent },
- 'content-left': { component: IFCViewerComponent },
+ 'content-left': { component: BcfSplitLeftComponent },
+ 'content-right': { component: BcfSplitRightComponent },
},
},
{
@@ -121,7 +79,7 @@ export const IFC_ROUTES:Ng2StateDeclaration[] = [
baseRoute: 'bim.partitioned.list',
allowMovingInEditMode: true,
partition: '-left-only',
- successState: 'bim.partitioned.show'
+ successState: 'bim.partitioned.show',
},
views: { 'content-left': { component: WorkPackageNewFullViewComponent } },
},
@@ -150,16 +108,4 @@ export const IFC_ROUTES:Ng2StateDeclaration[] = [
undefined,
WorkPackageSplitViewComponent,
),
- // BCF single view for split
- ...makeSplitViewRoutes(
- 'bim.partitioned.split',
- undefined,
- WorkPackageSplitViewComponent,
- ),
- // BCF single view for model-only
- ...makeSplitViewRoutes(
- 'bim.partitioned.model',
- undefined,
- WorkPackageSplitViewComponent,
- ),
];
diff --git a/frontend/src/app/features/bim/ifc_models/pages/viewer/bcf-view.service.ts b/frontend/src/app/features/bim/ifc_models/pages/viewer/bcf-view.service.ts
new file mode 100644
index 00000000000..7e38116303a
--- /dev/null
+++ b/frontend/src/app/features/bim/ifc_models/pages/viewer/bcf-view.service.ts
@@ -0,0 +1,98 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2021 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 COPYRIGHT and LICENSE files for more details.
+//++
+
+import { Injectable } from '@angular/core';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { WorkPackageQueryStateService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-base.service';
+import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
+import { QueryResource } from 'core-app/features/hal/resources/query-resource';
+import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';
+
+export const bcfCardsViewIdentifier = 'cards';
+export const bcfViewerViewIdentifier = 'viewer';
+export const bcfSplitViewTableIdentifier = 'splitTable';
+export const bcfSplitViewCardsIdentifier = 'splitCards';
+export const bcfTableViewIdentifier = 'table';
+
+export type BcfViewState = 'cards'|'viewer'|'splitTable'|'splitCards'|'table';
+
+@Injectable()
+export class BcfViewService extends WorkPackageQueryStateService<BcfViewState> {
+ public text:{ [key:string]:string } = {
+ cards: this.I18n.t('js.views.card'),
+ viewer: this.I18n.t('js.ifc_models.views.viewer'),
+ splitTable: this.I18n.t('js.ifc_models.views.split'),
+ splitCards: this.I18n.t('js.ifc_models.views.split_cards'),
+ table: this.I18n.t('js.views.list'),
+ };
+
+ public icon:{ [key:string]:string } = {
+ cards: 'icon-view-card',
+ viewer: 'icon-view-model',
+ splitTable: 'icon-view-split-viewer-table',
+ splitCards: 'icon-view-split2',
+ table: 'icon-view-list',
+ };
+
+ constructor(
+ private readonly I18n:I18nService,
+ private readonly viewerBridgeService:ViewerBridgeService,
+ protected readonly querySpace:IsolatedQuerySpace,
+ ) {
+ super(querySpace);
+ }
+
+ hasChanged(query:QueryResource):boolean {
+ return this.current !== query.displayRepresentation;
+ }
+
+ applyToQuery(query:QueryResource):boolean {
+ // eslint-disable-next-line no-param-reassign
+ query.displayRepresentation = this.current;
+ return true;
+ }
+
+ public valueFromQuery(query:QueryResource):BcfViewState|undefined {
+ const dr = query.displayRepresentation;
+
+ switch (dr) {
+ case 'splitCards':
+ case 'splitTable':
+ case 'cards':
+ case 'table':
+ case 'viewer':
+ return dr;
+ default:
+ return this.viewerBridgeService.shouldShowViewer ? 'splitCards' : 'cards';
+ }
+ }
+
+ public currentViewerState():BcfViewState|undefined {
+ return this.current;
+ }
+}
diff --git a/frontend/src/app/features/bim/ifc_models/pages/viewer/bim-view.service.ts b/frontend/src/app/features/bim/ifc_models/pages/viewer/bim-view.service.ts
deleted file mode 100644
index 9dbe39ae7c1..00000000000
--- a/frontend/src/app/features/bim/ifc_models/pages/viewer/bim-view.service.ts
+++ /dev/null
@@ -1,112 +0,0 @@
-// -- copyright
-// OpenProject is an open source project management software.
-// Copyright (C) 2012-2021 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 COPYRIGHT and LICENSE files for more details.
-//++
-
-import { Injectable, OnDestroy } from '@angular/core';
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { Observable } from 'rxjs';
-import { StateService, TransitionService } from '@uirouter/core';
-import { input } from 'reactivestates';
-import { takeUntil } from 'rxjs/operators';
-
-export const bimListViewIdentifier = 'list';
-export const bimTableViewIdentifier = 'table';
-export const bimSplitViewCardsIdentifier = 'splitCards';
-export const bimSplitViewListIdentifier = 'splitList';
-export const bimViewerViewIdentifier = 'viewer';
-
-export type BimViewState = 'list'|'viewer'|'splitList'|'splitCards'|'table';
-
-@Injectable()
-export class BimViewService implements OnDestroy {
- private _state = input<BimViewState>();
-
- public text:any = {
- list: this.I18n.t('js.views.card'),
- viewer: this.I18n.t('js.ifc_models.views.viewer'),
- splitList: this.I18n.t('js.ifc_models.views.split'),
- splitCards: this.I18n.t('js.ifc_models.views.split_cards'),
- table: this.I18n.t('js.views.list'),
- };
-
- public icon:any = {
- list: 'icon-view-card',
- viewer: 'icon-view-model',
- splitList: 'icon-view-split-viewer-table',
- splitCards: 'icon-view-split2',
- table: 'icon-view-list',
- };
-
- private transitionFn:Function;
-
- constructor(readonly I18n:I18nService,
- readonly transitions:TransitionService,
- readonly state:StateService) {
- this.detectView();
-
- this.transitionFn = this.transitions.onSuccess({}, (transition) => {
- this.detectView();
- });
- }
-
- get view$():Observable<BimViewState> {
- return this._state.values$();
- }
-
- public observeUntil(unsubscribe:Observable<any>) {
- return this.view$.pipe(takeUntil(unsubscribe));
- }
-
- get current():BimViewState {
- return this._state.getValueOr(bimSplitViewCardsIdentifier);
- }
-
- public currentViewerState():BimViewState {
- if (this.state.includes('bim.partitioned.list')) {
- return this.state.params?.cards
- ? bimListViewIdentifier
- : bimTableViewIdentifier;
- } if (this.state.includes('bim.**.model')) {
- return bimViewerViewIdentifier;
- } if (this.state.includes('bim.partitioned.show')) {
- return this.state.params?.cards || this.state.params?.cards == null
- ? bimListViewIdentifier
- : bimTableViewIdentifier;
- }
- return this.state.params?.cards || this.state.params?.cards == null
- ? bimSplitViewCardsIdentifier
- : bimSplitViewListIdentifier;
- }
-
- private detectView() {
- this._state.putValue(this.currentViewerState());
- }
-
- ngOnDestroy() {
- this.transitionFn();
- }
-}
diff --git a/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component.ts b/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component.ts
index 0646d451b38..63034ad8872 100644
--- a/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component.ts
+++ b/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component.ts
@@ -1,7 +1,38 @@
+// -- copyright
+// OpenProject is an open source project management software.
+// Copyright (C) 2012-2021 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 COPYRIGHT and LICENSE files for more details.
+//++
+
import {
- ChangeDetectionStrategy, Component, Injector, ViewEncapsulation,
+ ChangeDetectionStrategy,
+ Component,
+ Injector,
+ OnInit,
+ ViewEncapsulation,
} from '@angular/core';
-import { GonService } from 'core-app/core/gon/gon.service';
import {
PartitionedQuerySpacePageComponent,
ToolbarButtonComponentDefinition,
@@ -9,23 +40,22 @@ import {
import { WorkPackageFilterButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-filter-button/wp-filter-button.component';
import { ZenModeButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/zen-mode-toggle-button/zen-mode-toggle-button.component';
import {
- bimListViewIdentifier,
- bimViewerViewIdentifier,
- BimViewService,
-} from 'core-app/features/bim/ifc_models/pages/viewer/bim-view.service';
-import { BimViewToggleButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-button.component';
+ bcfSplitViewCardsIdentifier,
+ bcfViewerViewIdentifier,
+ BcfViewService,
+} from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
+import { BcfViewToggleButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-button.component';
import { IfcModelsDataService } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-models-data.service';
import { QueryParamListenerService } from 'core-app/features/work-packages/components/wp-query/query-param-listener.service';
-import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { BimManageIfcModelsButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/manage-ifc-models-button/bim-manage-ifc-models-button.component';
import { WorkPackageCreateButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-create-button/wp-create-button.component';
-import { StateService, TransitionService } from '@uirouter/core';
-import { BehaviorSubject } from 'rxjs';
+import { of } from 'rxjs';
import { BcfImportButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/import-export-bcf/bcf-import-button.component';
import { BcfExportButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/import-export-bcf/bcf-export-button.component';
import { RefreshButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/import-export-bcf/refresh-button.component';
-import { componentDestroyed } from '@w11k/ngx-componentdestroyed';
import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';
+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
+import { QueryResource } from 'core-app/features/hal/resources/query-resource';
@Component({
templateUrl: '../../../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html',
@@ -36,10 +66,11 @@ import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
+ BcfViewService,
QueryParamListenerService,
],
})
-export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent {
+export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent implements UntilDestroyedMixin, OnInit {
text = {
title: this.I18n.t('js.bcf.management'),
delete: this.I18n.t('js.button_delete'),
@@ -47,15 +78,15 @@ export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent {
areYouSure: this.I18n.t('js.text_are_you_sure'),
};
- newRoute$ = new BehaviorSubject<string | undefined>(undefined);
-
- transitionUnsubscribeFn:Function;
+ private readonly newRoute = this.viewerBridgeService.shouldShowViewer
+ ? 'bim.partitioned.list.new'
+ : 'bim.partitioned.new';
toolbarButtonComponents:ToolbarButtonComponentDefinition[] = [
{
component: WorkPackageCreateButtonComponent,
inputs: {
- stateName$: this.newRoute$,
+ stateName$: of(this.newRoute),
allowed: ['work_packages.createWorkPackage', 'work_package.copy'],
},
},
@@ -65,20 +96,20 @@ export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent {
},
{
component: BcfImportButtonComponent,
- show: () => this.ifcData.allowed('manage_bcf'),
+ show: ():boolean => this.ifcData.allowed('manage_bcf'),
containerClasses: 'hidden-for-mobile',
},
{
component: BcfExportButtonComponent,
- show: () => this.ifcData.allowed('manage_bcf'),
+ show: ():boolean => this.ifcData.allowed('manage_bcf'),
containerClasses: 'hidden-for-mobile',
},
{
component: WorkPackageFilterButtonComponent,
- show: () => this.bimView.currentViewerState() !== bimViewerViewIdentifier,
+ show: ():boolean => this.bcfView.currentViewerState() !== 'viewer',
},
{
- component: BimViewToggleButtonComponent,
+ component: BcfViewToggleButtonComponent,
containerClasses: 'hidden-for-mobile',
},
{
@@ -87,65 +118,48 @@ export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent {
},
{
component: BimManageIfcModelsButtonComponent,
- show: () =>
- // Hide 'Manage models' toolbar button on plugin environment (ie: Revit)
- this.viewerBridgeService.shouldShowViewer
- && this.ifcData.allowed('manage_ifc_models'),
-
+ // Hide 'Manage models' toolbar button on plugin environment (ie: Revit)
+ show: ():boolean => this.viewerBridgeService.shouldShowViewer
+ && this.ifcData.allowed('manage_ifc_models'),
},
];
- get newRoute() {
- // Open new work packages in full view when there
- // is no viewer (ie: Revit)
- return this.viewerBridgeService.shouldShowViewer
- ? this.state.current.data.newRoute
- : 'bim.partitioned.new';
- }
-
constructor(readonly ifcData:IfcModelsDataService,
- readonly state:StateService,
- readonly bimView:BimViewService,
- readonly transition:TransitionService,
- readonly gon:GonService,
+ readonly bcfView:BcfViewService,
readonly injector:Injector,
readonly viewerBridgeService:ViewerBridgeService) {
super(injector);
}
- ngOnInit() {
+ ngOnInit():void {
super.ngOnInit();
- this.newRoute$.next(this.newRoute);
- this
- .bimView
- .observeUntil(componentDestroyed(this))
- .subscribe((view) => {
- this.filterAllowed = view !== bimViewerViewIdentifier;
+ this.setupChangeObserver(this.bcfView);
+
+ // Add bcf thumbnail to wp table per default, once the columns are available
+ this.wpTableColumns.querySpace.available.columns.values$()
+ .pipe(this.untilDestroyed())
+ .subscribe(() => {
+ this.wpTableColumns.addColumn('bcfThumbnail', 2);
});
- // Keep the new route up to date depending on where we move to
- this.transitionUnsubscribeFn = this.transition.onSuccess({}, () => {
- this.newRoute$.next(this.newRoute);
- });
+ this.querySpace.query.values$()
+ .pipe(this.untilDestroyed())
+ .subscribe((query) => {
+ const dr = query.displayRepresentation || bcfSplitViewCardsIdentifier;
+ this.filterAllowed = dr !== bcfViewerViewIdentifier;
+ this.cdRef.detectChanges();
+ });
}
/**
- * We disable using the query title for now,
- * but this might be useful later.
- *
- * To re-enable query titles, remove this function.
- *
- * @param query
+ * Initialize the BcfViewService when the query of the isolated space is loaded
*/
- updateTitle(query?:QueryResource) {
- if (this.bimView.current === bimListViewIdentifier) {
- super.updateTitle(query);
- } else {
- this.selectedTitle = this.I18n.t('js.bcf.management');
- }
-
- // For now, disable any editing
- this.titleEditingEnabled = false;
+ public loadQuery(firstPage = false):Promise<QueryResource> {
+ return super.loadQuery(firstPage)
+ .then((query) => {
+ this.bcfView.initialize(query, query.results);
+ return query;
+ });
}
}
diff --git a/frontend/src/app/features/bim/ifc_models/toolbar/manage-ifc-models-button/bim-manage-ifc-models-button.component.ts b/frontend/src/app/features/bim/ifc_models/toolbar/manage-ifc-models-button/bim-manage-ifc-models-button.component.ts
index 56f03456682..49593d3c8d3 100644
--- a/frontend/src/app/features/bim/ifc_models/toolbar/manage-ifc-models-button/bim-manage-ifc-models-button.component.ts
+++ b/frontend/src/app/features/bim/ifc_models/toolbar/manage-ifc-models-button/bim-manage-ifc-models-button.component.ts
@@ -43,7 +43,7 @@ import { IfcModelsDataService } from 'core-app/features/bim/ifc_models/pages/vie
`,
changeDetection: ChangeDetectionStrategy.OnPush,
- selector: 'bim-view-toggle-button',
+ selector: 'op-bcf-manage-ifc-button',
})
export class BimManageIfcModelsButtonComponent {
text = {
diff --git a/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-button.component.ts b/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-button.component.ts
similarity index 78%
rename from frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-button.component.ts
rename to frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-button.component.ts
index 7528bbcd308..507bb245172 100644
--- a/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-button.component.ts
+++ b/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-button.component.ts
@@ -28,30 +28,28 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { BimViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bim-view.service';
+import { BcfViewService } from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
@Component({
template: `
<ng-container *ngIf="(view$ | async) as current">
<button class="button"
- id="bim-view-toggle-button"
- bimViewDropdown>
- <op-icon icon-classes="button--icon {{bimView.icon[current]}}"></op-icon>
+ id="bcf-view-toggle-button"
+ opBcfViewDropdown>
+ <op-icon icon-classes="button--icon {{bcfView.icon[current]}}"></op-icon>
<span class="button--text"
aria-hidden="true"
- [textContent]="bimView.text[current]">
+ [textContent]="bcfView.text[current]">
</span>
<op-icon icon-classes="button--icon icon-small icon-pulldown"></op-icon>
</button>
</ng-container>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
- selector: 'bim-view-toggle-button',
+ selector: 'op-bcf-view-toggle-button',
})
-export class BimViewToggleButtonComponent {
- view$ = this.bimView.view$;
+export class BcfViewToggleButtonComponent {
+ view$ = this.bcfView.live$();
- constructor(readonly I18n:I18nService,
- readonly bimView:BimViewService) {
- }
+ constructor(readonly I18n:I18nService, readonly bcfView:BcfViewService) { }
}
diff --git a/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts b/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-dropdown.directive.ts
similarity index 51%
rename from frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts
rename to frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-dropdown.directive.ts
index ecfecd43abd..7b7c927715f 100644
--- a/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bim-view-toggle-dropdown.directive.ts
+++ b/frontend/src/app/features/bim/ifc_models/toolbar/view-toggle/bcf-view-toggle-dropdown.directive.ts
@@ -32,55 +32,53 @@ import { OpContextMenuTrigger } from 'core-app/shared/components/op-context-menu
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { StateService } from '@uirouter/core';
import {
- bimListViewIdentifier,
- bimSplitViewCardsIdentifier,
- bimSplitViewListIdentifier,
- bimTableViewIdentifier,
- bimViewerViewIdentifier,
- BimViewService,
-} from 'core-app/features/bim/ifc_models/pages/viewer/bim-view.service';
+ bcfCardsViewIdentifier,
+ bcfSplitViewCardsIdentifier,
+ bcfSplitViewTableIdentifier,
+ bcfTableViewIdentifier,
+ bcfViewerViewIdentifier,
+ BcfViewService,
+} from 'core-app/features/bim/ifc_models/pages/viewer/bcf-view.service';
import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';
-import { WorkPackageViewDisplayRepresentationService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-display-representation.service';
import { WorkPackageFiltersService } from 'core-app/features/work-packages/components/filters/wp-filters/wp-filters.service';
+import { OpContextMenuItem } from 'core-app/shared/components/op-context-menu/op-context-menu.types';
@Directive({
- selector: '[bimViewDropdown]',
+ selector: '[opBcfViewDropdown]',
})
-export class BimViewToggleDropdownDirective extends OpContextMenuTrigger {
+export class BcfViewToggleDropdownDirective extends OpContextMenuTrigger {
constructor(readonly elementRef:ElementRef,
readonly opContextMenu:OPContextMenuService,
- readonly bimView:BimViewService,
+ readonly bcfView:BcfViewService,
readonly I18n:I18nService,
readonly state:StateService,
readonly wpFiltersService:WorkPackageFiltersService,
- readonly viewerBridgeService:ViewerBridgeService,
- readonly wpDisplayRepresentation:WorkPackageViewDisplayRepresentationService) {
+ readonly viewerBridgeService:ViewerBridgeService) {
super(elementRef, opContextMenu);
}
- protected open(evt:JQuery.TriggeredEvent) {
+ protected open(evt:JQuery.TriggeredEvent):void {
this.buildItems();
this.opContextMenu.show(this, evt);
}
- public get locals() {
+ public get locals():{ showAnchorRight?:boolean, contextMenuId?:string, items:OpContextMenuItem[] } {
return {
items: this.items,
- contextMenuId: 'bim-view-context-menu',
+ contextMenuId: 'bcf-view-context-menu',
};
}
private buildItems() {
- const { current } = this.bimView;
const items = this.viewerBridgeService.shouldShowViewer
- ? [bimViewerViewIdentifier, bimListViewIdentifier, bimSplitViewCardsIdentifier, bimSplitViewListIdentifier, bimTableViewIdentifier]
- : [bimListViewIdentifier, bimTableViewIdentifier];
+ ? [bcfViewerViewIdentifier, bcfCardsViewIdentifier, bcfSplitViewCardsIdentifier, bcfSplitViewTableIdentifier, bcfTableViewIdentifier]
+ : [bcfCardsViewIdentifier, bcfTableViewIdentifier];
this.items = items
.map((key) => ({
- hidden: key === current,
- linkText: this.bimView.text[key],
- icon: this.bimView.icon[key],
+ hidden: key === this.bcfView.currentViewerState(),
+ linkText: this.bcfView.text[key],
+ icon: this.bcfView.icon[key],
onClick: () => {
// Close filter section
if (this.wpFiltersService.visible) {
@@ -88,32 +86,14 @@ export class BimViewToggleDropdownDirective extends OpContextMenuTrigger {
}
switch (key) {
- // This project controls the view representation of the data through
- // the wpDisplayRepresentation service that modifies the QuerySpace
- // to inform the rest of the app about which display mode is currently
- // active (this.querySpace.query.live$).
- // Under the hood it is done by modifying the params of actual route.
- // Because of that, it is not possible to call this.state.go and
- // this.wpDisplayRepresentation.setDisplayRepresentation at the same
- // time, it raises a route error (The transition has been superseded by
- // a different transition...). To avoid this error, we are passing
- // a cards params to inform the view about the display representation mode
- // it has to show (cards or list).
- case bimListViewIdentifier:
- this.state.go('bim.partitioned.list', { cards: true });
- break;
- case bimTableViewIdentifier:
- this.state.go('bim.partitioned.list', { cards: false });
- break;
- case bimViewerViewIdentifier:
- this.state.go('bim.partitioned.model');
- break;
- case bimSplitViewCardsIdentifier:
- this.state.go('bim.partitioned.split', { cards: true });
- break;
- case bimSplitViewListIdentifier:
- this.state.go('bim.partitioned.split', { cards: false });
+ case 'cards':
+ case 'table':
+ case 'viewer':
+ case 'splitCards':
+ case 'splitTable':
+ this.bcfView.update(key);
break;
+ default:
}
return true;
diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sass b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sass
index 0bedeaabb55..3551ef00579 100644
--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sass
+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.sass
@@ -12,6 +12,9 @@
.work-packages-partitioned-page--content-left
display: none
+ .work-packages-partitioned-page--content-right
+ flex-grow: 1
+
&.-left-only
.work-packages-partitioned-page--content-right
display: none
diff --git a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
index 87047c8de41..61a0d383e5f 100644
--- a/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
+++ b/frontend/src/app/features/work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.ts
@@ -229,19 +229,21 @@ export class PartitionedQuerySpacePageComponent extends WorkPackagesViewBase imp
}
}
- refresh(visibly = false, firstPage = false):Promise<unknown> {
- let promise = this.loadQuery(firstPage) as Promise<unknown>;
+ refresh(visibly = false, firstPage = false):Promise<QueryResource> {
+ let promise = this.loadQuery(firstPage);
if (visibly) {
promise = promise.then((loadedQuery:QueryResource) => {
this.wpStatesInitialization.initialize(loadedQuery, loadedQuery.results);
- return this.additionalLoadingTime();
+ return this.additionalLoadingTime()
+ .then(() => loadedQuery);
});
this.loadingIndicator = promise;
} else {
promise = promise.then((loadedQuery:QueryResource) => {
this.wpStatesInitialization.initialize(loadedQuery, loadedQuery.results);
+ return loadedQuery;
});
}
diff --git a/frontend/src/app/shared/components/op-context-menu/op-context-menu-handler.ts b/frontend/src/app/shared/components/op-context-menu/op-context-menu-handler.ts
index 0d065c1889d..5f3605b32ed 100644
--- a/frontend/src/app/shared/components/op-context-menu/op-context-menu-handler.ts
+++ b/frontend/src/app/shared/components/op-context-menu/op-context-menu-handler.ts
@@ -52,7 +52,7 @@ export abstract class OpContextMenuHandler extends UntilDestroyedMixin {
/**
* Open this context menu
*/
- protected open(evt:JQuery.TriggeredEvent) {
+ protected open(evt:JQuery.TriggeredEvent):void {
this.opContextMenu.show(this, evt);
}
diff --git a/modules/bim/app/views/bim/ifc_models/ifc_models/_panels.html.erb b/modules/bim/app/views/bim/ifc_models/ifc_models/_panels.html.erb
index 3c0cc78bd05..deb0002dfc7 100644
--- a/modules/bim/app/views/bim/ifc_models/ifc_models/_panels.html.erb
+++ b/modules/bim/app/views/bim/ifc_models/ifc_models/_panels.html.erb
@@ -4,7 +4,7 @@
inputs: {
projectIdentifier: (@project ? @project.identifier : ''),
menuItems: [parent_name, name],
- baseRoute: 'bim.partitioned.split'
+ baseRoute: 'bim.partitioned.list'
}
%>
diff --git a/modules/bim/spec/features/bcf/create_spec.rb b/modules/bim/spec/features/bcf/create_spec.rb
index 4be1a7611d2..864eb873840 100644
--- a/modules/bim/spec/features/bcf/create_spec.rb
+++ b/modules/bim/spec/features/bcf/create_spec.rb
@@ -38,7 +38,6 @@ describe 'Create BCF',
shared_examples 'bcf details creation' do |with_viewpoints|
it "can create a new #{with_viewpoints ? 'bcf' : 'plain'} work package" do
create_page = index_page.create_wp_by_button(type)
- create_page.view_route = view_route
create_page.expect_current_path
@@ -74,8 +73,6 @@ describe 'Create BCF',
create_page.save!
- sleep 5
-
index_page.expect_and_dismiss_toaster(
message: 'Successful creation. Click here to open this work package in fullscreen view.'
)
@@ -97,7 +94,7 @@ describe 'Create BCF',
expect(work_package.bcf_issue.viewpoints.count).to eq 2
end
- expect(page).to have_current_path /bcf\/#{Regexp.escape(view_route)}$/, ignore_query: true
+ expect(page).to have_current_path /bcf$/, ignore_query: true
end
end
@@ -106,45 +103,50 @@ describe 'Create BCF',
end
context 'with all permissions' do
- context 'on the split page' do
- let(:view_route) { 'split' }
+ context 'when on default view' do
+ before do
+ index_page.visit_and_wait_until_finished_loading!
+ end
+
+ it_behaves_like 'bcf details creation', true
+ end
+
+ context 'when going to split table view first' do
before do
- index_page.visit!
- index_page.finished_loading
+ index_page.visit_and_wait_until_finished_loading!
+
+ index_page.switch_view 'Viewer and table'
end
it_behaves_like 'bcf details creation', true
end
- context 'on the split page switching to list' do
- let(:view_route) { 'list' }
+ context 'when going to cards view first' do
before do
- index_page.visit!
- index_page.finished_loading
+ index_page.visit_and_wait_until_finished_loading!
index_page.switch_view 'Cards'
- expect(page).to have_current_path /\/bcf\/list$/, ignore_query: true
end
it_behaves_like 'bcf details creation', false
end
- context 'starting on the list page' do
- let(:view_route) { 'list' }
+ context 'when going to table view first' do
before do
- visit bcf_project_frontend_path(project, "list")
- expect(page).to have_current_path /\/bcf\/list$/, ignore_query: true
+ index_page.visit_and_wait_until_finished_loading!
+
+ index_page.switch_view 'Table'
end
it_behaves_like 'bcf details creation', false
end
- context 'starting on the details page of an existing work package' do
+ context 'when starting on the details page of an existing work package' do
let(:work_package) { FactoryBot.create :work_package, project: project }
- let(:view_route) { 'split' }
+
before do
- visit bcf_project_frontend_path(project, "split/details/#{work_package.id}")
- expect(page).to have_current_path /\/bcf\/split\/details/, ignore_query: true
+ visit bcf_project_frontend_path(project, "details/#{work_package.id}")
+ index_page.expect_details_path
end
it_behaves_like 'bcf details creation', true
@@ -155,8 +157,7 @@ describe 'Create BCF',
let(:permissions) { %i[view_ifc_models manage_bcf view_work_packages] }
it 'has the create button disabled' do
- index_page.visit!
- index_page.finished_loading
+ index_page.visit_and_wait_until_finished_loading!
index_page.expect_wp_create_button_disabled
end
@@ -165,11 +166,9 @@ describe 'Create BCF',
context 'with add_work_packages but without manage_bcf permission' do
let(:permissions) { %i[view_ifc_models view_work_packages add_work_packages] }
- context 'on the split page' do
- let(:view_route) { 'split' }
+ context 'when on default view' do
before do
- index_page.visit!
- index_page.finished_loading
+ index_page.visit_and_wait_until_finished_loading!
end
it_behaves_like 'bcf details creation', false
diff --git a/modules/bim/spec/features/model_viewer_spec.rb b/modules/bim/spec/features/model_viewer_spec.rb
index 53b831e473d..9835f2ed5ee 100644
--- a/modules/bim/spec/features/model_viewer_spec.rb
+++ b/modules/bim/spec/features/model_viewer_spec.rb
@@ -103,7 +103,7 @@ describe 'model viewer',
end
context 'with only viewing permissions' do
- let(:view_role) { FactoryBot.create(:role, permissions: %i[view_ifc_models]) }
+ let(:view_role) { FactoryBot.create(:role, permissions: %i[view_ifc_models view_work_packages view_linked_issues]) }
let(:view_user) do
FactoryBot.create :user,
member_in_project: project,
diff --git a/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb b/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb
index 17efe27120a..f8ab3471102 100644
--- a/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb
+++ b/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb
@@ -85,14 +85,14 @@ describe 'BIM Revit Add-in navigation spec',
find('.menu-item', text: 'NONE', wait: 10).click
full_create.edit_field(:subject).expect_active!
- expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: false)
+ expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: :all)
end
it 'shows work package details page in full view on Cards display mode' do
model_page.click_info_icon(work_package)
expect(page).to have_selector('.work-packages-partitioned-page--content-left', text: work_package.subject)
- expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: false)
+ expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: :all)
end
context 'with the table display mode' do
diff --git a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
index 37c58ffb4ae..2d0be4dff5d 100644
--- a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
@@ -117,7 +117,7 @@ describe 'Show viewpoint in model viewer',
bcf_details.expect_viewpoint_count(1)
bcf_details.show_current_viewpoint
- path = Regexp.escape("bcf/split/details/#{work_package.id}/overview")
+ path = Regexp.escape("bcf/details/#{work_package.id}/overview")
expect(page).to have_current_path /#{path}/
expect(page).to have_current_path /#{project.id}/
diff --git a/modules/bim/spec/support/pages/bcf/create_split.rb b/modules/bim/spec/support/pages/bcf/create_split.rb
index 2c4bb3749b6..3e9cf01ddb1 100644
--- a/modules/bim/spec/support/pages/bcf/create_split.rb
+++ b/modules/bim/spec/support/pages/bcf/create_split.rb
@@ -37,14 +37,12 @@ module Pages
attr_accessor :project,
:model_id,
- :type_id,
- :view_route
+ :type_id
def initialize(project:, model_id: nil, type_id: nil)
super(project: project)
self.model_id = model_id
self.type_id = type_id
- self.view_route = :split
end
# Override delete viewpoint since we don't have confirm alert
@@ -53,7 +51,7 @@ module Pages
end
def path
- bcf_project_frontend_path(project, "#{view_route}/create_new")
+ bcf_project_frontend_path(project, "create_new")
end
def expect_current_path
diff --git a/modules/bim/spec/support/pages/ifc_models/bcf_details_page.rb b/modules/bim/spec/support/pages/ifc_models/bcf_details_page.rb
index c2293029e57..b7ce9521f7f 100644
--- a/modules/bim/spec/support/pages/ifc_models/bcf_details_page.rb
+++ b/modules/bim/spec/support/pages/ifc_models/bcf_details_page.rb
@@ -36,7 +36,7 @@ module Pages
protected
def path(tab = 'overview')
- bcf_project_frontend_path project, "split/details/#{work_package.id}/#{tab}"
+ bcf_project_frontend_path project, "details/#{work_package.id}/#{tab}"
end
end
end
diff --git a/modules/bim/spec/support/pages/ifc_models/show_default.rb b/modules/bim/spec/support/pages/ifc_models/show_default.rb
index ceb50f60a5f..879245dc753 100644
--- a/modules/bim/spec/support/pages/ifc_models/show_default.rb
+++ b/modules/bim/spec/support/pages/ifc_models/show_default.rb
@@ -49,8 +49,12 @@ module Pages
finished_loading
end
+ def expect_details_path
+ expect(page).to have_current_path /\/bcf\/details/, ignore_query: true
+ end
+
def finished_loading
- expect(page).to have_selector('.xeokit-busy-modal', visible: false, wait: 30)
+ expect(page).to have_selector('.xeokit-busy-modal', visible: :all, wait: 30)
end
def model_viewer_visible(visible)
@@ -98,14 +102,16 @@ module Pages
end
def switch_view(value)
- page.find('#bim-view-toggle-button').click
- within('#bim-view-context-menu') do
- page.find('.menu-item', text: value, exact_text: true).click
+ retry_block do
+ page.find('#bcf-view-toggle-button').click
+ within('#bcf-view-context-menu') do
+ page.find('.menu-item', text: value, exact_text: true).click
+ end
end
end
def expect_view_toggle_at(value)
- expect(page).to have_selector('#bim-view-toggle-button', text: value)
+ expect(page).to have_selector('#bcf-view-toggle-button', text: value)
end
def has_no_menu_item_with_text?(value)