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

obey eslint

as-opfdd06d920805
diff --git a/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts b/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts
index 9ade18de952..c36ec66ab75 100644
--- a/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/job-dialog.controller.ts
@@ -50,9 +50,12 @@ export default class AsyncJobDialogController extends ApplicationController {
if (job_id) {
return this.showJobModal(job_id);
}
- return this.handleError(I18n.t('js.no_job_id'));
+ this.handleError(I18n.t('js.no_job_id'));
+ return null;
+ })
+ .catch((error:unknown) => {
+ this.handleError(error);
})
- .catch((error:HttpErrorResponse) => this.handleError(error))
.finally(() => {
TurboHelpers.hideProgressBar();
});
@@ -63,7 +66,7 @@ export default class AsyncJobDialogController extends ApplicationController {
if (!this.closeDialogIdValue) {
return; // No dialog ID specified, nothing to close
}
- const dialog = document.getElementById(this.closeDialogIdValue) as HTMLDialogElement;
+ const dialog = document.getElementById(this.closeDialogIdValue) as HTMLDialogElement | undefined;
dialog?.close();
}
@@ -91,13 +94,13 @@ export default class AsyncJobDialogController extends ApplicationController {
if (response.ok) {
renderStreamMessage(await response.text());
} else {
- throw new Error(response.statusText ?? I18n.t('js.invalid_job_response'));
+ throw new Error(response.statusText);
}
}
- handleError(error:HttpErrorResponse | string):void {
+ handleError(error:unknown):void {
void window.OpenProject.getPluginContext().then((pluginContext) => {
- pluginContext.services.notifications.addError(error);
+ pluginContext.services.notifications.addError(error as string | HttpErrorResponse);
});
}