Merge pull request #9972 from opf/feature/39772-update-bcf-to-op-view-select

[#39772] update bcf to op view select
pull/9989/head
Eric Schubert 3 years ago committed by GitHub
commit 5d0cf3a2c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-viewer-page.component.ts
  2. 27
      frontend/src/app/shared/components/op-view-select/op-static-queries.service.ts
  3. 3
      modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb
  4. 74
      modules/bim/spec/features/bcf_view_management_spec.rb
  5. 6
      modules/bim/spec/support/pages/ifc_models/show_default.rb

@ -56,6 +56,7 @@ import { RefreshButtonComponent } from 'core-app/features/bim/ifc_models/toolbar
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';
import { WorkPackageSettingsButtonComponent } from 'core-app/features/work-packages/components/wp-buttons/wp-settings-button/wp-settings-button.component';
@Component({
templateUrl: '../../../../work-packages/routing/partitioned-query-space-page/partitioned-query-space-page.component.html',
@ -122,6 +123,14 @@ export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent i
show: ():boolean => this.viewerBridgeService.shouldShowViewer
&& this.ifcData.allowed('manage_ifc_models'),
},
{
component: WorkPackageSettingsButtonComponent,
containerClasses: 'hidden-for-mobile',
show: ():boolean => this.authorisationService.can('query', 'updateImmediately'),
inputs: {
hideTableOptions: true,
},
},
];
constructor(readonly ifcData:IfcModelsDataService,
@ -136,13 +145,6 @@ export class IFCViewerPageComponent extends PartitionedQuerySpacePageComponent i
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);
});
this.querySpace.query.values$()
.pipe(this.untilDestroyed())
.subscribe((query) => {

@ -76,8 +76,7 @@ export class StaticQueriesService {
delete queryProps.pa;
const queryPropsString = JSON.stringify(queryProps);
// TODO: Get module route from query
const matched = this.getStaticQueriesForView('WorkPackagesTable').find((item) => {
const matched = this.staticQueries.find((item) => {
const uiParams = item.uiParams as { query_id:string, query_props:string };
return uiParams && uiParams.query_props === queryPropsString;
});
@ -135,26 +134,28 @@ export class StaticQueriesService {
},
{
title: this.text.all_open,
uiSref: 'bim.partitioned.split',
// TODO: "dr":"splitCards"
uiParams: { query_id: '', query_props: '' },
uiSref: 'bim.partitioned.list',
uiParams: {
query_id: '',
query_props: '{"c":["id","subject","bcfThumbnail","type","status","assignee","updatedAt"],"t":"id:desc"}',
},
view: 'Bim',
},
{
title: this.text.latest_activity,
uiSref: 'bim.partitioned.split',
uiSref: 'bim.partitioned.list',
uiParams: {
query_id: '',
query_props: '{"c":["id","subject","type","status","assignee","updatedAt"],"hi":false,"dr":"splitCards","g":"","t":"updatedAt:desc","f":[{"n":"status","o":"o","v":[]}]}',
query_props: '{"c":["id","subject","bcfThumbnail","type","status","assignee","updatedAt"],"t":"updatedAt:desc","f":[{"n":"status","o":"o","v":[]}]}',
},
view: 'Bim',
},
{
title: this.text.recently_created,
uiSref: 'bim.partitioned.split',
uiSref: 'bim.partitioned.list',
uiParams: {
query_id: '',
query_props: '{"c":["id","subject","type","status","assignee","createdAt"],"hi":false,"dr":"splitCards","g":"","t":"createdAt:desc","f":[{"n":"status","o":"o","v":[]}]}',
query_props: '{"c":["id","subject","bcfThumbnail","type","status","assignee","createdAt"],"t":"createdAt:desc","f":[{"n":"status","o":"o","v":[]}]}',
},
view: 'Bim',
},
@ -232,19 +233,19 @@ export class StaticQueriesService {
},
{
title: this.text.created_by_me,
uiSref: 'bim.partitioned.split',
uiSref: 'bim.partitioned.list',
uiParams: {
query_id: '',
query_props: '{"c":["id","subject","type","status","assignee","updatedAt"],"hi":false,"dr":"splitCards","g":"","t":"updatedAt:desc,id:asc","f":[{"n":"status","o":"o","v":[]},{"n":"author","o":"=","v":["me"]}]}',
query_props: '{"c":["id","subject","bcfThumbnail","type","status","assignee","updatedAt"],"t":"id:desc","f":[{"n":"status","o":"o","v":[]},{"n":"author","o":"=","v":["me"]}]}',
},
view: 'Bim',
},
{
title: this.text.assigned_to_me,
uiSref: 'bim.partitioned.split',
uiSref: 'bim.partitioned.list',
uiParams: {
query_id: '',
query_props: '{"c":["id","subject","type","status","author","updatedAt"],"hi":false,"dr":"splitCards","g":"","t":"updatedAt:desc,id:asc","f":[{"n":"status","o":"o","v":[]},{"n":"assigneeOrGroup","o":"=","v":["me"]}]}',
query_props: '{"c":["id","subject","bcfThumbnail","type","status","author","updatedAt"],"t":"id:desc","f":[{"n":"status","o":"o","v":[]},{"n":"assigneeOrGroup","o":"=","v":["me"]}]}',
},
view: 'Bim',
},

@ -194,8 +194,9 @@ module Bim
end
def frontend_redirect(model_ids)
props = '{"c":["id","subject","bcfThumbnail","type","status","assignee","updatedAt"],"t":"id:desc"}'
redirect_to bcf_project_frontend_path(models: JSON.dump(Array(model_ids)),
query_props: '{"t":"id:desc"}')
query_props: props)
end
def find_all_ifc_models

@ -0,0 +1,74 @@
#-- 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.
#++
require 'spec_helper'
require_relative '../support/pages/ifc_models/show_default'
require_relative '../../../../spec/features/views/shared_examples'
describe 'bcf view management',
with_config: { edition: 'bim' },
type: :feature,
js: true do
let(:project) { FactoryBot.create :project, enabled_module_names: %i[bim work_package_tracking] }
let(:bcf_page) { ::Pages::IfcModels::ShowDefault.new(project) }
let(:role) do
FactoryBot.create :role,
permissions: %w[
view_work_packages
save_queries
save_public_queries
view_ifc_models
save_bcf_queries
manage_public_bcf_queries
]
end
let(:user) do
FactoryBot.create :user,
member_in_project: project,
member_through_role: role
end
let!(:model) do
FactoryBot.create(:ifc_model_minimal_converted,
project: project,
uploader: user,
is_default: true)
end
before do
login_as(user)
bcf_page.visit_and_wait_until_finished_loading!
end
it_behaves_like 'module specific query view management' do
let(:module_page) { bcf_page }
let(:default_name) { 'All open' }
end
end

@ -34,10 +34,14 @@ module Pages
class ShowDefault < ::Pages::WorkPackageCards
include ::Pages::WorkPackages::Concerns::WorkPackageByButtonCreator
attr_accessor :project
attr_accessor :project,
:filters
def initialize(project)
super()
self.project = project
self.filters = ::Components::WorkPackages::Filters.new
end
def path

Loading…
Cancel
Save