From 14837d5316d379b901d0ce930c72303ad3ec0cab Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Mon, 28 Jun 2021 13:17:13 +0300 Subject: [PATCH 1/3] wip second filter option --- .../dossier/services/annotation-processing.service.ts | 9 +++++++++ apps/red-ui/src/assets/i18n/en.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts index cd7650636..bcb1319b3 100644 --- a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts @@ -16,6 +16,15 @@ export class AnnotationProcessingService { topLevelFilter: true, filters: [], checker: (annotation: AnnotationWrapper) => annotation?.comments?.length > 0 + }, + { + key: 'with-reason-changes', + icon: 'red:comment', + label: 'filter-menu.with-reason-changes', + checked: false, + topLevelFilter: true, + filters: [], + checker: (annotation: AnnotationWrapper) => annotation?.comments?.length > 0 } ]; } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 03936d00d..e74df12ad 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -606,7 +606,8 @@ "label": "Filter", "filter-types": "Filter types", "filter-options": "Filter options", - "with-comments": "Show only annotations with comments" + "with-comments": "Only annotations with comments", + "with-reason-changes": "Only redactions with reason changes" }, "sorting": { "recent": "Recent", From 2a16675bdfe385a767bdeffce4e62a25b593f8bc Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Mon, 28 Jun 2021 17:22:59 +0300 Subject: [PATCH 2/3] add filter for redactions with reason changes --- .../src/app/models/file/annotation.wrapper.ts | 2 + .../file/redaction-log-entry.wrapper.ts | 1 + .../file-workload/file-workload.component.ts | 12 +++++ .../services/annotation-processing.service.ts | 5 +- .../src/app/modules/icons/icons.module.ts | 1 + .../popup-filter/popup-filter.component.html | 48 ++++++++----------- .../src/assets/icons/general/reason.svg | 1 + 7 files changed, 39 insertions(+), 31 deletions(-) create mode 100644 apps/red-ui/src/assets/icons/general/reason.svg diff --git a/apps/red-ui/src/app/models/file/annotation.wrapper.ts b/apps/red-ui/src/app/models/file/annotation.wrapper.ts index 232a238d8..ebed53aca 100644 --- a/apps/red-ui/src/app/models/file/annotation.wrapper.ts +++ b/apps/red-ui/src/app/models/file/annotation.wrapper.ts @@ -39,6 +39,7 @@ export class AnnotationWrapper { positions: Rectangle[]; recommendationType: string; legalBasis: string; + legalBasisChangeValue?: string; image?: boolean; force?: boolean; @@ -234,6 +235,7 @@ export class AnnotationWrapper { annotationWrapper.dictionaryOperation = redactionLogEntry.dictionaryEntry; annotationWrapper.userId = redactionLogEntry.userId; annotationWrapper.image = redactionLogEntry.image; + annotationWrapper.legalBasisChangeValue = redactionLogEntry.legalBasisChangeValue; annotationWrapper.comments = redactionLogEntry.comments || []; annotationWrapper.legalBasis = redactionLogEntry.legalBasis; AnnotationWrapper._createContent(annotationWrapper, redactionLogEntry); diff --git a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts index ea61f36ff..c407b4cbe 100644 --- a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts +++ b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts @@ -28,6 +28,7 @@ export interface RedactionLogEntryWrapper { actionPendingReanalysis?: boolean; hidden?: boolean; + legalBasisChangeValue?: string; userId?: string; comments?: Comment[]; diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts index 9b72900e1..698f66f9b 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts @@ -74,6 +74,18 @@ export class FileWorkloadComponent { private _multiSelectActive = false; + get isProcessing(): boolean { + return this.fileData?.fileStatus?.isProcessing; + } + + get activeAnnotationsLength(): number | undefined { + return this.displayedAnnotations[this.activeViewerPage]?.annotations?.length; + } + + get isReadOnly(): boolean { + return !this._permissionsService.canPerformAnnotationActions(); + } + get multiSelectActive(): boolean { return this._multiSelectActive; } diff --git a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts index bcb1319b3..d189d56fc 100644 --- a/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/dossier/services/annotation-processing.service.ts @@ -19,12 +19,13 @@ export class AnnotationProcessingService { }, { key: 'with-reason-changes', - icon: 'red:comment', + icon: 'red:reason', label: 'filter-menu.with-reason-changes', checked: false, topLevelFilter: true, filters: [], - checker: (annotation: AnnotationWrapper) => annotation?.comments?.length > 0 + checker: (annotation: AnnotationWrapper) => + annotation?.legalBasisChangeValue?.length > 0 } ]; } diff --git a/apps/red-ui/src/app/modules/icons/icons.module.ts b/apps/red-ui/src/app/modules/icons/icons.module.ts index 0fed86bb4..0fdd3947e 100644 --- a/apps/red-ui/src/app/modules/icons/icons.module.ts +++ b/apps/red-ui/src/app/modules/icons/icons.module.ts @@ -66,6 +66,7 @@ export class IconsModule { 'radio-selected', 'read-only', 'ready-for-approval', + 'reason', 'refresh', 'remove-from-dict', 'report', diff --git a/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/popup-filter.component.html b/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/popup-filter.component.html index 924a1d038..330c9184c 100644 --- a/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/popup-filter.component.html +++ b/apps/red-ui/src/app/modules/shared/components/filters/popup-filter/popup-filter.component.html @@ -37,13 +37,11 @@
@@ -52,13 +50,11 @@
@@ -93,17 +89,13 @@ class="filter-menu-checkbox" >
@@ -117,17 +109,15 @@ [checked]="subFilter.checked" >
diff --git a/apps/red-ui/src/assets/icons/general/reason.svg b/apps/red-ui/src/assets/icons/general/reason.svg new file mode 100644 index 000000000..2c3bfed3f --- /dev/null +++ b/apps/red-ui/src/assets/icons/general/reason.svg @@ -0,0 +1 @@ + \ No newline at end of file From c154ae57fc7853631753cbc8475a5e9530ec5a1f Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 30 Jun 2021 01:17:45 +0300 Subject: [PATCH 3/3] fix rebase errors --- .../file/redaction-log-entry.wrapper.ts | 1 - .../file-workload/file-workload.component.ts | 108 +++++++----------- .../file-preview-screen.component.ts | 1 - 3 files changed, 44 insertions(+), 66 deletions(-) diff --git a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts index c407b4cbe..ea61f36ff 100644 --- a/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts +++ b/apps/red-ui/src/app/models/file/redaction-log-entry.wrapper.ts @@ -28,7 +28,6 @@ export interface RedactionLogEntryWrapper { actionPendingReanalysis?: boolean; hidden?: boolean; - legalBasisChangeValue?: string; userId?: string; comments?: Comment[]; diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts index 698f66f9b..b0f25ef89 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts @@ -74,18 +74,6 @@ export class FileWorkloadComponent { private _multiSelectActive = false; - get isProcessing(): boolean { - return this.fileData?.fileStatus?.isProcessing; - } - - get activeAnnotationsLength(): number | undefined { - return this.displayedAnnotations[this.activeViewerPage]?.annotations?.length; - } - - get isReadOnly(): boolean { - return !this._permissionsService.canPerformAnnotationActions(); - } - get multiSelectActive(): boolean { return this._multiSelectActive; } @@ -324,64 +312,56 @@ export class FileWorkloadComponent { !this._firstSelectedAnnotation || this.activeViewerPage !== this._firstSelectedAnnotation.pageNumber ) { - const pageIdx = this.displayedPages.indexOf(this.activeViewerPage); - if (pageIdx !== -1) { + if (this.displayedPages.indexOf(this.activeViewerPage) !== -1) { // Displayed page has annotations - this.selectAnnotations.emit([ + return this.selectAnnotations.emit([ this.displayedAnnotations[this.activeViewerPage].annotations[0] ]); - } else { - // Displayed page doesn't have annotations - if ($event.key === 'ArrowDown') { - const nextPage = this._nextPageWithAnnotations(); - this.shouldDeselectAnnotationsOnPageChange = false; - this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); - this.selectAnnotations.emit([ - this.displayedAnnotations[nextPage].annotations[0] - ]); - } else { - const prevPage = this._prevPageWithAnnotations(); - this.shouldDeselectAnnotationsOnPageChange = false; - this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); - const prevPageAnnotations = this.displayedAnnotations[prevPage].annotations; - this.selectAnnotations.emit([ - prevPageAnnotations[prevPageAnnotations.length - 1] - ]); - } } - } else { - const page = this._firstSelectedAnnotation.pageNumber; - const pageIdx = this.displayedPages.indexOf(page); - const annotationsOnPage = this.displayedAnnotations[page].annotations; - const idx = annotationsOnPage.findIndex(a => a.id === this._firstSelectedAnnotation.id); - + // Displayed page doesn't have annotations if ($event.key === 'ArrowDown') { - if (idx + 1 !== annotationsOnPage.length) { - // If not last item in page - this.selectAnnotations.emit([annotationsOnPage[idx + 1]]); - } else if (pageIdx + 1 < this.displayedPages.length) { - // If not last page - const nextPageAnnotations = - this.displayedAnnotations[this.displayedPages[pageIdx + 1]].annotations; - this.shouldDeselectAnnotationsOnPageChange = false; - this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); - this.selectAnnotations.emit([nextPageAnnotations[0]]); - } - } else { - if (idx !== 0) { - // If not first item in page - this.selectAnnotations.emit([annotationsOnPage[idx - 1]]); - } else if (pageIdx) { - // If not first page - const prevPageAnnotations = - this.displayedAnnotations[this.displayedPages[pageIdx - 1]].annotations; - this.shouldDeselectAnnotationsOnPageChange = false; - this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); - this.selectAnnotations.emit([ - prevPageAnnotations[prevPageAnnotations.length - 1] - ]); - } + const nextPage = this._nextPageWithAnnotations(); + this.shouldDeselectAnnotationsOnPageChange = false; + this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); + this.selectAnnotations.emit([this.displayedAnnotations[nextPage].annotations[0]]); + return; } + + const prevPage = this._prevPageWithAnnotations(); + this.shouldDeselectAnnotationsOnPageChange = false; + this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); + const prevPageAnnotations = this.displayedAnnotations[prevPage].annotations; + this.selectAnnotations.emit([prevPageAnnotations[prevPageAnnotations.length - 1]]); + return; + } + + const page = this._firstSelectedAnnotation.pageNumber; + const pageIdx = this.displayedPages.indexOf(page); + const annotationsOnPage = this.displayedAnnotations[page].annotations; + const idx = annotationsOnPage.findIndex(a => a.id === this._firstSelectedAnnotation.id); + + if ($event.key === 'ArrowDown') { + if (idx + 1 !== annotationsOnPage.length) { + // If not last item in page + this.selectAnnotations.emit([annotationsOnPage[idx + 1]]); + } else if (pageIdx + 1 < this.displayedPages.length) { + // If not last page + const nextPageAnnotations = + this.displayedAnnotations[this.displayedPages[pageIdx + 1]].annotations; + this.shouldDeselectAnnotationsOnPageChange = false; + this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); + this.selectAnnotations.emit([nextPageAnnotations[0]]); + } + } else if (idx !== 0) { + // If not first item in page + this.selectAnnotations.emit([annotationsOnPage[idx - 1]]); + } else if (pageIdx) { + // If not first page + const prevPageAnnotations = + this.displayedAnnotations[this.displayedPages[pageIdx - 1]].annotations; + this.shouldDeselectAnnotationsOnPageChange = false; + this.shouldDeselectAnnotationsOnPageChangeChange.emit(false); + this.selectAnnotations.emit([prevPageAnnotations[prevPageAnnotations.length - 1]]); } } diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts index 8fbf61595..34c5726d3 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts @@ -460,7 +460,6 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy, OnAttach, } async annotationsChangedByReviewAction(annotation: AnnotationWrapper) { - console.log(annotation); await this._cleanupAndRedrawManualAnnotationsForEntirePage(annotation.pageNumber); }