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

[#38028] Refresh button for Revit Add-in (#9461)

Wieland Lindenthala0f5887c150e
diff --git a/frontend/src/app/features/bim/bcf/openproject-bcf.module.ts b/frontend/src/app/features/bim/bcf/openproject-bcf.module.ts
index c685e896aa1..8a27c6a83af 100644
--- a/frontend/src/app/features/bim/bcf/openproject-bcf.module.ts
+++ b/frontend/src/app/features/bim/bcf/openproject-bcf.module.ts
@@ -45,6 +45,7 @@ import { BcfNewWpAttributeGroupComponent } from 'core-app/features/bim/bcf/bcf-w
import { RevitBridgeService } from 'core-app/features/bim/revit_add_in/revit-bridge.service';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { OpenProjectHeaderInterceptor } from 'core-app/features/hal/http/openproject-header-interceptor';
+import { RefreshButtonComponent } from 'core-app/features/bim/ifc_models/toolbar/import-export-bcf/refresh-button.component';
/**
* Determines based on the current user agent whether
@@ -80,10 +81,12 @@ export const viewerBridgeServiceFactory = (injector:Injector) => {
BcfNewWpAttributeGroupComponent,
BcfImportButtonComponent,
BcfExportButtonComponent,
+ RefreshButtonComponent,
],
exports: [
BcfImportButtonComponent,
BcfExportButtonComponent,
+ RefreshButtonComponent,
],
})
export class OpenprojectBcfModule {
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 b4ca118514e..0646d451b38 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
@@ -23,6 +23,7 @@ import { StateService, TransitionService } from '@uirouter/core';
import { BehaviorSubject } 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';
@@ -58,6 +59,10 @@ export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent {
allowed: ['work_packages.createWorkPackage', 'work_package.copy'],
},
},
+ {
+ component: RefreshButtonComponent,
+ show: ():boolean => !this.viewerBridgeService.shouldShowViewer,
+ },
{
component: BcfImportButtonComponent,
show: () => this.ifcData.allowed('manage_bcf'),
diff --git a/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/refresh-button.component.ts b/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/refresh-button.component.ts
new file mode 100644
index 00000000000..13a952185f4
--- /dev/null
+++ b/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/refresh-button.component.ts
@@ -0,0 +1,58 @@
+// -- 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 docs/COPYRIGHT.rdoc for more details.
+//++
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+import { I18nService } from 'core-app/core/i18n/i18n.service';
+import { StateService } from '@uirouter/core';
+
+@Component({
+ template: `
+ <a [title]="text.refresh_hover"
+ class="button refresh-button"
+ (click)="refresh()">
+ <op-icon icon-classes="button--icon icon-workflow"></op-icon>
+ </a>
+ `,
+ selector: 'op-refresh-button',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+})
+
+export class RefreshButtonComponent {
+ public text = {
+ refresh: this.I18n.t('js.bcf.refresh'),
+ refresh_hover: this.I18n.t('js.bcf.refresh_work_package'),
+ };
+
+ constructor(readonly I18n:I18nService,
+ readonly state:StateService) {
+ }
+
+ refresh() {
+ void this.state.go('.', {}, { reload: true });
+ }
+}
diff --git a/modules/bim/config/locales/js-en.yml b/modules/bim/config/locales/js-en.yml
index 8dd35c35fdf..92752f797db 100644
--- a/modules/bim/config/locales/js-en.yml
+++ b/modules/bim/config/locales/js-en.yml
@@ -12,6 +12,8 @@ en:
show_viewpoint: 'Show viewpoint'
delete_viewpoint: 'Delete viewpoint'
management: 'BCF management'
+ refresh: 'Refresh'
+ refresh_work_package: 'Refresh work package'
ifc_models:
empty_warning: "This project does not yet have any IFC models."
use_this_link_to_manage: "Use this link to upload and manage your IFC models"