From ef0ef6f0acc597d6405e86cb97b117752f2c0853 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Mon, 9 Nov 2020 22:57:41 +0200 Subject: [PATCH] fixed various issues --- .../file-actions/file-actions.component.html | 2 +- .../file-actions/file-actions.component.ts | 7 +- .../app/common/service/permissions.service.ts | 24 ++-- .../annotation-actions.component.html | 76 +++++++------ .../annotation-actions.component.ts | 14 +-- .../file-preview-screen.component.html | 3 +- .../file-preview-screen.component.ts | 6 +- .../screens/file/model/annotation.wrapper.ts | 107 ++++++++---------- .../app/screens/file/model/file-data.model.ts | 18 ++- .../project-overview-screen.component.html | 2 +- .../project-overview-screen.component.ts | 9 +- apps/red-ui/src/assets/i18n/en.json | 18 +++ .../src/assets/styles/red-tooltips.scss | 4 + 13 files changed, 159 insertions(+), 131 deletions(-) diff --git a/apps/red-ui/src/app/common/file-actions/file-actions.component.html b/apps/red-ui/src/app/common/file-actions/file-actions.component.html index 926aec0c3..f8b498aa1 100644 --- a/apps/red-ui/src/app/common/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/common/file-actions/file-actions.component.html @@ -26,7 +26,7 @@ mat-icon-button #reanalyseTooltip="matTooltip" [matTooltip]="'file-preview.reanalyse-notification' | translate" - matTooltipClass="warn" + matTooltipClass="warn small" > diff --git a/apps/red-ui/src/app/common/file-actions/file-actions.component.ts b/apps/red-ui/src/app/common/file-actions/file-actions.component.ts index 985c79cc7..db24c4e4f 100644 --- a/apps/red-ui/src/app/common/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/common/file-actions/file-actions.component.ts @@ -86,9 +86,10 @@ export class FileActionsComponent implements OnInit, AfterViewInit { setFileUnderReview($event: MouseEvent, fileStatus: FileStatusWrapper) { $event.stopPropagation(); - this._fileActionService.setFileUnderReview(fileStatus).subscribe(() => { - this.reloadProjects('set-review'); - }); + // this._fileActionService.setFileUnderReview(fileStatus).subscribe(() => { + // this.reloadProjects('set-review'); + // }); + this._fileActionService.assignProjectReviewer(fileStatus, () => this.actionPerformed.emit('assign-reviewer')); } reloadProjects(action: string) { diff --git a/apps/red-ui/src/app/common/service/permissions.service.ts b/apps/red-ui/src/app/common/service/permissions.service.ts index 13208cbbf..85fece71a 100644 --- a/apps/red-ui/src/app/common/service/permissions.service.ts +++ b/apps/red-ui/src/app/common/service/permissions.service.ts @@ -71,14 +71,14 @@ export class PermissionsService { if (!fileStatus) { fileStatus = this._appStateService.activeFile; } - return fileStatus.status === 'UNDER_APPROVAL'; + return fileStatus.status === 'UNDER_APPROVAL' && this.isManagerAndOwner(); } canSetUnderApproval(fileStatus?: FileStatusWrapper) { if (!fileStatus) { fileStatus = this._appStateService.activeFile; } - return fileStatus.status === 'UNDER_REVIEW'; + return fileStatus.status === 'UNDER_REVIEW' && this.isReviewerOrOwner(fileStatus); } isManagerAndOwner(project?: Project, user?: UserWrapper) { @@ -112,7 +112,7 @@ export class PermissionsService { if (!fileStatus) { fileStatus = this._appStateService.activeFile; } - return !fileStatus.isError && !fileStatus.isProcessing && this.isReviewerOrOwner(fileStatus); + return !fileStatus.isError && !fileStatus.isProcessing; //&& this.isReviewerOrOwner(fileStatus); } canShowRedactionReportDownloadBtn(fileStatus?: FileStatusWrapper) { @@ -123,7 +123,12 @@ export class PermissionsService { if (!fileStatus) { fileStatus = this._appStateService.activeFile; } - return this.isProjectMember() && !fileStatus.isError && !fileStatus.isApprovedOrUnderApproval; + return ( + this.isProjectMember() && + !fileStatus.isError && + !fileStatus.isApprovedOrUnderApproval && + (this.isManagerAndOwner() || !this.isFileReviewer(fileStatus)) + ); } canUndoApproval(fileStatus: FileStatusWrapper) { @@ -137,10 +142,15 @@ export class PermissionsService { if (!fileStatus) { fileStatus = this._appStateService.activeFile; } - return fileStatus.status === 'UNDER_APPROVAL' && this.isManagerAndOwner(); + return fileStatus.status === 'UNDER_APPROVAL' && this.isProjectMember(); } - canMarkPagesAsViewed() { - return this.isReviewerOrOwner(); + canMarkPagesAsViewed(fileStatus?: FileStatusWrapper) { + if (!fileStatus) { + fileStatus = this._appStateService.activeFile; + } + return ( + (fileStatus.status === 'UNDER_REVIEW' && this.isFileReviewer(fileStatus)) || (fileStatus.status === 'UNDER_APPROVAL' && this.isManagerAndOwner()) + ); } } diff --git a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html index c622f2a65..c59dd9e70 100644 --- a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.html @@ -1,56 +1,62 @@ -
+
- -
- -
-
-
- -
-
+ + +
+ +
+
+
+ +
+
+
+ +
+ +
+
+
+ +
+
+
- + +