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

remove angular job status modal

as-op1e92544282df
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts
index 81d9f1356ff..f8d39a6f527 100644
--- a/frontend/src/app/app.module.ts
+++ b/frontend/src/app/app.module.ts
@@ -152,7 +152,6 @@ 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';
import { OpenProjectJobStatusModule } from 'core-app/features/job-status/openproject-job-status.module';
import {
NotificationsSettingsPageComponent,
@@ -424,7 +423,6 @@ export class OpenProjectModule implements DoBootstrap {
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 });
registerCustomElement('opce-notification-settings', NotificationsSettingsPageComponent, { injector });
registerCustomElement('opce-reminder-settings', ReminderSettingsPageComponent, { injector });
registerCustomElement('opce-notification-center', InAppNotificationCenterComponent, { injector });
diff --git a/frontend/src/app/core/path-helper/path-helper.service.ts b/frontend/src/app/core/path-helper/path-helper.service.ts
index a24e9fb6ab0..48ba55bed8e 100644
--- a/frontend/src/app/core/path-helper/path-helper.service.ts
+++ b/frontend/src/app/core/path-helper/path-helper.service.ts
@@ -313,4 +313,8 @@ export class PathHelperService {
public textFormattingHelp() {
return `${this.staticBase}/help/text_formatting`;
}
+
+ public jobStatusModalPath(jobId:string) {
+ return `${this.staticBase}/job_statuses/dialog/${jobId}`;
+ }
}
diff --git a/frontend/src/app/core/setup/globals/components/admin/backup.component.ts b/frontend/src/app/core/setup/globals/components/admin/backup.component.ts
index 98107f98594..97822738d4f 100644
--- a/frontend/src/app/core/setup/globals/components/admin/backup.component.ts
+++ b/frontend/src/app/core/setup/globals/components/admin/backup.component.ts
@@ -30,12 +30,11 @@ import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Injector
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
-import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
-import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { OpenProjectBackupService } from 'core-app/core/backup/op-backup.service';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { HalError } from 'core-app/features/hal/services/hal-error';
+import { JobStatusModalService } from 'core-app/features/job-status/job-status-modal.service';
@Component({
selector: 'opce-backup',
@@ -77,8 +76,8 @@ export class BackupComponent implements AfterViewInit {
public injector:Injector,
protected i18n:I18nService,
protected toastService:ToastService,
- protected opModalService:OpModalService,
protected pathHelper:PathHelperService,
+ protected jobStatusModalService:JobStatusModalService,
) {
this.includeAttachments = this.mayIncludeAttachments;
}
@@ -116,7 +115,7 @@ export class BackupComponent implements AfterViewInit {
.subscribe(
(resp:HalResource) => {
this.jobStatusId = resp.jobStatusId as string;
- this.opModalService.show(JobStatusModalComponent, 'global', { jobId: resp.jobStatusId });
+ this.jobStatusModalService.show(resp.jobStatusId);
},
(error:HalError) => {
this.toastService.addError(error.message);
diff --git a/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/bcf-export-button.component.ts b/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/bcf-export-button.component.ts
index c98f6e21d9a..806c05ef9e2 100644
--- a/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/bcf-export-button.component.ts
+++ b/frontend/src/app/features/bim/ifc_models/toolbar/import-export-bcf/bcf-export-button.component.ts
@@ -37,10 +37,9 @@ import { QueryResource } from 'core-app/features/hal/resources/query-resource';
import { UrlParamsHelperService } from 'core-app/features/work-packages/components/wp-query/url-params-helper';
import { StateService } from '@uirouter/core';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
-import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
-import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
+import { JobStatusModalService } from 'core-app/features/job-status/job-status-modal.service';
@Component({
template: `
@@ -69,7 +68,7 @@ export class BcfExportButtonComponent extends UntilDestroyedMixin implements OnI
readonly bcfPathHelper:BcfPathHelperService,
readonly querySpace:IsolatedQuerySpace,
readonly queryUrlParamsHelper:UrlParamsHelperService,
- readonly opModalService:OpModalService,
+ readonly jobStatusModalService:JobStatusModalService,
readonly httpClient:HttpClient,
readonly injector:Injector,
readonly toastService:ToastService,
@@ -106,15 +105,11 @@ export class BcfExportButtonComponent extends UntilDestroyedMixin implements OnI
.httpClient
.get(url, { observe: 'body', responseType: 'json' })
.subscribe(
- (json:{ job_id:string }) => this.showJobModal(json.job_id),
+ (json:{ job_id:string }) => this.jobStatusModalService.show(json.job_id),
(error:HttpErrorResponse) => this.handleError(error),
);
}
- private showJobModal(jobId:string) {
- this.opModalService.show(JobStatusModalComponent, this.injector, { jobId });
- }
-
private handleError(error:HttpErrorResponse) {
this.toastService.addError(error.message || this.I18n.t('js.error.internal'));
}
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
deleted file mode 100644
index 575a3de2aaf..00000000000
--- a/frontend/src/app/features/job-status/display-job-page/display-job-page.component.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-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 {
- @Input() jobId:string;
-
- constructor(
- readonly elementRef:ElementRef,
- readonly modalService:OpModalService,
- ) {
- populateInputsFromDataset(this);
- }
-
- ngAfterViewInit() {
- this.modalService.show(JobStatusModalComponent, 'global', { jobId: this.jobId })
- .subscribe((modal) => modal
- .closingEvent
- .pipe(
- take(1),
- ).subscribe(() => {
- // Go back in history
- window.history.back();
- }));
- }
-
- ngOnDestroy() {
- this.modalService.close();
- }
-}
diff --git a/frontend/src/app/features/job-status/job-status-modal.service.ts b/frontend/src/app/features/job-status/job-status-modal.service.ts
new file mode 100644
index 00000000000..b5a22ac57b3
--- /dev/null
+++ b/frontend/src/app/features/job-status/job-status-modal.service.ts
@@ -0,0 +1,19 @@
+import { Injectable } from '@angular/core';
+import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';
+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
+
+@Injectable({ providedIn: 'root' })
+export class JobStatusModalService {
+ constructor(
+ protected pathHelper:PathHelperService,
+ protected turboRequests:TurboRequestsService,
+ ) {}
+
+ public show(jobId:string):void {
+ void this.turboRequests.requestStream(this.jobModalUrl(jobId));
+ }
+
+ private jobModalUrl(jobId:string):string {
+ return this.pathHelper.jobStatusModalPath(jobId);
+ }
+}
diff --git a/frontend/src/app/features/job-status/job-status-modal/job-status.modal.html b/frontend/src/app/features/job-status/job-status-modal/job-status.modal.html
deleted file mode 100644
index e05fc3f658e..00000000000
--- a/frontend/src/app/features/job-status/job-status-modal/job-status.modal.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<div
- class="spot-modal job-status--modal"
->
- <div
- id="spotModalTitle"
- class="spot-modal--header"
- data-test-selector="job-status--header"
- >{{ title }}</div>
-
- <div class="spot-divider"></div>
-
- <div class="spot-modal--body spot-container">
- <div class="loading-indicator--location"
- data-indicator-name="modal">
- <div class="status-icon-wrapper" *ngIf="!isLoading && statusIcon">
- <span [ngClass]="statusIcon" class="icon-big"></span>
- </div>
- </div>
- <div>
- <span class="job-status--modal-main-message" [textContent]="message"></span>
- <span [hidden]="!downloadHref">
- {{ text.download_starts }}
- <a
- #downloadLink
- download
- target="_blank"
- [textContent]="text.click_to_download"
- [attr.href]="downloadHref"
- ></a>
- </span>
- <ng-container *ngIf="htmlContent">
- <div
- class="job-status--modal-additional-content"
- [innerHTML]="htmlContent"
- ></div>
- </ng-container>
- <ng-container *ngIf="payload?.errors">
- <h3 class="job-status--modal-additional-errors" [textContent]="text.errors"></h3>
- <ul *ngFor="let error of payload.errors">
- <li [textContent]="error"></li>
- </ul>
-
- <p *ngIf="payload?.redirect">
- <span [textContent]="text.redirect_errors"></span>
- <a [textContent]="text.redirect_link"
- [attr.href]="payload.redirect">
- </a>
- </p>
- </ng-container>
- </div>
- </div>
-</div>
diff --git a/frontend/src/app/features/job-status/job-status-modal/job-status.modal.sass b/frontend/src/app/features/job-status/job-status-modal/job-status.modal.sass
deleted file mode 100644
index 5642b24528f..00000000000
--- a/frontend/src/app/features/job-status/job-status-modal/job-status.modal.sass
+++ /dev/null
@@ -1,26 +0,0 @@
-@import '../../global_styles/openproject/variables'
-
-.job-status--modal
- min-height: 350px
- min-width: 450px
- overflow-y: scroll
-
- @media screen and (max-width: $breakpoint-sm)
- min-width: 200px
-
-.loading-indicator--location
- height: 220px
-
-.status-icon-wrapper
- display: flex
- height: 100%
- align-items: center
- justify-content: center
-
-.job-status--modal-main-message
- font-weight: var(--base-text-weight-bold)
- display: flex
- justify-content: center
-
-.job-status--modal-additional-errors
- margin-top: 2rem
diff --git a/frontend/src/app/features/job-status/job-status-modal/job-status.modal.ts b/frontend/src/app/features/job-status/job-status-modal/job-status.modal.ts
deleted file mode 100644
index e68370bfcc4..00000000000
--- a/frontend/src/app/features/job-status/job-status-modal/job-status.modal.ts
+++ /dev/null
@@ -1,219 +0,0 @@
-import {
- ChangeDetectionStrategy,
- ChangeDetectorRef,
- Component,
- ElementRef,
- Inject,
- OnInit,
- ViewChild,
-} from '@angular/core';
-import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';
-import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';
-import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { HttpClient, HttpErrorResponse, HttpResponse } from '@angular/common/http';
-import { Observable, retry, timer } from 'rxjs';
-import { switchMap, takeWhile } from 'rxjs/operators';
-import { LoadingIndicatorService } from 'core-app/core/loading-indicator/loading-indicator.service';
-import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
-import { JobStatusEnum, JobStatusInterface } from 'core-app/features/job-status/job-status.interface';
-import { ToastService } from 'core-app/shared/components/toaster/toast.service';
-import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
-
-@Component({
- templateUrl: './job-status.modal.html',
- styleUrls: ['./job-status.modal.sass'],
- changeDetection: ChangeDetectionStrategy.OnPush,
-})
-export class JobStatusModalComponent extends OpModalComponent implements OnInit {
- public text = {
- title: this.I18n.t('js.job_status.title'),
- closePopup: this.I18n.t('js.close_popup_title'),
- redirect: this.I18n.t('js.job_status.redirect'),
- redirect_errors: `${this.I18n.t('js.job_status.redirect_errors')} `,
- redirect_link: this.I18n.t('js.job_status.redirect_link'),
- errors: this.I18n.t('js.job_status.errors'),
- download_starts: this.I18n.t('js.job_status.download_starts'),
- click_to_download: this.I18n.t('js.job_status.click_to_download'),
- };
-
- /** The job ID reference */
- public jobId:string;
-
- /** Whether to show the loading indicator */
- public isLoading = false;
-
- /** The current status */
- public status:JobStatusEnum;
-
- /** An associated icon to render, if any */
- public statusIcon:string|null;
-
- /** Public message to show */
- public message:string;
-
- /** Payload object of the response */
- public payload:any;
-
- /** Title to show */
- public title:string = this.text.title;
-
- /** Additional html to render */
- public htmlContent:SafeHtml|null = null;
-
- /** A link in case the job results in a download */
- public downloadHref:string|null = null;
-
- @ViewChild('downloadLink') private downloadLink:ElementRef<HTMLInputElement>;
-
- constructor(
- @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
- readonly cdRef:ChangeDetectorRef,
- readonly I18n:I18nService,
- readonly elementRef:ElementRef,
- readonly pathHelper:PathHelperService,
- readonly apiV3Service:ApiV3Service,
- readonly loadingIndicator:LoadingIndicatorService,
- readonly toastService:ToastService,
- readonly sanitization:DomSanitizer,
- readonly httpClient:HttpClient,
- ) {
- super(locals, cdRef, elementRef);
-
- this.jobId = locals.jobId as string;
- }
-
- ngOnInit() {
- super.ngOnInit();
- this.listenOnJobStatus();
- }
-
- private listenOnJobStatus() {
- this.loadingIndicator.indicator('modal').start();
- timer(0, 2000)
- .pipe(
- switchMap(() => this.performRequest()),
- retry({
- count: 10,
- delay: (error:HttpErrorResponse) => {
- // Example for catching specific error code as well
- if ([502, 503, 504].includes(error.status)) {
- return timer(2000);
- }
-
- // eslint-disable-next-line @typescript-eslint/no-throw-literal
- throw error;
- },
- }),
- takeWhile((response) => !!response.body && this.continuedStatus(response.body), true),
- this.untilDestroyed(),
- )
- .subscribe({
- next: (response) => this.onResponse(response),
- error: (error:HttpErrorResponse) => this.handleError(error),
- complete: () => {
- this.loadingIndicator.indicator('modal').stop();
- this.isLoading = false;
- },
- });
- }
-
- private iconForStatus():string|null {
- switch (this.status) {
- case 'cancelled':
- case 'failure':
- case 'error':
- return 'icon-error';
- break;
- case 'success':
- return 'icon-checkmark';
- break;
- default:
- return null;
- }
- }
-
- /**
- * Determine whether the given status continues the timer
- * @param response
- */
- private continuedStatus(response:JobStatusInterface) {
- return ['in_queue', 'in_process'].includes(response.status);
- }
-
- private onResponse(response:HttpResponse<JobStatusInterface>) {
- const { body } = response;
-
- if (!body) {
- throw new Error(response?.statusText || 'Internal Error');
- }
-
- // eslint-disable-next-line no-multi-assign
- const status = this.status = body.status;
-
- this.message = body.message
- || this.I18n.t(`js.job_status.generic_messages.${status}`, { defaultValue: status });
-
- this.payload = body.payload;
- if (body.payload) {
- this.title = body.payload.title || this.text.title;
- this.handleRedirect(body.payload);
- this.handleDownload(body.payload?.download);
- this.handleHTML(body.payload?.html);
- }
-
- this.statusIcon = this.iconForStatus();
- this.cdRef.detectChanges();
- }
-
- private handleHTML(content?:string) {
- if (content) {
- this.htmlContent = this.sanitization.bypassSecurityTrustHtml(content);
- }
- }
-
- private handleRedirect(payload:JobStatusInterface['payload']) {
- if (payload?.redirect && !payload?.errors) {
- setTimeout(() => { window.location.href = payload.redirect as string; }, 2000);
- this.message += `. ${this.text.redirect}`;
- }
- }
-
- private handleDownload(downloadUrl?:string) {
- if (!downloadUrl) {
- return;
- }
-
- this.downloadHref = downloadUrl;
- this.cdRef.detectChanges();
- setTimeout(() => this.downloadLink.nativeElement.click(), 50);
- }
-
- private performRequest():Observable<HttpResponse<JobStatusInterface>> {
- return this
- .httpClient
- .get<JobStatusInterface>(
- this.jobUrl,
- { observe: 'response', responseType: 'json' },
- );
- }
-
- private handleError(error:HttpErrorResponse) {
- this.loadingIndicator.indicator('modal').stop();
- if (error?.status === 404) {
- this.statusIcon = 'icon-help';
- this.message = this.I18n.t('js.job_status.generic_messages.not_found');
- } else {
- this.statusIcon = 'icon-error';
- this.message = error?.message || this.I18n.t('js.error.internal');
- this.toastService.addError(this.message);
- }
-
- this.cdRef.detectChanges();
- }
-
- private get jobUrl():string {
- return this.apiV3Service.job_statuses.id(this.jobId).toString();
- }
-}
diff --git a/frontend/src/app/features/job-status/job-status.interface.ts b/frontend/src/app/features/job-status/job-status.interface.ts
deleted file mode 100644
index 3fed2787753..00000000000
--- a/frontend/src/app/features/job-status/job-status.interface.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-export type JobStatusEnum = 'in_queue'|'error'|'in_process'|'success'|'failure'|'cancelled';
-
-export interface JobStatusInterface {
- /**
- * Status
- */
- status:JobStatusEnum;
-
- /**
- * The job id
- */
- jobId:string;
-
- /**
- * Message for the current status, if any
- */
- message?:string;
-
- /**
- * Additional payload object
- */
- payload?:{
- title?:string;
- download?:string;
- redirect?:string;
- errors?:string;
- html?:string;
- };
-}
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 e510ec1cd2c..5092e85018d 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
@@ -28,21 +28,17 @@
import { NgModule } from '@angular/core';
import { OpSharedModule } from 'core-app/shared/shared.module';
-import { OpenprojectModalModule } from 'core-app/shared/components/modal/modal.module';
-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';
import { CommonModule } from '@angular/common';
+import { JobStatusModalService } from 'core-app/features/job-status/job-status-modal.service';
@NgModule({
imports: [
// Commons
CommonModule,
OpSharedModule,
- OpenprojectModalModule,
],
- declarations: [
- DisplayJobPageComponent,
- JobStatusModalComponent,
+ providers: [
+ JobStatusModalService,
],
})
export class OpenProjectJobStatusModule {
diff --git a/frontend/src/app/features/projects/components/copy-project/copy-project.component.ts b/frontend/src/app/features/projects/components/copy-project/copy-project.component.ts
index 7ab06402a42..59dfd6daa73 100644
--- a/frontend/src/app/features/projects/components/copy-project/copy-project.component.ts
+++ b/frontend/src/app/features/projects/components/copy-project/copy-project.component.ts
@@ -3,14 +3,13 @@ import {
IOPFormlyFieldSettings,
IOPFormlyTemplateOptions,
} from 'core-app/shared/components/dynamic-forms/typings';
-import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';
-import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import { Component, OnInit } from '@angular/core';
+import { JobStatusModalService } from 'core-app/features/job-status/job-status-modal.service';
@Component({
@@ -38,7 +37,7 @@ export class CopyProjectComponent extends UntilDestroyedMixin implements OnInit
private apiV3Service:ApiV3Service,
private currentProjectService:CurrentProjectService,
private pathHelperService:PathHelperService,
- private modalService:OpModalService,
+ private jobStatusModalService:JobStatusModalService,
private I18n:I18nService,
) {
super();
@@ -59,7 +58,7 @@ export class CopyProjectComponent extends UntilDestroyedMixin implements OnInit
}
onSubmitted(response:HalSource) {
- this.modalService.show(JobStatusModalComponent, 'global', { jobId: response.jobId });
+ this.jobStatusModalService.show(response.jobId);
}
private isHiddenField(key:string|undefined):boolean {
diff --git a/frontend/src/app/features/projects/components/new-project/new-project.component.ts b/frontend/src/app/features/projects/components/new-project/new-project.component.ts
index 9a20b67bb14..c4c0b6f3b1c 100644
--- a/frontend/src/app/features/projects/components/new-project/new-project.component.ts
+++ b/frontend/src/app/features/projects/components/new-project/new-project.component.ts
@@ -6,14 +6,13 @@ import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { map } from 'rxjs/operators';
import { Observable } from 'rxjs';
-import { JobStatusModalComponent } from 'core-app/features/job-status/job-status-modal/job-status.modal';
-import { OpModalService } from 'core-app/shared/components/modal/modal.service';
import {
DynamicFormComponent,
} from 'core-app/shared/components/dynamic-forms/components/dynamic-form/dynamic-form.component';
import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';
import { ApiV3FilterBuilder } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
+import { JobStatusModalService } from 'core-app/features/job-status/job-status-modal.service';
export interface ProjectTemplateOption {
href:string|null;
@@ -78,7 +77,7 @@ export class NewProjectComponent extends UntilDestroyedMixin implements OnInit {
constructor(
private apiV3Service:ApiV3Service,
private pathHelperService:PathHelperService,
- private modalService:OpModalService,
+ private jobStatusModalService:JobStatusModalService,
private I18n:I18nService,
) {
super();
@@ -108,7 +107,7 @@ export class NewProjectComponent extends UntilDestroyedMixin implements OnInit {
onSubmitted(response:HalSource) {
if (response._type === 'JobStatus') {
- this.modalService.show(JobStatusModalComponent, 'global', { jobId: response.jobId });
+ this.jobStatusModalService.show(response.jobId);
} else {
window.location.href = this.pathHelperService.projectPath(response.identifier as string);
}
diff --git a/modules/job_status/app/views/job_statuses/show.html.erb b/modules/job_status/app/views/job_statuses/show.html.erb
index fa463aef986..b36d20105fb 100644
--- a/modules/job_status/app/views/job_statuses/show.html.erb
+++ b/modules/job_status/app/views/job_statuses/show.html.erb
@@ -27,5 +27,6 @@ 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] } %>
+<%= turbo_stream.dialog do %>
+<%= render ::JobStatus::Dialog::DialogComponent.new(job_uuid: params[:job_uuid], back_on_close: true) %>
+<% end %>
diff --git a/modules/job_status/spec/features/job_status_spec.rb b/modules/job_status/spec/features/job_status_spec.rb
index 60d82d756a4..f427d84d344 100644
--- a/modules/job_status/spec/features/job_status_spec.rb
+++ b/modules/job_status/spec/features/job_status_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe "Job status", :js do
it "renders a descriptive error in case of 404" do
visit "/job_statuses/something-that-does-not-exist"
- expect(page).to have_css(".icon-big.icon-help", wait: 10)
+ expect(page).to have_css(".octicon-alert", wait: 10)
expect(page).to have_content I18n.t("js.job_status.generic_messages.not_found")
end
@@ -52,9 +52,24 @@ RSpec.describe "Job status", :js do
it "shows a list of these errors" do
visit "/job_statuses/#{status.job_id}"
- expect(page).to have_css(".job-status--modal-additional-errors", text: "Some errors have occurred", wait: 10)
- expect(page).to have_css("ul li", text: "Some error")
- expect(page).to have_css("ul li", text: "Another error")
+ expect(page).to have_css(".octicon-x-circle", wait: 10)
+ expect(page).to have_content I18n.t("js.job_status.errors")
+ expect(page).to have_content "Some error"
+ expect(page).to have_content "Another error"
+ end
+ end
+
+ describe "with a status without error and redirect" do
+ let!(:status) { create(:delayed_job_status, user: admin) }
+
+ before do
+ status.update! payload: { redirect: home_url }
+ end
+
+ it "does automatically redirect" do
+ visit "/job_statuses/#{status.job_id}"
+
+ expect(page).to have_current_path(home_path, wait: 10)
end
end
@@ -68,8 +83,9 @@ RSpec.describe "Job status", :js do
it "does not automatically redirect" do
visit "/job_statuses/#{status.job_id}"
- expect(page).to have_css(".job-status--modal-additional-errors", text: "Some errors have occurred", wait: 10)
- expect(page).to have_css("ul li", text: "Some error")
+ expect(page).to have_css(".octicon-x-circle", wait: 10)
+ expect(page).to have_content I18n.t("js.job_status.errors")
+ expect(page).to have_content "Some error"
expect(page).to have_css("a[href='#{home_url}']", text: "Please click here to continue")
end
end