From 333c2c068e1d15a062b4df768c0505c9679b1da9 Mon Sep 17 00:00:00 2001 From: ulferts Date: Tue, 18 Feb 2020 16:16:06 +0100 Subject: [PATCH 1/5] render ifc default models within angular page --- config/routes.rb | 1 + .../wp-destroy-modal/wp-destroy.modal.ts | 2 +- .../common/path-helper/path-helper.service.ts | 4 + .../ifc-base-view/ifc-base-view.component.ts | 27 ++++--- .../openproject-ifc-models.module.ts | 54 +++++++++++-- .../pages/index/ifc-index-page.component.html | 33 ++++++++ .../pages/index/ifc-index-page.component.sass | 19 +++++ .../pages/index/ifc-index-page.component.ts | 75 +++++++++++++++++++ .../openproject-work-packages.module.ts | 3 - .../stylesheets/ifc_viewer/generic.sass | 48 +++++------- .../ifc_models/ifc_models_controller.rb | 6 +- ...ow_defaults.html.erb => defaults.html.erb} | 14 +--- .../ifc_models/ifc_models/index.html.erb | 2 +- .../views/ifc_models/ifc_models/show.html.erb | 27 +------ modules/ifc_models/config/locales/js-en.yml | 6 ++ modules/ifc_models/config/routes.rb | 26 +++---- .../lib/open_project/ifc_models/engine.rb | 6 +- .../spec/support/pages/ifc_models/index.rb | 2 +- .../support/pages/ifc_models/show_default.rb | 2 +- 19 files changed, 241 insertions(+), 116 deletions(-) create mode 100644 frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html create mode 100644 frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.sass create mode 100644 frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.ts rename modules/ifc_models/app/views/ifc_models/ifc_models/{show_defaults.html.erb => defaults.html.erb} (78%) create mode 100644 modules/ifc_models/config/locales/js-en.yml diff --git a/config/routes.rb b/config/routes.rb index d4f6f91023..bc644b0b21 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ #-- encoding: UTF-8 + #-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2020 the OpenProject GmbH diff --git a/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts b/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts index 61aad136d5..c5c882b357 100644 --- a/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts +++ b/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.ts @@ -98,7 +98,7 @@ export class WpDestroyModal extends OpModalComponent implements OnInit { this.text.text = this.I18n.t('js.modals.destroy_work_package.text', { label: this.workPackageLabel, count: this.workPackages.length - }), + }); this.text.childCount = (wp:WorkPackageResource) => { const count = this.children(wp).length; diff --git a/frontend/src/app/modules/common/path-helper/path-helper.service.ts b/frontend/src/app/modules/common/path-helper/path-helper.service.ts index 06755fa015..c204a10797 100644 --- a/frontend/src/app/modules/common/path-helper/path-helper.service.ts +++ b/frontend/src/app/modules/common/path-helper/path-helper.service.ts @@ -54,6 +54,10 @@ export class PathHelperService { } } + public ifcModelsPath(projectIdentifier:string) { + return this.staticBase + `/projects/${projectIdentifier}/ifc_models`; + } + public highlightingCssPath() { return this.staticBase + '/highlighting/styles'; } diff --git a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts b/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts index d9f2464249..e55a865096 100644 --- a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts +++ b/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts @@ -36,23 +36,22 @@ import {WorkPackageTableConfigurationObject} from "core-components/wp-table/wp-t selector: 'ifc-base-view', styleUrls: ['./ifc-base-view.component.sass'] }) -export class IfcBaseViewComponent { +export class IFCBaseViewComponent { public queryProps:{ [key:string]:any }; - public configuration:WorkPackageTableConfigurationObject; + public configuration:WorkPackageTableConfigurationObject = { + actionsColumnEnabled: false, + columnMenuEnabled: false, + contextMenuEnabled: false, + inlineCreateEnabled: false, + withFilters: true, + showFilterButton: false, + isCardView: true + }; - private filters:any[] = []; +private filters:any[] = []; constructor() { - this.configuration = { - actionsColumnEnabled: false, - columnMenuEnabled: false, - contextMenuEnabled: false, - inlineCreateEnabled: false, - withFilters: true, - showFilterButton: false, - isCardView: true - }; - + // TODO: Limit to project this.filters.push({ status: { operator: 'o', values: [] }}); @@ -67,5 +66,5 @@ export class IfcBaseViewComponent { } DynamicBootstrapper.register({ - selector: 'ifc-base-view', cls: IfcBaseViewComponent + selector: 'ifc-base-view', cls: IFCBaseViewComponent }); diff --git a/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts b/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts index 80a922859c..34c39aee3b 100644 --- a/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts +++ b/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts @@ -25,28 +25,68 @@ // // See doc/COPYRIGHT.rdoc for more details. // ++ - import {NgModule} from "@angular/core"; -import {IFCViewerComponent} from "core-app/modules/ifc_models/ifc-viewer/ifc-viewer.component"; -import {IfcBaseViewComponent} from "core-app/modules/ifc_models/ifc-base-view/ifc-base-view.component"; +import {IFCBaseViewComponent} from "core-app/modules/ifc_models/ifc-base-view/ifc-base-view.component"; import {OpenprojectWorkPackagesModule} from "core-app/modules/work_packages/openproject-work-packages.module"; +import { Ng2StateDeclaration, UIRouterModule, UIRouter } from '@uirouter/angular'; +import {IFCIndexPageComponent} from "core-app/modules/ifc_models/pages/index/ifc-index-page.component"; +import {OpenprojectCommonModule} from "core-app/modules/common/openproject-common.module"; +import { IFCViewerComponent } from './ifc-viewer/ifc-viewer.component'; + +export const IFC_ROUTES:Ng2StateDeclaration[] = [ + // TODO: properly namespace the routes e.g. bim.something + { + name: 'bim_defaults', + parent: 'root', + url: '/ifc_models/defaults/', + component: IFCIndexPageComponent + }, + { + name: 'bim_show', + parent: 'root', + url: '/ifc_models/{model_id:[0-9]+}/', + component: IFCIndexPageComponent, + } +]; + +export function uiRouterIFCConfiguration(uiRouter:UIRouter) { + uiRouter.urlService.rules + .when( + new RegExp("^/projects/(.*)/ifc_models/defaults$"), + match => `/projects/${match[1]}/ifc_models/defaults/` + ); + + uiRouter.urlService.rules + .when( + new RegExp("^/projects/(.*)/ifc_models/([0-9]+)$"), + match => `/projects/${match[1]}/ifc_models/${match[2]}/` + ); +} @NgModule({ imports: [ - OpenprojectWorkPackagesModule + OpenprojectCommonModule, + OpenprojectWorkPackagesModule, + UIRouterModule.forChild({ + states: IFC_ROUTES, + config: uiRouterIFCConfiguration + }) ], providers: [ ], declarations: [ - IfcBaseViewComponent, + // Pages + IFCIndexPageComponent, + IFCBaseViewComponent, + IFCViewerComponent ], exports: [ - IfcBaseViewComponent, + IFCBaseViewComponent, IFCViewerComponent ], entryComponents: [ - IfcBaseViewComponent, + IFCBaseViewComponent, IFCViewerComponent ] }) diff --git a/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html new file mode 100644 index 0000000000..164f794ac8 --- /dev/null +++ b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html @@ -0,0 +1,33 @@ +
+
+
+

