From 10d18e2ac4a06a96974696cf4d9ea9c696f51f7d Mon Sep 17 00:00:00 2001 From: Alex ORLUC <alex.orluc@maarch.org> Date: Fri, 8 Nov 2019 17:51:06 +0100 Subject: [PATCH] FEAT #12091 TIME 0:10 fix lock mode + available role diff list --- src/frontend/app/actions/actions-list.component.ts | 2 +- src/frontend/app/actions/actions.service.ts | 8 +++++--- .../app/diffusions/diffusions-list.component.html | 2 +- src/frontend/app/process/process.component.ts | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/frontend/app/actions/actions-list.component.ts b/src/frontend/app/actions/actions-list.component.ts index 7100b1fbb73..6f63c0bf98b 100644 --- a/src/frontend/app/actions/actions-list.component.ts +++ b/src/frontend/app/actions/actions-list.component.ts @@ -92,7 +92,7 @@ export class ActionsListComponent implements OnInit { this.currentResource = row; } - this.actionService.launchAction(action, this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId, this.selectedRes, this.currentResource); + this.actionService.launchAction(action, this.currentBasketInfo.ownerId, this.currentBasketInfo.groupId, this.currentBasketInfo.basketId, this.selectedRes, this.currentResource, true); } diff --git a/src/frontend/app/actions/actions.service.ts b/src/frontend/app/actions/actions.service.ts index 8cdfc55ba1c..d44cb82213b 100644 --- a/src/frontend/app/actions/actions.service.ts +++ b/src/frontend/app/actions/actions.service.ts @@ -29,6 +29,7 @@ export class ActionsService { mode: string = 'indexing'; currentResourceLock: any = null; + lockMode: boolean = true; currentAction: any = null; currentUserId: number = null; @@ -116,11 +117,12 @@ export class ActionsService { } - launchAction(action: any, userId: number, groupId: number, basketId: number, resIds: number[], datas: any) { + launchAction(action: any, userId: number, groupId: number, basketId: number, resIds: number[], datas: any, lockRes: boolean = true) { if (this.setActionInformations(action, userId, groupId, basketId, resIds)) { this.loading = true; + this.lockMode = lockRes; this.setResourceInformations(datas); - if (this.mode !== 'process') { + if (this.lockMode) { this.http.put(`../../rest/resourcesList/users/${userId}/groups/${groupId}/baskets/${basketId}/lock`, { resources: resIds }).pipe( tap((data: any) => { if (this.canExecuteAction(data.lockedResources, data.lockers, resIds)) { @@ -216,7 +218,7 @@ export class ActionsService { unlockResourceAfterActionModal(state: string) { this.stopRefreshResourceLock(); - if (state !== 'success' && this.mode !== 'process') { + if (state !== 'success' && this.lockMode) { this.unlockResource(); } } diff --git a/src/frontend/app/diffusions/diffusions-list.component.html b/src/frontend/app/diffusions/diffusions-list.component.html index 59d12a38a4e..1e5cea1bfb0 100644 --- a/src/frontend/app/diffusions/diffusions-list.component.html +++ b/src/frontend/app/diffusions/diffusions-list.component.html @@ -41,7 +41,7 @@ class="fa fa-chevron-down"></i></button> <mat-menu #menu="matMenu" [class]="'roleListMenu'"> <ng-container *ngFor="let selectRole of availableRoles"> - <button mat-menu-item *ngIf="selectRole.canUpdate || (selectRole.id !== 'dest' && target === 'redirect')" + <button mat-menu-item *ngIf="(selectRole.canUpdate && target !== 'redirect') || (selectRole.id !== 'dest' && target === 'redirect' && selectRole.canUpdate)" (click)="changeRole(diffusion,role,selectRole)" style="font-size:13px;">{{selectRole.label}}</button> </ng-container> diff --git a/src/frontend/app/process/process.component.ts b/src/frontend/app/process/process.component.ts index b7f8127621a..56f56946461 100644 --- a/src/frontend/app/process/process.component.ts +++ b/src/frontend/app/process/process.component.ts @@ -231,7 +231,7 @@ export class ProcessComponent implements OnInit { } onSubmit() { - this.actionService.launchAction(this.selectedAction, this.currentUserId, this.currentGroupId, this.currentBasketId, [this.currentResourceInformations.resId], this.currentResourceInformations); + this.actionService.launchAction(this.selectedAction, this.currentUserId, this.currentGroupId, this.currentBasketId, [this.currentResourceInformations.resId], this.currentResourceInformations, false); } showActionInCurrentCategory(action: any) { -- GitLab