Skip to content

Commit

Permalink
remove angular job status modal
Browse files Browse the repository at this point in the history
  • Loading branch information
as-op committed Aug 20, 2024
1 parent 580350f commit 1e92544
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 399 deletions.
2 changes: 0 additions & 2 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 });
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/app/core/path-helper/path-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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'));
}
Expand Down

This file was deleted.

19 changes: 19 additions & 0 deletions frontend/src/app/features/job-status/job-status-modal.service.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1e92544

Please sign in to comment.