diff --git a/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.html b/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.html index e6685a09079baeb3ea7ef87d0c6a5ce24bde7abe..d64b09f27803fddbd1f57625a60244a78b5159c1 100644 --- a/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.html +++ b/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.html @@ -67,6 +67,7 @@ (moveChange)="moveDataFile($event)" (downloadFolder)="downloadFolder($event)" (deleteFolder)="deleteFolder($event)" + [canDelete]="(currentObs | async)?.status === depositEnum.INPROGRESS" ></dlcm-deposit-folder-tree> </ng-container> </div> diff --git a/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.ts b/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.ts index c0c89f08ca3dc89157bc294ec1e336a20cd190d6..7e9e888351e1c86daa097ab0149dfee900c3d2ef 100644 --- a/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.ts +++ b/src/app/features/deposit/components/containers/deposit-file/deposit-file.container.ts @@ -490,4 +490,8 @@ export class DepositFileContainer extends SharedAbstractDetailEditRoutable<Depos }), )); } + + get depositEnum(): typeof Deposit.StatusEnum { + return Deposit.StatusEnum; + } } diff --git a/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.html b/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.html index 943adb6af10fbf462590a66ad09ba0e4cb77a6ec..676beff04cbda4b533637dd4a635c2c8a7b14779 100644 --- a/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.html +++ b/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.html @@ -48,7 +48,7 @@ <mat-icon>file_download</mat-icon> </button> - <button *ngIf="currentFolder === node.fullFolderName" + <button *ngIf="currentFolder === node.fullFolderName && canDelete" mat-icon-button mat-button (click)="deleteFolder(node)" @@ -95,7 +95,7 @@ <mat-icon>file_download</mat-icon> </button> - <button *ngIf="currentFolder === node.fullFolderName" + <button *ngIf="currentFolder === node.fullFolderName && canDelete" mat-icon-button mat-button (click)="deleteFolder(node)" diff --git a/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.ts b/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.ts index 1b9fc413637c0a9ff1325dd4ebf4ba237e7b49d3..bbbd1a262a63f1b63876080420565ded0b92ce07 100644 --- a/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.ts +++ b/src/app/features/deposit/components/presentationals/deposit-folder-tree/deposit-folder-tree.presentational.ts @@ -89,6 +89,9 @@ export class DepositFolderTreePresentational extends SharedAbstractPresentationa @Input() expandFirstLevel: boolean; + @Input() + canDelete: boolean = false; + isReady: boolean = false; private _foldersWithIntermediateFolders: string[]; diff --git a/src/app/features/deposit/stores/data-file/deposit-data-file.state.ts b/src/app/features/deposit/stores/data-file/deposit-data-file.state.ts index 03fe341b6559f7d682d9467ff21f3a74242a44b5..ef9f5bcf963d89b3990d8124294d86866efe1f4f 100644 --- a/src/app/features/deposit/stores/data-file/deposit-data-file.state.ts +++ b/src/app/features/deposit/stores/data-file/deposit-data-file.state.ts @@ -1,4 +1,4 @@ -import {HttpClient} from "@angular/common/http"; +import {HttpClient, HttpParams} from "@angular/common/http"; import { Inject, Injectable, @@ -569,12 +569,12 @@ export class DepositDataFileState extends CompositionState<DepositDataFileStateM } @Action(DepositDataFileAction.DeleteFolder) - downloadFolder(ctx: StateContext<DepositStateModel>, action: DepositDataFileAction.DeleteFolder): Observable<string> { + deleteFolder(ctx: StateContext<DepositStateModel>, action: DepositDataFileAction.DeleteFolder): Observable<string> { ctx.patchState({ isLoadingCounter: ctx.getState().isLoadingCounter + 1, }); - return this.apiService.post<string>(`${this._urlResource}/${action.parentId}/${this._resourceName}/${ApiActionEnum.DELETE_FOLDER}`, action.fullFolderName) + return this.apiService.post<string>(`${this._urlResource}/${action.parentId}/${this._resourceName}/${ApiActionEnum.DELETE_FOLDER}?${this.KEY_RELATIVE_LOCATION}=${action.fullFolderName}`) .pipe( tap(result => { ctx.dispatch(new DepositDataFileAction.DeleteFolderSuccess(action));