diff --git a/app/assets/stylesheets/content/work_packages/_table_content.sass b/app/assets/stylesheets/content/work_packages/_table_content.sass
index 2f62eed331..b73670874e 100644
--- a/app/assets/stylesheets/content/work_packages/_table_content.sass
+++ b/app/assets/stylesheets/content/work_packages/_table_content.sass
@@ -135,6 +135,9 @@ html:not(.-browser-mobile)
.inline-edit--display-field
display: initial
+ &.bcfThumbnail
+ outline: none
+
// Some padding for the inner cells of the display fields
.inline-edit--display-field
padding: 2px
@@ -159,4 +162,5 @@ body.-browser-edge
.wp-table--cell-td img.thumbnail
height: 40px
+ outline: none
diff --git a/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts b/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts
index 299cea4de0..7616c5b760 100644
--- a/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts
+++ b/frontend/src/app/modules/bim/bcf/fields/display/bcf-thumbnail-field.module.ts
@@ -27,17 +27,18 @@
// ++
import {DisplayField} from "core-app/modules/fields/display/display-field.module";
-import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
import {InjectField} from "core-app/helpers/angular/inject-field.decorator";
+import {BcfPathHelperService} from "core-app/modules/bim/bcf/helper/bcf-path-helper.service";
export class BcfThumbnailDisplayField extends DisplayField {
- @InjectField() pathHelper:PathHelperService;
+ @InjectField() bcfPathHelper:BcfPathHelperService;
public render(element:HTMLElement, displayText:string):void {
- if (_.get(this, 'resource.bcf.viewpoints[0]')) {
- let vp = this.resource.bcf.viewpoints[0];
+ const viewpoints = this.resource.bcfViewpoints;
+ if (viewpoints && viewpoints.length > 0) {
+ const viewpoint = viewpoints[0];
element.innerHTML = `
-
+
`;
} else {
element.innerHTML = '';
diff --git a/frontend/src/app/modules/bim/bcf/helper/bcf-path-helper.service.ts b/frontend/src/app/modules/bim/bcf/helper/bcf-path-helper.service.ts
index 3fdfe390e1..fd436b09d7 100644
--- a/frontend/src/app/modules/bim/bcf/helper/bcf-path-helper.service.ts
+++ b/frontend/src/app/modules/bim/bcf/helper/bcf-path-helper.service.ts
@@ -28,6 +28,7 @@
import {Injectable} from '@angular/core';
import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service";
+import {HalLink} from "core-app/modules/hal/hal-link/hal-link";
@Injectable()
export class BcfPathHelperService {
@@ -45,4 +46,8 @@ export class BcfPathHelperService {
return this.pathHelper.projectPath(projectIdentifier) + '/work_packages.bcf';
}
}
+
+ public snapshotPath(viewpoint:HalLink) {
+ return viewpoint.href + '/snapshot';
+ }
}
diff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rb
index e28c72010e..c5d219e7ea 100644
--- a/modules/bim/lib/open_project/bim/engine.rb
+++ b/modules/bim/lib/open_project/bim/engine.rb
@@ -152,7 +152,7 @@ module OpenProject::Bim
type: 'BCF Thumbnail',
required: false,
writable: false,
- show_if: ->(*) { represented&.project&.module_enabled?(:bcf) }
+ show_if: ->(*) { represented&.project&.module_enabled?(:bim) }
end
extend_api_response(:v3, :activities, :activity) do
diff --git a/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb b/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
new file mode 100644
index 0000000000..ef96b30911
--- /dev/null
+++ b/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
@@ -0,0 +1,37 @@
+require 'spec_helper'
+
+describe 'BCF snapshot column', type: :feature, js: true, with_mail: false do
+ let(:project) { FactoryBot.create(:project) }
+ let(:wp_table) { Pages::WorkPackagesTable.new(project) }
+ let(:permissions) { %i[add_work_packages view_work_packages view_linked_issues] }
+ let!(:work_package) { FactoryBot.create(:work_package, project: project) }
+ let!(:bcf_issue) { FactoryBot.create(:bcf_issue_with_viewpoint, work_package: work_package) }
+ let(:user) do
+ FactoryBot.create :user,
+ member_in_project: project,
+ member_with_permissions: permissions
+ end
+ let!(:query) do
+ query = FactoryBot.build(:query, user: user, project: project)
+ query.column_names = ['subject', 'bcf_thumbnail']
+ query.filters.clear
+ query.show_hierarchies = false
+
+ query.save!
+ query
+ end
+
+ before do
+ login_as(user)
+ end
+
+ it 'shows BCF snapshot column correctly (Regression)' do
+ wp_table.visit_query query
+ wp_table.expect_work_package_listed(work_package)
+
+ page.within(".wp-row-#{work_package.id} td.bcfThumbnail") do
+ image_path = "/api/bcf/2.1/projects/#{project.identifier}/topics/#{bcf_issue.uuid}/viewpoints/#{bcf_issue.viewpoints.first.uuid}/snapshot"
+ expect(page).to have_selector("img[src=\"#{image_path}\"]")
+ end
+ end
+end