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
Replace dynamic route with custom element
Oliver Günther478faf86cd57
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.tsindex 41cf9ee4ab6..4d88146adf8 100644--- a/frontend/src/app/app.module.ts+++ b/frontend/src/app/app.module.ts@@ -219,6 +219,7 @@ import {import {OpWpDatePickerInstanceComponent,} from 'core-app/shared/components/datepicker/wp-date-picker-modal/wp-date-picker-instance.component';+import { ReportingPageComponent } from 'core-app/features/reporting/reporting-page/reporting-page.component';export function initializeServices(injector:Injector) {return () => {@@ -464,5 +465,6 @@ export class OpenProjectModule implements DoBootstrap {registerCustomElement('opce-global-search-tabs', GlobalSearchTabsComponent, { injector });registerCustomElement('opce-zen-mode-toggle-button', ZenModeButtonComponent, { injector });registerCustomElement('opce-colors-autocompleter', ColorsAutocompleterComponent, { injector });+ registerCustomElement('opce-reporting-page', ReportingPageComponent, { injector });}}diff --git a/frontend/src/app/core/routing/openproject.routes.ts b/frontend/src/app/core/routing/openproject.routes.tsindex 6d6f8f0d649..8c7d4e460d3 100644--- a/frontend/src/app/core/routing/openproject.routes.ts+++ b/frontend/src/app/core/routing/openproject.routes.ts@@ -80,12 +80,6 @@ export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [url: '/bcf',loadChildren: () => import('../../features/bim/ifc_models/openproject-ifc-models.module').then((m) => m.OpenprojectIFCModelsModule),},- {- name: 'reporting.**',- parent: 'optional_project',- url: '/cost_reports',- loadChildren: () => import('../../features/reporting/openproject-reporting.module').then((m) => m.OpenprojectReportingModule),- },...TEAM_PLANNER_LAZY_ROUTES,...CALENDAR_LAZY_ROUTES,];diff --git a/frontend/src/app/features/reporting/openproject-reporting.module.ts b/frontend/src/app/features/reporting/openproject-reporting.module.tsdeleted file mode 100644index dbbe8b11898..00000000000--- a/frontend/src/app/features/reporting/openproject-reporting.module.ts+++ /dev/null@@ -1,48 +0,0 @@-//-- copyright-// OpenProject is an open source project management software.-// Copyright (C) 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.-//++--import { NgModule } from '@angular/core';-import { UIRouterModule } from '@uirouter/angular';-import {- REPORTING_ROUTES,-} from 'core-app/features/reporting/openproject-reporting.routes';-import { ReportingPageComponent } from 'core-app/features/reporting/reporting-page/reporting-page.component';--@NgModule({- imports: [- // Routes for /cost_reports- UIRouterModule.forChild({- states: REPORTING_ROUTES,- }),- ],- declarations: [- ReportingPageComponent,- ],-})-export class OpenprojectReportingModule {-}diff --git a/frontend/src/app/features/reporting/openproject-reporting.routes.ts b/frontend/src/app/features/reporting/openproject-reporting.routes.tsdeleted file mode 100644index 3512724ecc0..00000000000--- a/frontend/src/app/features/reporting/openproject-reporting.routes.ts+++ /dev/null@@ -1,44 +0,0 @@-//-- copyright-// OpenProject is an open source project management software.-// Copyright (C) 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.-//++--import { Ng2StateDeclaration } from '@uirouter/angular';-import { ReportingPageComponent } from 'core-app/features/reporting/reporting-page/reporting-page.component';--export const REPORTING_ROUTES:Ng2StateDeclaration[] = [- {- name: 'reporting',- parent: 'optional_project',- url: '/cost_reports',- component: ReportingPageComponent,- },- {- name: 'reporting.show',- url: '/:id',- component: ReportingPageComponent,- },-];diff --git a/frontend/src/app/features/reporting/reporting-page/functionality/reporting_engine.js b/frontend/src/app/features/reporting/reporting-page/functionality/reporting_engine.jsindex aac750d2e52..e96f4eb46db 100644--- a/frontend/src/app/features/reporting/reporting-page/functionality/reporting_engine.js+++ b/frontend/src/app/features/reporting/reporting-page/functionality/reporting_engine.js@@ -26,6 +26,8 @@// See COPYRIGHT and LICENSE files for more details.//+++import * as jQuery from 'jquery';+/*jslint white: false, nomen: true, devel: true, on: true, debug: false, evil: true, onevar: false, browser: true, white: false, indent: 2 *//*global window, $, $$, Reporting, Element */diff --git a/frontend/src/app/features/reporting/reporting-page/reporting-page.component.ts b/frontend/src/app/features/reporting/reporting-page/reporting-page.component.tsindex 33891a4887f..c432d63a030 100644--- a/frontend/src/app/features/reporting/reporting-page/reporting-page.component.ts+++ b/frontend/src/app/features/reporting/reporting-page/reporting-page.component.ts@@ -1,16 +1,7 @@import { Component, OnInit, ViewEncapsulation } from '@angular/core';import { registerTableSorter } from 'core-app/features/reporting/reporting-page/functionality/tablesorter';-import './functionality/reporting_engine';-import './functionality/reporting_engine/filters';-import './functionality/reporting_engine/group_bys';-import './functionality/reporting_engine/restore_query';-import './functionality/reporting_engine/controls';--export const reportingPageComponentSelector = 'op-reporting-page';-@Component({- selector: reportingPageComponentSelector,// Empty wrapper around legacy backlogs for CSS loading// that got removed in the Rails assets pipelineencapsulation: ViewEncapsulation.None,@@ -18,10 +9,20 @@ export const reportingPageComponentSelector = 'op-reporting-page';styleUrls: ['./styles/reporting.sass',],+ standalone: true,})export class ReportingPageComponent implements OnInit {- ngOnInit() {- document.getElementById('projected-content')!.hidden = false;+ async ngOnInit() {+ // @ts-expect-error imported JS is not typed+ await import('./functionality/reporting_engine');+ // @ts-expect-error imported JS is not typed+ await import('./functionality/reporting_engine/filters');+ // @ts-expect-error imported JS is not typed+ await import('./functionality/reporting_engine/group_bys');+ // @ts-expect-error imported JS is not typed+ await import('./functionality/reporting_engine/restore_query');+ // @ts-expect-error imported JS is not typed+ await import('./functionality/reporting_engine/controls');// Register table sorting functionality after reporting engine loadedregisterTableSorter();diff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rbindex 764ee044cad..f2af430f2fc 100644--- a/modules/reporting/app/controllers/cost_reports_controller.rb+++ b/modules/reporting/app/controllers/cost_reports_controller.rb@@ -67,8 +67,6 @@ class CostReportsController < ApplicationControllerbefore_action :set_cost_types # has to be set AFTER the Report::Controller filters run- layout "angular/angular"-# Checks if custom fields have been updated, added or removed since we# last saw them, to rebuild the filters and group bys.# Called once per request.diff --git a/modules/reporting/app/views/cost_reports/index.html.erb b/modules/reporting/app/views/cost_reports/index.html.erbindex 62437313238..f49f8fb7f75 100644--- a/modules/reporting/app/views/cost_reports/index.html.erb+++ b/modules/reporting/app/views/cost_reports/index.html.erb@@ -35,6 +35,8 @@ See COPYRIGHT and LICENSE files for more details.<% html_title (@query.persisted? ? "#{t(:label_cost_report)}: #{@query.name}" : t(:label_new_report)) %>+<%= angular_component_tag "opce-reporting-page" %>+<%= render CostReports::IndexPageHeaderComponent.new(query: @query, project: @project) %><%= render_widget Widget::Settings, @query, cost_types: @cost_types, selected_type_id: @unit_id %>