diff --git a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts index 88cb55b1f..2983a5737 100644 --- a/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts +++ b/apps/red-ui/src/app/screens/file/annotation-actions/annotation-actions.component.ts @@ -31,16 +31,16 @@ export class AnnotationActionsComponent implements OnInit { } get canAcceptSuggestion() { - return this.permissionsService.isManagerAndOwner() && this.annotation.isSuggestion; + return this.permissionsService.isManagerAndOwner() && (this.annotation.isSuggestion || this.annotation.isDeclinedSuggestion); } get canRejectSuggestion() { // i can reject whatever i may not undo - return this.canAcceptSuggestion && !this.canUndoAnnotation; + return this.canAcceptSuggestion && !this.annotation.isDeclinedSuggestion && !this.canUndoAnnotation; } get canDirectlySuggestToRemoveAnnotation() { - return this.annotation.isHint; + return this.annotation.isHint || this.annotation.isManual; } get requiresSuggestionRemoveMenu() { diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index 22847d60a..5c527f860 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -372,10 +372,12 @@ export class FilePreviewScreenComponent implements OnInit { this._fileDownloadService.loadActiveFileManualAnnotations().subscribe((manualRedactions) => { this.fileData.manualRedactions = manualRedactions; this._rebuildFilters(); - this._annotationDrawService.drawAnnotations( - this.instance, - this.annotations.filter((item) => (annotationIdToDraw ? item.id === annotationIdToDraw : true)) - ); + if (!this.redactedView) { + this._annotationDrawService.drawAnnotations( + this.instance, + this.annotations.filter((item) => (annotationIdToDraw ? item.id === annotationIdToDraw : true)) + ); + } }); } diff --git a/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts b/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts index 89fed774b..9b338c0c6 100644 --- a/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts +++ b/apps/red-ui/src/app/screens/file/model/annotation.wrapper.ts @@ -35,12 +35,17 @@ export class AnnotationWrapper { pageNumber: number; hint: boolean; redaction: boolean; + status: string; positions: Rectangle[]; get isIgnored() { return this.superType === 'ignore'; } + get isManual() { + return this.superType === 'manual'; + } + get isRedactedOrIgnored() { return this.superType === 'ignore' || this.superType === 'redaction'; } @@ -53,6 +58,10 @@ export class AnnotationWrapper { return this.superType === 'add-dictionary' || this.superType === 'remove-dictionary'; } + get isApproved() { + return this.status === 'APPROVED'; + } + get isHint() { return this.superType === 'hint'; } @@ -100,6 +109,7 @@ export class AnnotationWrapper { annotationWrapper.pageNumber = redactionLogEntry.positions[0]?.page; annotationWrapper.positions = redactionLogEntry.positions; annotationWrapper.content = AnnotationWrapper.createContent(redactionLogEntry); + annotationWrapper.status = redactionLogEntry.status; } else { // no redaction log entry - not yet processed const dictionary = dictionaryData[manualRedactionEntry.type]; @@ -117,7 +127,7 @@ export class AnnotationWrapper { AnnotationWrapper._setSuperType(annotationWrapper, redactionLogEntry, manualRedactionEntry, idRemoval); - annotationWrapper.typeLabel = annotationWrapper.superType; + annotationWrapper.typeLabel = 'annotation-type.' + annotationWrapper.superType; return annotationWrapper; } diff --git a/apps/red-ui/src/app/screens/file/model/file-data.model.ts b/apps/red-ui/src/app/screens/file/model/file-data.model.ts index ebcfff5cb..2dbb5c79f 100644 --- a/apps/red-ui/src/app/screens/file/model/file-data.model.ts +++ b/apps/red-ui/src/app/screens/file/model/file-data.model.ts @@ -41,7 +41,11 @@ export class FileDataModel { pair.comments ); if (annotation) { - annotations.push(annotation); + if (annotation.isReadyForAnalysis && annotation.isApproved) { + // + } else { + annotations.push(annotation); + } } }); @@ -64,15 +68,17 @@ export class FileDataModel { this.manualRedactions.entriesToAdd.forEach((eta) => { // only not declined - const redactionLogEntry = this.redactionLog.redactionLogEntry.find((rdl) => rdl.id === eta.id); - if (!redactionLogEntry) { - pairs.push({ - redactionLogEntry: null, - manualRedactionEntry: eta, - // only not declined - idRemoval: this.manualRedactions.idsToRemove.find((idr) => idr.id === eta.id), - comments: this.manualRedactions.comments[eta.id] - }); + if (new Date(eta.processedDate).getTime() > new Date(this.fileStatus.lastProcessed).getTime() || !eta.processedDate) { + const redactionLogEntry = this.redactionLog.redactionLogEntry.find((rdl) => rdl.id === eta.id); + if (!redactionLogEntry) { + pairs.push({ + redactionLogEntry: null, + manualRedactionEntry: eta, + // only not declined + idRemoval: this.manualRedactions.idsToRemove.find((idr) => idr.id === eta.id), + comments: this.manualRedactions.comments[eta.id] + }); + } } }); diff --git a/apps/red-ui/src/app/screens/file/service/file-download.service.ts b/apps/red-ui/src/app/screens/file/service/file-download.service.ts index a337213d2..43ae9d5d7 100644 --- a/apps/red-ui/src/app/screens/file/service/file-download.service.ts +++ b/apps/red-ui/src/app/screens/file/service/file-download.service.ts @@ -42,7 +42,7 @@ export class FileDownloadService { map((data) => { const fileData = new FileDataModel(this._appStateService.activeFile, ...data); // lazy load redacted data - this.loadFile('REDACTED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData)); + this.loadFile('ANNOTATED', this._appStateService.activeFileId).subscribe((redactedFileData) => (fileData.redactedFileData = redactedFileData)); return fileData; }) ); diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index 37b4e2f84..5337a7a2d 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -60,6 +60,10 @@ export class AppStateService { activeFile: null }; + this._dictionaryControllerService.getDictionaryForType('hint_only').subscribe((data) => { + console.log(data); + }); + timer(5000, 5000) .pipe( tap(() => { diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 3e85110d8..8a6e6bbf7 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -344,16 +344,16 @@ "hints": "Hint Dictionaries" }, "annotation-type": { - "suggestion": "Suggestion", - "suggestion-remove": "Suggestion removal", - "suggestion-redaction": "Suggested redaction add", - "suggestion-remove-redaction": "Suggested redaction removal", - "suggestion-redaction-dictionary": "Suggested dictionary add (redaction)", - "suggestion-remove-redaction-dictionary": "Suggested dictionary removal (redaction)", - "suggestion-hint": "Suggested dictionary add (hint)", - "suggestion-remove-hint": "Suggested dictionary removal (hint)", + "add-dictionary": "Pending add to dictionary", + "remove-dictionary": "Pending remove from dictionary", + "suggestion-add-dictionary": "Suggested dictionary add", + "suggestion-remove-dictionary": "Suggested dictionary removal", + "suggestion-add": "Suggested manual redaction", + "suggestion-remove": "Suggested redaction removal", "ignore": "Ignore", "hint": "Hint", - "redaction": "Redaction" + "redaction": "Redaction", + "manual": "Manual Redaction", + "declined-suggestion": "Declined Suggestion" } }