From 8e044a9128c66f3031fc1deed2bab69505e8f6b4 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 6 Apr 2021 14:11:24 +0300 Subject: [PATCH 1/4] exclude files from redaction --- .../disabled-for-redaction.component.scss | 34 +++++++++++++++++++ .../disabled-for-redaction.component.ts | 12 +++++++ .../file-actions/file-actions.component.html | 10 ++++++ .../file-actions/file-actions.component.scss | 6 ++++ .../file-actions/file-actions.component.ts | 6 ++++ .../app/modules/projects/projects.module.ts | 2 ++ .../file-preview-screen.component.html | 5 +++ .../project-overview-screen.component.html | 1 + .../project-overview-screen.component.scss | 5 +++ .../projects/services/file-action.service.ts | 7 ++++ .../src/assets/styles/red-page-layout.scss | 5 +++ 11 files changed, 93 insertions(+) create mode 100644 apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.scss create mode 100644 apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts diff --git a/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.scss b/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.scss new file mode 100644 index 000000000..2c2b5c84c --- /dev/null +++ b/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.scss @@ -0,0 +1,34 @@ +@import '../../../../../assets/styles/red-mixins'; + +:host { + display: block; + position: absolute; + height: 100%; + background: white; + z-index: 1; + width: 100%; + @include inset-shadow; +} + +.section { + padding: 40px; + + flex-direction: column; + + &:not(:last-child) { + border-bottom: 1px solid $separator; + } +} + +p { + height: 48px; + width: 234px; + text-align: center; + color: #9398a0; +} + +mat-icon { + width: 60px; + height: 60px; + opacity: 10%; +} diff --git a/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts b/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts new file mode 100644 index 000000000..9904c1acf --- /dev/null +++ b/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'redaction-disabled-for-redaction', + template: + "
\n" + + ' \n' + + "

Redaction is disabled for this document.

\n" + + '
', + styleUrls: ['./disabled-for-redaction.component.scss'] +}) +export class DisabledForRedactionComponent {} diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html index 319c28c56..99b1c2098 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html @@ -135,5 +135,15 @@ type="dark-bg" > + + +
+ + +
diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss index e42b0242b..f83dc26db 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss @@ -20,3 +20,9 @@ redaction-status-bar { margin-left: 2px; } + +mat-slide-toggle { + height: 34px; + width: 34px; + line-height: 33px; +} diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts index 569fbb1d6..a8622f009 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts @@ -103,4 +103,10 @@ export class FileActionsComponent implements OnInit { this.actionPerformed.emit(action); }); } + + async toggleAnalysis($event: MouseEvent) { + $event.stopPropagation(); + await this._fileActionService.toggleAnalysis(this.fileStatus).toPromise(); + await this.appStateService.getFiles(); + } } diff --git a/apps/red-ui/src/app/modules/projects/projects.module.ts b/apps/red-ui/src/app/modules/projects/projects.module.ts index 818b553ed..d19aefa73 100644 --- a/apps/red-ui/src/app/modules/projects/projects.module.ts +++ b/apps/red-ui/src/app/modules/projects/projects.module.ts @@ -35,6 +35,7 @@ import { PdfViewerDataService } from './services/pdf-viewer-data.service'; import { ManualAnnotationService } from './services/manual-annotation.service'; import { AnnotationDrawService } from './services/annotation-draw.service'; import { AnnotationProcessingService } from './services/annotation-processing.service'; +import { DisabledForRedactionComponent } from './components/disabled-for-redaction/disabled-for-redaction.component'; const screens = [ProjectListingScreenComponent, ProjectOverviewScreenComponent, FilePreviewScreenComponent]; @@ -66,6 +67,7 @@ const components = [ ProjectListingActionsComponent, DocumentInfoComponent, FileWorkloadComponent, + DisabledForRedactionComponent, ...screens, ...dialogs diff --git a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html index 60dd47c3d..bb82703bd 100644 --- a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html @@ -204,6 +204,11 @@
+ + +
diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss index aaf1aa8b1..860ecf149 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss @@ -110,3 +110,8 @@ cdk-virtual-scroll-viewport { .mr-4 { margin-right: 4px; } + +.disabled { + background-color: #F4F5F7; + color: #9398A0; +} diff --git a/apps/red-ui/src/app/modules/projects/services/file-action.service.ts b/apps/red-ui/src/app/modules/projects/services/file-action.service.ts index 12d818e77..f58f1452e 100644 --- a/apps/red-ui/src/app/modules/projects/services/file-action.service.ts +++ b/apps/red-ui/src/app/modules/projects/services/file-action.service.ts @@ -25,6 +25,13 @@ export class FileActionService { return this._reanalysisControllerService.reanalyzeFile(this._appStateService.activeProject.project.projectId, fileStatusWrapper.fileId, priority); } + public toggleAnalysis(fileStatusWrapper?: FileStatusWrapper) { + if (!fileStatusWrapper) { + fileStatusWrapper = this._appStateService.activeFile; + } + return this._reanalysisControllerService.toggleAnalysis(fileStatusWrapper.projectId, fileStatusWrapper.fileId, fileStatusWrapper.isExcluded); + } + public async assignProjectReviewerFromOverview(file?: FileStatusWrapper, callback?: Function) { if (this._permissionsService.isManagerAndOwner()) { this._openAssignReviewerDialog(file, callback); diff --git a/apps/red-ui/src/assets/styles/red-page-layout.scss b/apps/red-ui/src/assets/styles/red-page-layout.scss index 030b1072c..22e97057e 100644 --- a/apps/red-ui/src/assets/styles/red-page-layout.scss +++ b/apps/red-ui/src/assets/styles/red-page-layout.scss @@ -190,6 +190,11 @@ body { justify-content: center; } +.flex-align-items-center { + display: flex; + align-items: center; +} + .flex-1 { flex: 1; } From 2ed47d9be567ba87e203c0196536237f42e12df2 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 7 Apr 2021 00:07:34 +0300 Subject: [PATCH 2/4] add translations, fix colors --- .../disabled-for-redaction.component.ts | 2 +- .../file-actions/file-actions.component.html | 2 ++ .../red-ui/src/app/modules/projects/projects.module.ts | 2 -- .../project-overview-screen.component.scss | 10 ++++++++-- apps/red-ui/src/assets/i18n/en.json | 7 ++++++- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts b/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts index 9904c1acf..e3fc293e5 100644 --- a/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/disabled-for-redaction/disabled-for-redaction.component.ts @@ -5,7 +5,7 @@ import { Component } from '@angular/core'; template: "
\n" + ' \n' + - "

Redaction is disabled for this document.

\n" + + "

{{'file-preview.tabs.is-excluded' | translate}}

\n" + '
', styleUrls: ['./disabled-for-redaction.component.scss'] }) diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html index 99b1c2098..e80e94859 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html @@ -141,6 +141,8 @@ diff --git a/apps/red-ui/src/app/modules/projects/projects.module.ts b/apps/red-ui/src/app/modules/projects/projects.module.ts index d19aefa73..b119686c6 100644 --- a/apps/red-ui/src/app/modules/projects/projects.module.ts +++ b/apps/red-ui/src/app/modules/projects/projects.module.ts @@ -54,11 +54,9 @@ const components = [ ProjectDetailsComponent, PageIndicatorComponent, NeedsWorkBadgeComponent, - ProjectListingEmptyComponent, AnnotationActionsComponent, ProjectListingEmptyComponent, ProjectListingDetailsComponent, - FileActionsComponent, TypeAnnotationIconComponent, TypeFilterComponent, ProjectOverviewBulkActionsComponent, diff --git a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss index 860ecf149..5dbd733dc 100644 --- a/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss +++ b/apps/red-ui/src/app/modules/projects/screens/project-overview-screen/project-overview-screen.component.scss @@ -112,6 +112,12 @@ cdk-virtual-scroll-viewport { } .disabled { - background-color: #F4F5F7; - color: #9398A0; + > div { + background-color: $grey-2; + color: $grey-7; + } + + redaction-file-actions { + color: initial; + } } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index d196e3a41..433c8be3d 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -306,7 +306,12 @@ }, "annotations": { "label": "Workload" - } + }, + "is-excluded": "Redaction is disabled for this document." + }, + "toggle-analysis": { + "enable": "Enable for redaction", + "disable": "Disable redaction" }, "reviewer": "Assigned to", "unassigned": "Unassigned", From 61364b1925a67e5c0dc326a0b2d95bf597560fb6 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 7 Apr 2021 00:37:16 +0300 Subject: [PATCH 3/4] add status bar color, update permissions for excluded files --- apps/red-ui/src/app/services/permissions.service.ts | 1 + apps/red-ui/src/assets/i18n/en.json | 1 + apps/red-ui/src/assets/styles/red-components.scss | 5 +++++ apps/red-ui/src/assets/styles/red-variables.scss | 1 + 4 files changed, 8 insertions(+) diff --git a/apps/red-ui/src/app/services/permissions.service.ts b/apps/red-ui/src/app/services/permissions.service.ts index 7ea8c5ad1..e99c6f761 100644 --- a/apps/red-ui/src/app/services/permissions.service.ts +++ b/apps/red-ui/src/app/services/permissions.service.ts @@ -207,6 +207,7 @@ export class PermissionsService { this.isProjectMember() && !fileStatus.isProcessing && !fileStatus.isError && + !fileStatus.isExcluded && !fileStatus.isApprovedOrUnderApproval && (this.isManagerAndOwner() || !this.isFileReviewer(fileStatus)) ); diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 433c8be3d..e56107129 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -464,6 +464,7 @@ "UNDER_REVIEW": "Under Review", "UNDER_APPROVAL": "Under Approval", "APPROVED": "Approved", + "EXCLUDED": "Excluded", "by": "by", "efsa": "EFSA Approval", "finished": "Finished", diff --git a/apps/red-ui/src/assets/styles/red-components.scss b/apps/red-ui/src/assets/styles/red-components.scss index 13236f052..2b32fd661 100644 --- a/apps/red-ui/src/assets/styles/red-components.scss +++ b/apps/red-ui/src/assets/styles/red-components.scss @@ -141,6 +141,11 @@ background-color: $grey-1; } +.EXCLUDED { + stroke: $pink-1; + background-color: $pink-1; +} + .ERROR { stroke: lighten($red-1, 25%); background-color: lighten($red-1, 25%); diff --git a/apps/red-ui/src/assets/styles/red-variables.scss b/apps/red-ui/src/assets/styles/red-variables.scss index 0a64ed393..98936e9bc 100644 --- a/apps/red-ui/src/assets/styles/red-variables.scss +++ b/apps/red-ui/src/assets/styles/red-variables.scss @@ -21,6 +21,7 @@ $yellow-2: #fdbd00; $green-1: #00ff00; $green-2: #5ce594; $orange-1: #ff801a; +$pink-1: #F125DE; $primary: $red-1; $accent: $grey-1; From 962c44b055fe1b7708d16f7435298f04486755e3 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 7 Apr 2021 15:35:31 +0300 Subject: [PATCH 4/4] disable toggle for non managers, update tooltip & translations & styles --- .editorconfig | 1 + .../file-actions/file-actions.component.html | 14 ++--- .../file-actions/file-actions.component.scss | 9 ++++ .../file-actions/file-actions.component.ts | 17 ++++++ .../file-preview-screen.component.html | 52 ++++++++++--------- apps/red-ui/src/assets/i18n/en.json | 3 +- 6 files changed, 65 insertions(+), 31 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9b7352176..4a2be7a8c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,7 @@ indent_style = space indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true +ij_html_quote_style = double [*.md] max_line_length = off diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html index e80e94859..a27c3d766 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.html @@ -137,13 +137,15 @@ -
+
diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss index f83dc26db..f3d8e6d9e 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.scss @@ -26,3 +26,12 @@ mat-slide-toggle { width: 34px; line-height: 33px; } + +.mr-24 { + margin-right: 24px; +} + +mat-slide-toggle { + margin-left: 8px; + margin-right: 5px; +} diff --git a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts index a8622f009..119062504 100644 --- a/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/file-actions/file-actions.component.ts @@ -4,6 +4,7 @@ import { FileStatusWrapper } from '../../../../models/file/file-status.wrapper'; import { AppStateService } from '../../../../state/app-state.service'; import { FileActionService } from '../../services/file-action.service'; import { ProjectsDialogService } from '../../services/projects-dialog.service'; +import { TooltipPosition } from '@angular/material/tooltip'; @Component({ selector: 'redaction-file-actions', @@ -109,4 +110,20 @@ export class FileActionsComponent implements OnInit { await this._fileActionService.toggleAnalysis(this.fileStatus).toPromise(); await this.appStateService.getFiles(); } + + get toggleTooltip(): string { + if (!this.permissionsService.isManager()) { + return 'file-preview.toggle-analysis.only-managers'; + } + + return this.fileStatus.isExcluded ? 'file-preview.toggle-analysis.enable' : 'file-preview.toggle-analysis.disable'; + } + + get toggleTooltipPosition(): TooltipPosition { + if (!this.permissionsService.isManager() && this.screen === 'file-preview') { + return 'left'; + } + + return 'above'; + } } diff --git a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html index bb82703bd..3efa6f1c4 100644 --- a/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/modules/projects/screens/file-preview-screen/file-preview-screen.component.html @@ -30,39 +30,43 @@
- +
- + - -
- {{ appStateService.activeFile.status | translate }} - {{ 'by' | translate }}: -
+
+
+ {{ appStateService.activeFile.status | translate }} + {{ 'by' | translate }}: +
- - -
+ + +
+
@@ -205,7 +209,7 @@
diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index e56107129..807782f16 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -311,7 +311,8 @@ }, "toggle-analysis": { "enable": "Enable for redaction", - "disable": "Disable redaction" + "disable": "Disable redaction", + "only-managers": "Enabling / disabling is permitted only for managers" }, "reviewer": "Assigned to", "unassigned": "Unassigned",