diff --git a/src/app/api-connector/applications.service.ts b/src/app/api-connector/applications.service.ts index 7290bcb7aa..bd283a951f 100644 --- a/src/app/api-connector/applications.service.ts +++ b/src/app/api-connector/applications.service.ts @@ -239,6 +239,26 @@ export class ApplicationsService { ); } + withdrawExtensionRequest(request_id: number | string): Observable { + return this.http.post( + `${ApiSettings.getApiBaseURL()}project_applications/lifetime/extensions/${request_id}/withdraw/`, + null, + { + withCredentials: true, + }, + ); + } + + withdrawModificationRequest(request_id: number | string): Observable { + return this.http.post( + `${ApiSettings.getApiBaseURL()}project_applications/modifications/${request_id}/withdraw/`, + null, + { + withCredentials: true, + }, + ); + } + declineAdditionalLifetime(request_id: number | string): Observable { return this.http.post( `${ApiSettings.getApiBaseURL()}project_applications/lifetime/extensions/${request_id}/decline/`, diff --git a/src/app/applications/application.model/application.model.ts b/src/app/applications/application.model/application.model.ts index 85e373535e..c07ce90a99 100644 --- a/src/app/applications/application.model/application.model.ts +++ b/src/app/applications/application.model/application.model.ts @@ -37,6 +37,8 @@ export class Application { project_application_compute_center: ComputecenterComponent; project_application_openstack_project: boolean; project_application_total_gpu: number = 0; + lifetime_extension_request_id: number | string; + modification_extension_request_id: number | string; pi_approval_notification_send: boolean; pi_approval_notification_expired: boolean; diff --git a/src/app/projectmanagement/modals/withdraw/withdraw-modal.component.html b/src/app/projectmanagement/modals/withdraw/withdraw-modal.component.html new file mode 100644 index 0000000000..591662de93 --- /dev/null +++ b/src/app/projectmanagement/modals/withdraw/withdraw-modal.component.html @@ -0,0 +1,64 @@ +
+ + + + +
diff --git a/src/app/projectmanagement/modals/withdraw/withdraw-modal.component.ts b/src/app/projectmanagement/modals/withdraw/withdraw-modal.component.ts new file mode 100644 index 0000000000..ff6ca1edcf --- /dev/null +++ b/src/app/projectmanagement/modals/withdraw/withdraw-modal.component.ts @@ -0,0 +1,46 @@ +import { Component, EventEmitter } from '@angular/core'; +import { BsModalRef } from 'ngx-bootstrap/modal'; + +import { ApplicationsService } from '../../../api-connector/applications.service'; + +export enum WITHDRAWAL_TYPES { + MODIFICATION, + EXTENSION, +} + +@Component({ + selector: 'app-withdrawl-modal', + templateUrl: './withdraw-modal.component.html', + providers: [ApplicationsService], +}) +export class WithdrawModalComponent { + target_id: string | number; + type: WITHDRAWAL_TYPES; + event: EventEmitter = new EventEmitter(); + + constructor( + public bsModalRef: BsModalRef, + private projectService: ApplicationsService, + ) { + // eslint-disable-next-line no-empty-function + } + + withdrawTarget() { + switch (this.type) { + case WITHDRAWAL_TYPES.EXTENSION: + this.projectService.withdrawExtensionRequest(this.target_id).subscribe(() => { + this.bsModalRef.hide(); + this.event.emit(true); + }); + break; + case WITHDRAWAL_TYPES.MODIFICATION: + this.projectService.withdrawModificationRequest(this.target_id).subscribe(() => { + this.bsModalRef.hide(); + this.event.emit(true); + }); + break; + } + } + + protected readonly WITHDRAWAL_TYPES = WITHDRAWAL_TYPES; +} diff --git a/src/app/projectmanagement/overview.component.html b/src/app/projectmanagement/overview.component.html index d9a79dd45c..65b4fe595d 100644 --- a/src/app/projectmanagement/overview.component.html +++ b/src/app/projectmanagement/overview.component.html @@ -308,6 +308,18 @@

+ +