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

Replace reporting styles with frontend page

Oliver Günther8ad5b729ff92
diff --git a/frontend/src/app/modules/backlogs/backlogs-page/backlogs-page.component.ts b/frontend/src/app/modules/backlogs/backlogs-page/backlogs-page.component.ts
index b04220d0054..228e68be88a 100644
--- a/frontend/src/app/modules/backlogs/backlogs-page/backlogs-page.component.ts
+++ b/frontend/src/app/modules/backlogs/backlogs-page/backlogs-page.component.ts
@@ -14,6 +14,6 @@ export const backlogsPageComponentSelector = 'op-backlogs-page';
})
export class BacklogsPageComponent implements OnInit {
ngOnInit() {
- document.getElementById('projected-content').hidden = false;
+ document.getElementById('projected-content')!.hidden = false;
}
}
\ No newline at end of file
diff --git a/frontend/src/app/modules/backlogs/openproject-backlogs.module.ts b/frontend/src/app/modules/backlogs/openproject-backlogs.module.ts
index f53e4feb7cc..3146c3af2a6 100644
--- a/frontend/src/app/modules/backlogs/openproject-backlogs.module.ts
+++ b/frontend/src/app/modules/backlogs/openproject-backlogs.module.ts
@@ -33,7 +33,7 @@ import {BACKLOGS_ROUTES, uiRouterBacklogsConfiguration} from "core-app/modules/b
@NgModule({
imports: [
- // Routes for /boards
+ // Routes for /backlogs
UIRouterModule.forChild({
states: BACKLOGS_ROUTES,
config: uiRouterBacklogsConfiguration
diff --git a/frontend/src/app/modules/reporting/openproject-reporting.module.ts b/frontend/src/app/modules/reporting/openproject-reporting.module.ts
new file mode 100644
index 00000000000..6df3dfc6305
--- /dev/null
+++ b/frontend/src/app/modules/reporting/openproject-reporting.module.ts
@@ -0,0 +1,51 @@
+// -- 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 {NgModule} from '@angular/core';
+import {UIRouterModule} from "@uirouter/angular";
+import {
+ REPORTING_ROUTES,
+ uiRouterReportingConfiguration
+} from "core-app/modules/reporting/openproject-reporting.routes";
+import {ReportingPageComponent} from "core-app/modules/reporting/reporting-page/reporting-page.component";
+
+@NgModule({
+ imports: [
+ // Routes for /cost_reports
+ UIRouterModule.forChild({
+ states: REPORTING_ROUTES,
+ config: uiRouterReportingConfiguration
+ }),
+ ],
+ declarations: [
+ ReportingPageComponent
+ ]
+})
+export class OpenprojectReportingModule {
+}
+
diff --git a/frontend/src/app/modules/reporting/openproject-reporting.routes.ts b/frontend/src/app/modules/reporting/openproject-reporting.routes.ts
new file mode 100644
index 00000000000..26fae1c323a
--- /dev/null
+++ b/frontend/src/app/modules/reporting/openproject-reporting.routes.ts
@@ -0,0 +1,51 @@
+// -- 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 {Ng2StateDeclaration, UIRouter} from "@uirouter/angular";
+import {ReportingPageComponent} from "core-app/modules/reporting/reporting-page/reporting-page.component";
+
+export const REPORTING_ROUTES:Ng2StateDeclaration[] = [
+ {
+ name: 'reporting',
+ parent: 'root',
+ // The trailing slash is important
+ // cf., https://community.openproject.com/wp/29754
+ url: '/cost_reports/',
+ component: ReportingPageComponent
+ },
+];
+
+export function uiRouterReportingConfiguration(uiRouter:UIRouter) {
+ // Ensure backlogs/ are being redirected correctly
+ // cf., https://community.openproject.com/wp/29754
+ uiRouter.urlService.rules
+ .when(
+ new RegExp("^/projects/(.*)/cost_reports$"),
+ match => `/projects/${match[1]}/cost_reports/`
+ );
+}
diff --git a/frontend/src/app/modules/reporting/reporting-page/reporting-page.component.ts b/frontend/src/app/modules/reporting/reporting-page/reporting-page.component.ts
new file mode 100644
index 00000000000..f8281334892
--- /dev/null
+++ b/frontend/src/app/modules/reporting/reporting-page/reporting-page.component.ts
@@ -0,0 +1,19 @@
+import {Component, OnInit, ViewEncapsulation} from "@angular/core";
+
+export const reportingPageComponentSelector = 'op-reporting-page';
+
+@Component({
+ selector: reportingPageComponentSelector,
+ // Empty wrapper around legacy backlogs for CSS loading
+ // that got removed in the Rails assets pipeline
+ encapsulation: ViewEncapsulation.None,
+ template: '',
+ styleUrls: [
+ './styles/reporting.sass'
+ ]
+})
+export class ReportingPageComponent implements OnInit {
+ ngOnInit() {
+ document.getElementById('projected-content')!.hidden = false;
+ }
+}
\ No newline at end of file
diff --git a/modules/reporting/app/assets/stylesheets/reporting/_reporting_group_by.sass b/frontend/src/app/modules/reporting/reporting-page/styles/_reporting_group_by.sass
similarity index 100%
rename from modules/reporting/app/assets/stylesheets/reporting/_reporting_group_by.sass
rename to frontend/src/app/modules/reporting/reporting-page/styles/_reporting_group_by.sass
diff --git a/modules/reporting/app/assets/stylesheets/reporting/_reporting_table.sass b/frontend/src/app/modules/reporting/reporting-page/styles/_reporting_table.sass
similarity index 100%
rename from modules/reporting/app/assets/stylesheets/reporting/_reporting_table.sass
rename to frontend/src/app/modules/reporting/reporting-page/styles/_reporting_table.sass
diff --git a/modules/reporting/app/assets/stylesheets/reporting/_reporting_table_print.sass b/frontend/src/app/modules/reporting/reporting-page/styles/_reporting_table_print.sass
similarity index 100%
rename from modules/reporting/app/assets/stylesheets/reporting/_reporting_table_print.sass
rename to frontend/src/app/modules/reporting/reporting-page/styles/_reporting_table_print.sass
diff --git a/modules/reporting/app/assets/stylesheets/reporting/_reporting.sass b/frontend/src/app/modules/reporting/reporting-page/styles/reporting.sass
similarity index 94%
rename from modules/reporting/app/assets/stylesheets/reporting/_reporting.sass
rename to frontend/src/app/modules/reporting/reporting-page/styles/reporting.sass
index ee59a87919c..517365cc62b 100644
--- a/modules/reporting/app/assets/stylesheets/reporting/_reporting.sass
+++ b/frontend/src/app/modules/reporting/reporting-page/styles/reporting.sass
@@ -1,4 +1,7 @@
-@import "../../../frontend/src/global_styles/fonts/openproject_icon_definitions"
+@import "~global_styles/fonts/openproject_icon_definitions"
+@import _reporting_group_by
+@import _reporting_table
+@import _reporting_table_print
@mixin sort-icons
font-family: "openproject-icon-font" !important
diff --git a/frontend/src/app/modules/router/openproject.routes.ts b/frontend/src/app/modules/router/openproject.routes.ts
index 3c3ecef839c..aa99c1afe4c 100644
--- a/frontend/src/app/modules/router/openproject.routes.ts
+++ b/frontend/src/app/modules/router/openproject.routes.ts
@@ -69,6 +69,12 @@ export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [
url: '/backlogs',
loadChildren: () => import('../backlogs/openproject-backlogs.module').then(m => m.OpenprojectBacklogsModule)
},
+ {
+ name: 'reporting.**',
+ parent: 'root',
+ url: '/cost_reports',
+ loadChildren: () => import('../reporting/openproject-reporting.module').then(m => m.OpenprojectReportingModule)
+ },
];
/**
diff --git a/modules/reporting/app/assets/stylesheets/reporting/reporting_styles.sass b/modules/reporting/app/assets/stylesheets/reporting/reporting_styles.sass
deleted file mode 100644
index cd66bdd31c3..00000000000
--- a/modules/reporting/app/assets/stylesheets/reporting/reporting_styles.sass
+++ /dev/null
@@ -1,4 +0,0 @@
-@import _reporting
-@import _reporting_group_by
-@import _reporting_table
-@import _reporting_table_print
diff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rb
index cf5f01ac39d..fce2ffc6a83 100644
--- a/modules/reporting/app/controllers/cost_reports_controller.rb
+++ b/modules/reporting/app/controllers/cost_reports_controller.rb
@@ -71,6 +71,8 @@ class CostReportsController < ApplicationController
attr_accessor :cost_types, :unit_id, :cost_type
+ layout '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/_reporting_header.html.erb b/modules/reporting/app/views/cost_reports/_reporting_header.html.erb
index 8779bcd1012..dd85077c0e0 100644
--- a/modules/reporting/app/views/cost_reports/_reporting_header.html.erb
+++ b/modules/reporting/app/views/cost_reports/_reporting_header.html.erb
@@ -30,5 +30,4 @@ See docs/COPYRIGHT.rdoc for more details.
<% content_for :header_tags do %>
<%= javascript_include_tag "reporting_engine/reporting_engine" %>
<%= javascript_include_tag "reporting/reporting" %>
- <%= stylesheet_link_tag "reporting/reporting_styles", media: 'all' %>
<% end %>
diff --git a/modules/reporting/lib/open_project/reporting/engine.rb b/modules/reporting/lib/open_project/reporting/engine.rb
index d514adc0fe8..924454d8704 100644
--- a/modules/reporting/lib/open_project/reporting/engine.rb
+++ b/modules/reporting/lib/open_project/reporting/engine.rb
@@ -115,8 +115,7 @@ module OpenProject::Reporting
require_dependency 'cost_query/group_by'
end
- assets %w(reporting/reporting_styles.css
- reporting/reporting.js)
+ assets %w(reporting/reporting.js)
patches %i[TimelogController CustomFieldsController OpenProject::Configuration]
patch_with_namespace :BasicData, :RoleSeeder