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 ui-router in job status

Oliver Güntherd0d9522da2d2
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 3688b618b47..d88700df3a1 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -155,6 +155,7 @@ import { OpExclusionInfoComponent } from 'core-app/shared/components/fields/disp
import { NewProjectComponent } from 'core-app/features/projects/components/new-project/new-project.component';
import { CopyProjectComponent } from 'core-app/features/projects/components/copy-project/copy-project.component';
import { ProjectsComponent } from 'core-app/features/projects/components/projects/projects.component';
+import { DisplayJobPageComponent } from 'core-app/features/job-status/display-job-page/display-job-page.component';
export function initializeServices(injector:Injector) {
return () => {
@@ -342,5 +343,6 @@ export class OpenProjectModule {
registerCustomElement('opce-new-project', NewProjectComponent, { injector });
registerCustomElement('opce-project-settings', ProjectsComponent, { injector });
registerCustomElement('opce-copy-project', CopyProjectComponent, { injector });
+ registerCustomElement('opce-display-job-status-page', DisplayJobPageComponent, { injector });
}
}
diff --git a/frontend/src/app/core/routing/openproject.routes.ts b/frontend/src/app/core/routing/openproject.routes.ts
index 3d2ab62f159..bcad9a59e68 100644
--- a/frontend/src/app/core/routing/openproject.routes.ts
+++ b/frontend/src/app/core/routing/openproject.routes.ts
@@ -100,12 +100,6 @@ export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [
url: '/cost_reports',
loadChildren: () => import('../../features/reporting/openproject-reporting.module').then((m) => m.OpenprojectReportingModule),
},
- {
- name: 'job-statuses.**',
- parent: 'optional_project',
- url: '/job_statuses',
- loadChildren: () => import('../../features/job-status/openproject-job-status.module').then((m) => m.OpenProjectJobStatusModule),
- },
...MY_ACCOUNT_LAZY_ROUTES,
...IAN_LAZY_ROUTES,
...TEAM_PLANNER_LAZY_ROUTES,
diff --git a/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts b/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts
index 795838f5410..575a3de2aaf 100644
--- a/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts
+++ b/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts
@@ -1,21 +1,25 @@
-import {
- AfterViewInit, Component, OnDestroy,
-} from '@angular/core';
-import { StateService } from '@uirouter/core';
+import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnDestroy } from '@angular/core';
import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
import { take } from 'rxjs/operators';
+import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
@Component({
template: '',
+ changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DisplayJobPageComponent implements AfterViewInit, OnDestroy {
- constructor(private $state:StateService,
- private modalService:OpModalService) {
+ @Input() jobId:string;
+
+ constructor(
+ readonly elementRef:ElementRef,
+ readonly modalService:OpModalService,
+ ) {
+ populateInputsFromDataset(this);
}
ngAfterViewInit() {
- this.modalService.show(JobStatusModalComponent, 'global', { jobId: this.$state.params.jobId })
+ this.modalService.show(JobStatusModalComponent, 'global', { jobId: this.jobId })
.subscribe((modal) => modal
.closingEvent
.pipe(
diff --git a/frontend/src/app/features/job-status/openproject-job-status.module.ts b/frontend/src/app/features/job-status/openproject-job-status.module.ts
index b88508a7410..3b9ec7a7f22 100644
--- a/frontend/src/app/features/job-status/openproject-job-status.module.ts
+++ b/frontend/src/app/features/job-status/openproject-job-status.module.ts
@@ -29,31 +29,14 @@
import { NgModule } from '@angular/core';
import { OpSharedModule } from 'core-app/shared/shared.module';
import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';
-import { Ng2StateDeclaration, UIRouterModule } from '@uirouter/angular';
import { DisplayJobPageComponent } from 'core-app/features/job-status/display-job-page/display-job-page.component';
import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
-export const JOB_STATUS_ROUTE:Ng2StateDeclaration[] = [
- {
- name: 'job-statuses',
- url: '/job_statuses/{jobId:[a-z0-9-]+}',
- parent: 'optional_project',
- component: DisplayJobPageComponent,
- data: {
- bodyClasses: 'router--job-statuses',
- },
- },
-];
-
@NgModule({
imports: [
// Commons
OpSharedModule,
OpenprojectModalModule,
-
- // Routes for /job_statuses/:uuid
- UIRouterModule.forChild({ states: JOB_STATUS_ROUTE }),
-
],
declarations: [
DisplayJobPageComponent,
diff --git a/modules/job_status/app/controllers/job_statuses_controller.rb b/modules/job_status/app/controllers/job_statuses_controller.rb
new file mode 100644
index 00000000000..0771780248e
--- /dev/null
+++ b/modules/job_status/app/controllers/job_statuses_controller.rb
@@ -0,0 +1,35 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 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.
+#++
+
+class JobStatusesController < ApplicationController
+ no_authorization_required! :show
+
+ def show
+ render layout: "angular/angular"
+ end
+end
diff --git a/modules/job_status/app/views/job_statuses/show.html.erb b/modules/job_status/app/views/job_statuses/show.html.erb
new file mode 100644
index 00000000000..87fde4db35d
--- /dev/null
+++ b/modules/job_status/app/views/job_statuses/show.html.erb
@@ -0,0 +1,31 @@
+<%#-- copyright
+OpenProject is an open source project management software.
+Copyright (C) 2012-2024 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.
+
+++#%>
+<% html_title t("js.job_status.title") -%>
+
+<%= angular_component_tag "opce-display-job-status-page", inputs: { jobId: params[:job_uuid] } %>
diff --git a/modules/job_status/config/locales/en.yml b/modules/job_status/config/locales/en.yml
index 804da1c8f00..504ea233007 100644
--- a/modules/job_status/config/locales/en.yml
+++ b/modules/job_status/config/locales/en.yml
@@ -1,4 +1,5 @@
en:
+ label_job_status_plural: "Job statuses"
plugin_openproject_job_status:
name: "OpenProject Job status"
description: "Listing and status of background jobs."
diff --git a/modules/job_status/config/routes.rb b/modules/job_status/config/routes.rb
index a28cc2a1421..82a5ae26a72 100644
--- a/modules/job_status/config/routes.rb
+++ b/modules/job_status/config/routes.rb
@@ -1,5 +1,5 @@
Rails.application.routes.draw do
get "/job_statuses/:job_uuid",
- to: "angular#empty_layout",
+ to: "job_statuses#show",
as: "job_status"
end