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
Fix showing viewpoints in gallery again
Oliver Güntherfdb509db1764
diff --git a/frontend/npm-shrinkwrap.json b/frontend/npm-shrinkwrap.jsonindex 85385119098..2c667e4caaa 100644--- a/frontend/npm-shrinkwrap.json+++ b/frontend/npm-shrinkwrap.json@@ -605,7 +605,7 @@},"minimist": {"version": "1.2.0",- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",+ "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz","integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="},"require-main-filename": {diff --git a/frontend/src/app/modules/bcf/services/xeokit-bridge.service.ts b/frontend/src/app/modules/bcf/services/xeokit-bridge.service.tsindex fd550ca0e40..d15d61c1959 100644--- a/frontend/src/app/modules/bcf/services/xeokit-bridge.service.ts+++ b/frontend/src/app/modules/bcf/services/xeokit-bridge.service.ts@@ -1,7 +1,7 @@import {ViewerBridgeServiceInterface} from "core-app/modules/bcf/services/viewer-bridge.service";import {Injectable} from '@angular/core';-import {IFCViewerService} from "core-app/modules/ifc_models/ifc-viewer/ifc-viewer.service";+import {IFCViewerService} from "core-app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.service";@Injectable()export class XeokitBridgeService implements ViewerBridgeServiceInterface {@@ -9,7 +9,6 @@ export class XeokitBridgeService implements ViewerBridgeServiceInterface {}public getViewpoint():Promise<any> {- console.log("getViewpoint from ifcViewerService.getViewer()", this.xeokitViewerService.getViewer());- return new Promise((resolve, reject) => {});+ return Promise.resolve(this.ifcViewerService.saveBCFViewpoint());}}diff --git a/frontend/src/app/modules/bim/bcf/api/topics/bcf-topic.paths.ts b/frontend/src/app/modules/bim/bcf/api/topics/bcf-topic.paths.tsindex 94b9f904df5..6d1e3a64351 100644--- a/frontend/src/app/modules/bim/bcf/api/topics/bcf-topic.paths.ts+++ b/frontend/src/app/modules/bim/bcf/api/topics/bcf-topic.paths.ts@@ -3,6 +3,7 @@ import {BcfResourceCollectionPath, BcfResourcePath} from "core-app/modules/bim/bimport {BcfTopicResource} from "core-app/modules/bim/bcf/api/topics/bcf-topic.resource";import {BcfApiRequestService} from "core-app/modules/bim/bcf/api/bcf-api-request.service";import {BcfViewpointPaths} from "core-app/modules/bim/bcf/api/viewpoints/bcf-viewpoint.paths";+import {BcfViewpointCollectionPath} from "core-app/modules/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths";export class BcfTopicPaths extends BcfResourcePath {readonly bcfTopicService = new BcfApiRequestService(this.injector, BcfTopicResource);@@ -11,7 +12,7 @@ export class BcfTopicPaths extends BcfResourcePath {public readonly comments = new BcfResourceCollectionPath(this.injector, this.path, 'comments');/** /viewpoints */- public readonly viewpoints = new BcfResourceCollectionPath(this.injector, this.path, 'viewpoints', BcfViewpointPaths);+ public readonly viewpoints = new BcfViewpointCollectionPath(this.injector, this.path, 'viewpoints', BcfViewpointPaths);get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}) {return this.bcfTopicService.get(this.toPath(), params, headers);diff --git a/frontend/src/app/modules/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.ts b/frontend/src/app/modules/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.tsnew file mode 100644index 00000000000..fb7eaa575c8--- /dev/null+++ b/frontend/src/app/modules/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.ts@@ -0,0 +1,24 @@+import {BcfResourceCollectionPath} from "core-app/modules/bim/bcf/api/bcf-path-resources";+import {BcfApiRequestService} from "core-app/modules/bim/bcf/api/bcf-api-request.service";+import {BcfViewpointInterface} from "core-app/modules/bim/bcf/api/viewpoints/bcf-viewpoint.interface";+import {HTTPClientHeaders, HTTPClientParamMap} from "core-app/modules/hal/http/http.interfaces";+import {Observable} from "rxjs";+import {BcfViewpointPaths} from "core-app/modules/bim/bcf/api/viewpoints/bcf-viewpoint.paths";++export class BcfViewpointCollectionPath extends BcfResourceCollectionPath<BcfViewpointPaths> {+ readonly bcfTopicService = new BcfApiRequestService<BcfViewpointInterface>(this.injector);++ get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}) {+ throw new Error("Not implemented");+ }++ post(viewpoint:BcfViewpointInterface):Observable<BcfViewpointInterface> {+ return this+ .bcfTopicService+ .request(+ 'post',+ this.toPath(),+ viewpoint+ );+ }+}\ No newline at end of filediff --git a/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.html b/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.htmlindex eb4d3eb2403..5f4948a4f04 100644--- a/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.html+++ b/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.html@@ -1,4 +1,4 @@-<h3 class="attributes-groupe header-text">BCF</h3>+<h3 class="attributes-group header-text">BCF</h3><div class="bcf--viewpoints"><ngx-gallery [options]="galleryOptions"[images]="galleryImages"diff --git a/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.sass b/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.sassindex fdf017d0087..7a3bf6b154e 100644--- a/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.sass+++ b/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.sass@@ -1,20 +1,8 @@.bcf--viewpointsclear: both-.bcf--snapshot-preview- display: block- width: 100%- margin-bottom: 5px- float: left- &.-tiny- display: inline-block- float: initial- width: initial- height: 100px- margin-right: 5px- img- height: 100px-+ngx-gallery+ display: inline-blockngx-gallery ::ng-deep.ngx-gallery-arrowdiff --git a/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.ts b/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.tsindex e9958e2d410..c42d3bdc312 100644--- a/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.ts+++ b/frontend/src/app/modules/bim/bcf/bcf-wp-single-view/bcf-wp-single-view.component.ts@@ -8,6 +8,7 @@ import {HalLink} from "core-app/modules/hal/hal-link/hal-link";import {BcfApiService} from "core-app/modules/bim/bcf/api/bcf-api.service";import {BcfViewpointPaths} from "core-app/modules/bim/bcf/api/viewpoints/bcf-viewpoint.paths";import {CurrentProjectService} from "core-components/projects/current-project.service";+import {ModelViewerService} from "core-app/modules/bcf/services/model-viewer.service";export type ViewPointOriginal = { uuid:string, snapshot_id:string, snapshot_file_name:string };export type ViewPoint = { snapshotId:string, snapshotFileName?:string, snapshotFullPath:string };@@ -23,25 +24,30 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {galleryOptions:NgxGalleryOptions[] = [{width: '100%',- height: '130px',- thumbnailsColumns: 5,+ height: '400px',++ // Show only one image ("thumbnail")+ // and disable the large image slideshow+ image: false,+ thumbnailsColumns: 1,+ // Ensure thumbnails are ALWAYS shown+ thumbnailsAutoHide: false,+imageAnimation: '',previewAnimation: false,previewCloseOnEsc: true,previewKeyboardNavigation: true,imageSize: 'contain',imageArrowsAutoHide: true,- image: false,- thumbnailsArrowsAutoHide: false,- thumbnailsAutoHide: false,+ // thumbnailsArrowsAutoHide: true,thumbnailsMargin: 5,thumbnailMargin: 5,previewDownload: true,+ previewCloseOnClick: true,arrowPrevIcon: 'icon-arrow-left2',arrowNextIcon: 'icon-arrow-right2',closeIcon: 'icon-close',downloadIcon: 'icon-download',- previewCloseOnClick: true,thumbnailActions: [{icon: 'icon-modules',@@ -61,12 +67,11 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {{breakpoint: 800,width: '100%',- height: '300px',+ height: '600px',imagePercent: 80,thumbnailsPercent: 20,- thumbnailsMargin: 5,- thumbnailMargin: 5,- imageSize: 'contain',+ thumbnailsMargin: 20,+ thumbnailMargin: 20},// max-width 400{@@ -77,7 +82,7 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {galleryImages:NgxGalleryImage[];- viewpoints:string[];+ viewpoints:ViewPoint[];text = {};@@ -85,13 +90,14 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {readonly pathHelper:PathHelperService,readonly currentProject:CurrentProjectService,readonly bcfApi:BcfApiService,+ readonly modelViewerService:ModelViewerService,readonly revitBridge:RevitBridgeService,) {}ngOnInit():void {this.viewpoints = this.workPackage.bcfViewpoints.map((vp:HalLink) => {- const viewpointResource = this.bcfApi.parse(vp.href) as BcfViewpointPaths;+ const viewpointResource = this.bcfApi.parse(vp.href!) as BcfViewpointPaths;return {snapshotId: viewpointResource.id,@@ -100,11 +106,11 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {} as ViewPoint;});- this.galleryImages = this.viewpoints.map(url => {+ this.galleryImages = this.viewpoints.map(viewpoint => {return {- small: url,- medium: url,- big: url,+ small: viewpoint.snapshotFullPath,+ medium: viewpoint.snapshotFullPath,+ big: viewpoint.snapshotFullPath,};});}@@ -113,7 +119,7 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {// Nothing to do.}- setViewpoint(event:Event, index:number):void {+ setViewpoint(event:Event, index:number) {console.log('Set viewpoint for index', index, event);let viewpointUuid = this.workPackage.bcf.viewpoints[index]['uuid'];console.log('Set viewpoint for UUID', viewpointUuid);@@ -121,18 +127,30 @@ export class BcfWpSingleViewComponent implements OnInit, OnDestroy {console.log("handleClick");const trackingId = this.revitBridge.newTrackingId();- this.bcfApi+ this+ .bcfApi.projects.id(this.projectIdentifier).topics.id(this.topicUuid)- .viewpoints- .post()- .subscribe((data) => {- console.log("Response of posting viewpiont", data);+ .viewpoints.id(viewpointUuid)+ .get()+ .subscribe(data => {+ // TODO abstract from revitthis.revitBridge.sendMessageToRevit('ShowViewpoint', trackingId, JSON.stringify(data));});+ }++ async saveCurrentAsViewpoint() {+ const viewpoint = await this.modelViewerService.getViewpoint();++ this.bcfApi+ .projects.id(this.projectIdentifier)+ .topics.id(this.topicUuid)+ .viewpoints+ .post(viewpoint);}+ // TODO removegalleryPreviewOpen():void {jQuery('#top-menu')[0].style.zIndex = '10';}diff --git a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.service.tsindex e63d400d7ff..27d4d8e94cc 100644--- a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts+++ b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts@@ -24,7 +24,7 @@ export interface BCFLoadOptions {@Injectable()export class IFCViewerService {- private viewer:any;+ private _viewer:any;public newViewer(elements:XeokitElements, projects:any[]) {import('@xeokit/xeokit-viewer/dist/main').then((XeokitViewerModule:any) => {@@ -61,6 +61,14 @@ export class IFCViewerService {this.viewer = undefined;}+ public get viewer() {+ return this._viewer;+ }++ public set viewer(viewer:any) {+ this._viewer = viewer;+ }+public saveBCFViewpoint(options:BCFCreationOptions = {}):BcfViewpointInterface {return this.viewer.saveBCFViewpoint(options);}