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
close code review issues & hints; obey new eslint rules https://github.com/opf/openproject/pull/19756#discussion_r2273517650 https://github.com/opf/openproject/pull/19756#discussion_r2273520150
as-opd9f1aa78a4ee
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 3fd91db0fbc..743e5959726 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -1158,6 +1158,8 @@ en:notice_successful_delete: "Successful deletion."notice_successful_update: "Successful update."notice_job_started: "job started."+ no_job_id: "No job ID returned from server."+ invalid_job_response: "Invalid response from server."notice_bad_request: "Bad Request."relations:diff --git a/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts b/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.tsindex 33eab7a81aa..9ade18de952 100644--- a/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts@@ -45,13 +45,14 @@ export default class AsyncJobDialogController extends ApplicationController {e.preventDefault();TurboHelpers.showProgressBar();this.closePreviousDialog();- this.requestJob().then((job_id) => {- if (job_id) {- return this.showJobModal(job_id);- }- return this.handleError('No job ID returned from server.');- })- .catch((error:HttpErrorResponse|string) => this.handleError(error))+ this.requestJob()+ .then((job_id) => {+ if (job_id) {+ return this.showJobModal(job_id);+ }+ return this.handleError(I18n.t('js.no_job_id'));+ })+ .catch((error:HttpErrorResponse) => this.handleError(error)).finally(() => {TurboHelpers.hideProgressBar();});@@ -59,13 +60,11 @@ export default class AsyncJobDialogController extends ApplicationController {}closePreviousDialog() {- if (!this.closeDialogIdValue) {- return; // No dialog ID specified, nothing to close- }- const dialog = document.getElementById(this.closeDialogIdValue) as HTMLDialogElement;- if (dialog) {- dialog.close();- }+ if (!this.closeDialogIdValue) {+ return; // No dialog ID specified, nothing to close+ }+ const dialog = document.getElementById(this.closeDialogIdValue) as HTMLDialogElement;+ dialog?.close();}async requestJob():Promise<string> {@@ -75,11 +74,11 @@ export default class AsyncJobDialogController extends ApplicationController {credentials: 'same-origin',});if (!response.ok) {- throw new Error(`HTTP ${response.status}: ${response.statusText}`);+ throw new Error(`HTTP ${response.status.toString()}: ${response.statusText}`);}const result = await response.json() as { job_id:string };if (!result.job_id) {- throw new Error('Invalid response from server');+ throw new Error(I18n.t('js.invalid_job_response'));}return result.job_id;}@@ -92,11 +91,11 @@ export default class AsyncJobDialogController extends ApplicationController {if (response.ok) {renderStreamMessage(await response.text());} else {- throw new Error(response.statusText || 'Invalid response from server');+ throw new Error(response.statusText ?? I18n.t('js.invalid_job_response'));}}- async handleError(error:HttpErrorResponse|string):Promise<void> {+ handleError(error:HttpErrorResponse | string):void {void window.OpenProject.getPluginContext().then((pluginContext) => {pluginContext.services.notifications.addError(error);});@@ -107,6 +106,6 @@ export default class AsyncJobDialogController extends ApplicationController {}get method() {- return (this.element as HTMLLinkElement).dataset.jobHrefMethod || 'GET';+ return (this.element as HTMLLinkElement).dataset.jobHrefMethod ?? 'GET';}}