+

+
+ +
+
+ +
+ +
+ +
+ + +
diff --git a/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.sass b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.sass new file mode 100644 index 0000000000..641b41b48a --- /dev/null +++ b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.sass @@ -0,0 +1,19 @@ +*:host + height: 100% + overflow: hidden + display: grid + grid-template-columns: 1fr 500px + grid-template-rows: 60px calc(100% - 60px) + grid-template-areas: "header header" "ifc-model wp-list" + grid-column-gap: 10px + + .toolbar-container + grid-area: header + + .ifc-view--view-table-container + grid-area: wp-list + + .ifc-view--viewer-container + grid-area: ifc-model + position: relative + overflow: hidden diff --git a/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.ts b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.ts new file mode 100644 index 0000000000..db354b94fc --- /dev/null +++ b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.ts @@ -0,0 +1,75 @@ +import {Component} from "@angular/core"; +import {I18nService} from "core-app/modules/common/i18n/i18n.service"; +import {PathHelperService} from "core-app/modules/common/path-helper/path-helper.service"; +import {CurrentProjectService} from "core-components/projects/current-project.service"; +import {WorkPackageTableConfigurationObject} from "core-components/wp-table/wp-table-configuration"; +import { StateService } from '@uirouter/core'; +import {GonService} from "core-app/modules/common/gon/gon.service"; + +@Component({ + templateUrl: './ifc-index-page.component.html', + styleUrls: ['./ifc-index-page.component.sass'] +}) +export class IFCIndexPageComponent { + public text = { + title: this.i18n.t('js.ifc_models.models.default'), + manage: this.i18n.t('js.ifc_models.models.manage'), + delete: this.i18n.t('js.button_delete'), + edit: this.i18n.t('js.button_edit'), + areYouSure: this.i18n.t('js.text_are_you_sure') + }; + public queryProps:{ [key:string]:any }; + public configuration:WorkPackageTableConfigurationObject = { + actionsColumnEnabled: false, + columnMenuEnabled: false, + contextMenuEnabled: false, + inlineCreateEnabled: false, + withFilters: true, + showFilterButton: false, + isCardView: true + }; + + private filters:any[] = []; + + constructor(readonly state:StateService, + readonly i18n:I18nService, + readonly paths:PathHelperService, + readonly currentProject:CurrentProjectService, + readonly gon:GonService) { + + this.applyFilters(); + } + + public get title() { + if (this.state.current.name === 'bim_defaults') { + return this.i18n.t('js.ifc_models.models.default'); + } else { + return (this.gon.get('ifc_models') as any)['models'][0]['name']; + } + } + + public get projectIdentifier() { + return this.currentProject.identifier!; + } + + public get manageIFCPath() { + return this.paths.ifcModelsPath(this.projectIdentifier); + } + + private applyFilters() { + // TODO: Limit to project + this.filters.push({ + status: { + operator: 'o', + values: [] + } + }); + + this.queryProps = { + 'columns[]': ['id', 'subject'], + filters: JSON.stringify(this.filters), + sortBy: JSON.stringify([['updatedAt', 'desc']]), + showHierarchies: false + }; + } +} diff --git a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts b/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts index cb00d028e9..21f2a197af 100644 --- a/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts +++ b/frontend/src/app/modules/work_packages/openproject-work-packages.module.ts @@ -180,9 +180,6 @@ import { TimeEntryChangeset } from 'core-app/components/time-entries/time-entry- OpenprojectBcfModule, OpenprojectProjectsModule, - - // Work package custom actions - //WpCustomActionsModule, ], providers: [ { diff --git a/modules/ifc_models/app/assets/stylesheets/ifc_viewer/generic.sass b/modules/ifc_models/app/assets/stylesheets/ifc_viewer/generic.sass index 6b860ce2c7..4210d1a035 100644 --- a/modules/ifc_models/app/assets/stylesheets/ifc_viewer/generic.sass +++ b/modules/ifc_models/app/assets/stylesheets/ifc_viewer/generic.sass @@ -16,12 +16,11 @@ overflow: hidden &.action-show, - &.action-show_defaults + &.action-defaults #content-wrapper padding: 10px 20px 20px 20px + #content - display: flex - flex-direction: column height: 100% // Override default behavior to let the viewer span the whole height @@ -32,38 +31,31 @@ [data-name="ifc_models"] .main-menu--children overflow-x: hidden !important -.ifc-view--viewer-container - flex-grow: 1 - position: relative - width: 100% - height: 100% - overflow: hidden - - .ifc-model-viewer--nav-cube-canvas - position: absolute - width: 200px - height: 200px - bottom: 0 - right: 0 - z-index: 10 +.ifc-model-viewer--nav-cube-canvas + position: absolute + width: 200px + height: 200px + bottom: 0 + right: 0 + z-index: 10 - .ifc-model-viewer--section-planes-overview-canvas - position: absolute - width: 250px - height: 250px - top: 50px - right: 50px - z-index: 2000 +.ifc-model-viewer--section-planes-overview-canvas + position: absolute + width: 250px + height: 250px + top: 50px + right: 50px + z-index: 2000 .ifc-model-viewer--container position: relative width: 100% height: 100% - .ifc-model-viewer--model-canvas - width: 100% - height: 100% - background: $gray-lighter +.ifc-model-viewer--model-canvas + width: 100% + height: 100% + background: $gray-lighter // -------------------------- XEOKIT specific rules for BUTTONS -------------------------- diff --git a/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb b/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb index 82fe385fad..fd8f7765bc 100644 --- a/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb +++ b/modules/ifc_models/app/controllers/ifc_models/ifc_models_controller.rb @@ -32,9 +32,9 @@ module ::IFCModels class IFCModelsController < BaseController helper_method :gon - before_action :find_project_by_project_id, only: %i[index new create show show_defaults edit update destroy] + before_action :find_project_by_project_id, only: %i[index new create show defaults edit update destroy] before_action :find_ifc_model_object, except: %i[index new create] - before_action :find_all_ifc_models, only: %i[show show_defaults index] + before_action :find_all_ifc_models, only: %i[show defaults index] before_action :authorize @@ -53,7 +53,7 @@ module ::IFCModels def show; end - def show_defaults + def defaults @default_ifc_models = @ifc_models.defaults if @default_ifc_models.empty? diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/defaults.html.erb similarity index 78% rename from modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erb rename to modules/ifc_models/app/views/ifc_models/ifc_models/defaults.html.erb index 6205d5f601..db01c061e6 100644 --- a/modules/ifc_models/app/views/ifc_models/ifc_models/show_defaults.html.erb +++ b/modules/ifc_models/app/views/ifc_models/ifc_models/defaults.html.erb @@ -34,17 +34,6 @@ See doc/COPYRIGHT.rdoc for more details. <%= render partial: 'show_headers', locals: { all_models: @ifc_models, selected_models: @default_ifc_models } %> -<%= toolbar title: t('ifc_models.label_default_ifc_models') do %> -
  • - <%= link_to(ifc_models_project_ifc_models_path(@project), class: 'button', accesskey: accesskey(:edit)) do %> - <%= op_icon('button--icon icon-settings2') %> <%= t('ifc_models.label_manage_models') %> - <% end %> -
  • -
  • - -
  • -<% end %> - <% if @default_ifc_models.empty? %> <%= render partial: 'no_default_notice', locals: { project: @project } %> <% else %> @@ -54,5 +43,6 @@ See doc/COPYRIGHT.rdoc for more details. <%= render partial: 'unconverted_notice', locals: { unconverted: unconverted } %> <% end %> - + <% end %> + diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/index.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/index.html.erb index ef553f2436..9b7affc642 100644 --- a/modules/ifc_models/app/views/ifc_models/ifc_models/index.html.erb +++ b/modules/ifc_models/app/views/ifc_models/ifc_models/index.html.erb @@ -42,7 +42,7 @@ See docs/COPYRIGHT.rdoc for more details. <% end %> <% if @ifc_models.defaults.any? %>
  • - <%= link_to show_defaults_ifc_models_project_ifc_models_path, + <%= link_to defaults_ifc_models_project_ifc_models_path, { class: 'button', aria: { label: t('ifc_models.label_show_defaults') }, title: t('ifc_models.label_show_defaults') } do %> diff --git a/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb b/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb index 6f0fcb22aa..9f44e72705 100644 --- a/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb +++ b/modules/ifc_models/app/views/ifc_models/ifc_models/show.html.erb @@ -34,31 +34,6 @@ See doc/COPYRIGHT.rdoc for more details. <%= render partial: 'show_headers', locals: { all_models: @ifc_models, selected_models: [@ifc_model] } %> -<%= toolbar title: @ifc_model.title do %> - <% if authorize_for('ifc_models/ifc_models', :edit) %> -
  • - <%= link_to(edit_ifc_models_project_ifc_model_path(@project, @ifc_model), class: 'button', accesskey: accesskey(:edit)) do %> - <%= op_icon('button--icon icon-edit') %> <%= t(:button_edit) %> - <% end %> -
  • - <% end %> - <% if authorize_for('ifc_models/ifc_models', :destroy) %> -
  • - <%= link_to(ifc_models_project_ifc_model_path(@project, @ifc_model), class: 'button', data: { confirm: t(:text_are_you_sure) }, method: :delete) do %> - <%= op_icon('button--icon icon-delete') %> <%= t(:button_delete) %> - <% end %> -
  • - <% end %> -
  • - <%= link_to(ifc_models_project_ifc_models_path(@project), class: 'button', accesskey: accesskey(:edit)) do %> - <%= op_icon('button--icon icon-settings2') %> <%= t('ifc_models.label_manage_models') %> - <% end %> -
  • -
  • - -
  • -<% end %> - <% if @ifc_model.converted? %> - + <% end %> diff --git a/modules/ifc_models/config/locales/js-en.yml b/modules/ifc_models/config/locales/js-en.yml new file mode 100644 index 0000000000..464a53bddb --- /dev/null +++ b/modules/ifc_models/config/locales/js-en.yml @@ -0,0 +1,6 @@ +en: + js: + ifc_models: + models: + default: 'Default IFC models' + manage: 'Manage models' diff --git a/modules/ifc_models/config/routes.rb b/modules/ifc_models/config/routes.rb index 11f8fb5953..34cd6a6057 100644 --- a/modules/ifc_models/config/routes.rb +++ b/modules/ifc_models/config/routes.rb @@ -1,20 +1,15 @@ +#-- encoding: UTF-8 + #-- copyright -# OpenProject Backlogs Plugin -# -# Copyright (C)2013-2014 the OpenProject Foundation (OPF) -# Copyright (C)2011 Stephan Eckardt, Tim Felgentreff, Marnen Laibow-Koser, Sandro Munda -# Copyright (C)2010-2011 friflaj -# Copyright (C)2010 Maxime Guilbot, Andrew Vit, Joakim Kolsjö, ibussieres, Daniel Passos, Jason Vasquez, jpic, Emiliano Heyns -# Copyright (C)2009-2010 Mark Maglana -# Copyright (C)2009 Joe Heck, Nate Lowrie +# OpenProject is a project management system. +# Copyright (C) 2012-2020 the OpenProject Foundation (OPF) # -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License version 3. +# 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 Backlogs is a derivative work based on ChiliProject Backlogs. -# The copyright follows: -# Copyright (C) 2010-2011 - Emiliano Heyns, Mark Maglana, friflaj -# Copyright (C) 2011 - Jens Ulferts, Gregor Schmidt - Finn GmbH - Berlin, Germany +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2017 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 @@ -34,12 +29,11 @@ #++ OpenProject::Application.routes.draw do - # get '/projects/:project_id/ifc_models', to: 'ifc_models/ifc_models#index' scope '', as: 'ifc_models' do scope 'projects/:project_id', as: 'project' do resources :ifc_models, controller: 'ifc_models/ifc_models' do collection do - get 'show_defaults' + get 'defaults' end end end diff --git a/modules/ifc_models/lib/open_project/ifc_models/engine.rb b/modules/ifc_models/lib/open_project/ifc_models/engine.rb index aec8864b35..737b5a056c 100644 --- a/modules/ifc_models/lib/open_project/ifc_models/engine.rb +++ b/modules/ifc_models/lib/open_project/ifc_models/engine.rb @@ -45,7 +45,7 @@ module OpenProject::IFCModels project_module :ifc_models do permission :view_ifc_models, - { 'ifc_models/ifc_models': %i[index show show_defaults] } + { 'ifc_models/ifc_models': %i[index show defaults] } permission :manage_ifc_models, { 'ifc_models/ifc_models': %i[index show destroy edit update create new] }, dependencies: %i[view_ifc_models] @@ -59,7 +59,7 @@ module OpenProject::IFCModels initializer 'ifc_models.menu' do ::Redmine::MenuManager.map(:project_menu) do |menu| menu.push(:ifc_models, - { controller: '/ifc_models/ifc_models', action: 'show_defaults' }, + { controller: '/ifc_models/ifc_models', action: 'defaults' }, caption: :'ifc_models.label_ifc_models', param: :project_id, after: :work_packages, @@ -67,7 +67,7 @@ module OpenProject::IFCModels badge: :label_new) menu.push :ifc_viewer_panels, - { controller: '/ifc_models/ifc_models', action: 'show_defaults' }, + { controller: '/ifc_models/ifc_models', action: 'defaults' }, param: :project_id, parent: :ifc_models, partial: '/ifc_models/ifc_models/panels' diff --git a/modules/ifc_models/spec/support/pages/ifc_models/index.rb b/modules/ifc_models/spec/support/pages/ifc_models/index.rb index f27e289a8f..4ecac6f48e 100644 --- a/modules/ifc_models/spec/support/pages/ifc_models/index.rb +++ b/modules/ifc_models/spec/support/pages/ifc_models/index.rb @@ -106,7 +106,7 @@ module Pages click_toolbar_button 'Show defaults' expect_correct_page_loaded '.ifc-model-viewer--container', - show_defaults_ifc_models_project_ifc_models_path(project) + defaults_ifc_models_project_ifc_models_path(project) visit! end diff --git a/modules/ifc_models/spec/support/pages/ifc_models/show_default.rb b/modules/ifc_models/spec/support/pages/ifc_models/show_default.rb index 72c3fdfd54..3e0939494f 100644 --- a/modules/ifc_models/spec/support/pages/ifc_models/show_default.rb +++ b/modules/ifc_models/spec/support/pages/ifc_models/show_default.rb @@ -38,7 +38,7 @@ module Pages end def path - show_defaults_ifc_models_project_ifc_models_path(project) + defaults_ifc_models_project_ifc_models_path(project) end def finished_loading From ea63b06990f71f2bbb7fe02451ed963087be2d97 Mon Sep 17 00:00:00 2001 From: ulferts Date: Wed, 19 Feb 2020 10:49:46 +0100 Subject: [PATCH 2/5] remove IFCBaseComponent The functionality has been swallowed by the IFCIndexPage --- .../ifc-base-view.component.html | 12 ---- .../ifc-base-view.component.sass | 12 ---- .../ifc-base-view/ifc-base-view.component.ts | 70 ------------------- .../ifc-viewer/ifc-viewer.component.ts | 3 - .../openproject-ifc-models.module.ts | 6 -- 5 files changed, 103 deletions(-) delete mode 100644 frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.html delete mode 100644 frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.sass delete mode 100644 frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts diff --git a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.html b/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.html deleted file mode 100644 index ca1c48b9fc..0000000000 --- a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
    -
    - -
    - -
    - - -
    -
    diff --git a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.sass b/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.sass deleted file mode 100644 index 9be1e3d451..0000000000 --- a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.sass +++ /dev/null @@ -1,12 +0,0 @@ -*:host - height: calc(100% - 60px) - -.ifc-base-view--container - display: flex - height: 100% - -.ifc-view--table-container - height: 100% - margin-left: 15px - // Cancel out space for scroll bar and align with toolbar and header - margin-right: -15px diff --git a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts b/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts deleted file mode 100644 index e55a865096..0000000000 --- a/frontend/src/app/modules/ifc_models/ifc-base-view/ifc-base-view.component.ts +++ /dev/null @@ -1,70 +0,0 @@ -// -- copyright -// OpenProject is an open source project management software. -// Copyright (C) 2012-2020 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 {DynamicBootstrapper} from "core-app/globals/dynamic-bootstrapper"; -import {WorkPackageTableConfigurationObject} from "core-components/wp-table/wp-table-configuration"; - -@Component({ - templateUrl: './ifc-base-view.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - selector: 'ifc-base-view', - styleUrls: ['./ifc-base-view.component.sass'] -}) -export class IFCBaseViewComponent { - public queryProps:{ [key:string]:any }; - public configuration:WorkPackageTableConfigurationObject = { - actionsColumnEnabled: false, - columnMenuEnabled: false, - contextMenuEnabled: false, - inlineCreateEnabled: false, - withFilters: true, - showFilterButton: false, - isCardView: true - }; - -private filters:any[] = []; - - constructor() { - // TODO: Limit to project - this.filters.push({ status: { - operator: 'o', - values: [] }}); - - this.queryProps = { - 'columns[]': ['id', 'subject'], - filters: JSON.stringify(this.filters), - sortBy: JSON.stringify([['updatedAt', 'desc']]), - showHierarchies: false - }; - } - -} -DynamicBootstrapper.register({ - selector: 'ifc-base-view', cls: IFCBaseViewComponent -}); diff --git a/frontend/src/app/modules/ifc_models/ifc-viewer/ifc-viewer.component.ts b/frontend/src/app/modules/ifc_models/ifc-viewer/ifc-viewer.component.ts index 6babacb16d..c7c6f09c33 100644 --- a/frontend/src/app/modules/ifc_models/ifc-viewer/ifc-viewer.component.ts +++ b/frontend/src/app/modules/ifc_models/ifc-viewer/ifc-viewer.component.ts @@ -74,6 +74,3 @@ export class IFCViewerComponent implements OnInit { }); } } -DynamicBootstrapper.register({ - selector: 'ifc-viewer', cls: IFCViewerComponent -}); \ No newline at end of file diff --git a/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts b/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts index 34c39aee3b..c62f1bbcf7 100644 --- a/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts +++ b/frontend/src/app/modules/ifc_models/openproject-ifc-models.module.ts @@ -26,7 +26,6 @@ // See doc/COPYRIGHT.rdoc for more details. // ++ import {NgModule} from "@angular/core"; -import {IFCBaseViewComponent} from "core-app/modules/ifc_models/ifc-base-view/ifc-base-view.component"; import {OpenprojectWorkPackagesModule} from "core-app/modules/work_packages/openproject-work-packages.module"; import { Ng2StateDeclaration, UIRouterModule, UIRouter } from '@uirouter/angular'; import {IFCIndexPageComponent} from "core-app/modules/ifc_models/pages/index/ifc-index-page.component"; @@ -77,17 +76,12 @@ export function uiRouterIFCConfiguration(uiRouter:UIRouter) { declarations: [ // Pages IFCIndexPageComponent, - IFCBaseViewComponent, IFCViewerComponent ], exports: [ - IFCBaseViewComponent, - IFCViewerComponent ], entryComponents: [ - IFCBaseViewComponent, - IFCViewerComponent ] }) export class OpenprojectIFCModelsModule { From da838c0ffcd1ff65f855a1e6b563bb3275e03750 Mon Sep 17 00:00:00 2001 From: ulferts Date: Wed, 19 Feb 2020 11:16:34 +0100 Subject: [PATCH 3/5] hide manage button if user lacks permission --- .../pages/index/ifc-index-page.component.html | 3 ++- .../ifc_models/pages/index/ifc-index-page.component.ts | 10 +++++++++- modules/ifc_models/app/helpers/ifc_models_helper.rb | 5 ++++- .../ifc_models/spec/support/pages/ifc_models/index.rb | 3 ++- .../ifc_models/spec/support/pages/ifc_models/show.rb | 4 ---- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html index 164f794ac8..ee9654c642 100644 --- a/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html +++ b/frontend/src/app/modules/ifc_models/pages/index/ifc-index-page.component.html @@ -5,7 +5,8 @@