diff --git a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html index 93b2e0114..2ac26d0e4 100644 --- a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html +++ b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.html @@ -35,7 +35,7 @@ -
+
diff --git a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts index 109f76285..0d1244721 100644 --- a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts @@ -23,12 +23,12 @@ export interface LegalBasisOption { }) export class ManualAnnotationDialogComponent implements OnInit { redactionForm: FormGroup; + isDocumentAdmin: boolean; - isDictionaryRequest: boolean; - redactionDictionaries: TypeValue[] = []; - hintDictionaries: TypeValue[] = []; + isFalsePositiveRequest: boolean; + redactionDictionaries: TypeValue[] = []; legalOptions: LegalBasisOption[] = []; @ViewChild('textarea') private _textarea: ElementRef; @@ -59,19 +59,20 @@ export class ManualAnnotationDialogComponent implements OnInit { this.isDocumentAdmin = this._permissionsService.isManagerAndOwner(); - this.isDictionaryRequest = this.manualRedactionEntryWrapper.type === 'DICTIONARY'; + this.isFalsePositiveRequest = this.manualRedactionEntryWrapper.type === 'FALSE_POSITIVE'; + this.isDictionaryRequest = this.manualRedactionEntryWrapper.type === 'DICTIONARY' || this.isFalsePositiveRequest; + this.redactionForm = this._formBuilder.group({ reason: this.isDictionaryRequest ? [null] : [null, Validators.required], - dictionary: this.isDictionaryRequest ? [null, Validators.required] : ['manual', Validators.required], + dictionary: this.isDictionaryRequest + ? [this.isFalsePositiveRequest ? 'false_positive' : null, Validators.required] + : ['manual', Validators.required], comment: this.isDocumentAdmin ? [null] : [null, Validators.required] }); for (const key of Object.keys(this._appStateService.dictionaryData)) { const dictionaryData = this._appStateService.dictionaryData[key]; if (!dictionaryData.virtual && !(dictionaryData.type.indexOf('recommendation_') === 0)) { - if (dictionaryData.hint) { - this.hintDictionaries.push(dictionaryData); - } if (!dictionaryData.hint && dictionaryData.type !== 'manual') { this.redactionDictionaries.push(dictionaryData); } diff --git a/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts b/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts index 749cbd2d8..a8d42635a 100644 --- a/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts +++ b/apps/red-ui/src/app/screens/file/model/manual-redaction-entry.wrapper.ts @@ -4,7 +4,7 @@ export class ManualRedactionEntryWrapper { constructor( public readonly quads: any, public readonly manualRedactionEntry: ManualRedactionEntry, - public readonly type: 'DICTIONARY' | 'REDACTION', + public readonly type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE', public readonly annotationType: 'TEXT' | 'RECTANGLE' = 'TEXT' ) {} } diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 66a23a151..8af3e9585 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -129,9 +129,9 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { instance.docViewer.on('textSelected', (quads, selectedText, pageNumber) => { this._selectedText = selectedText; if (selectedText.length > 2 && this.canPerformActions) { - this.instance.enableElements(['add-dictionary']); + this.instance.enableElements(['add-dictionary', 'add-false-positive']); } else { - this.instance.disableElements(['add-dictionary']); + this.instance.disableElements(['add-dictionary', 'add-false-positive']); } }); @@ -237,6 +237,20 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { }, 250); } }); + + this.instance.textPopup.add({ + type: 'actionButton', + dataElement: 'add-false-positive', + img: '/assets/icons/general/pdftron-action-false-positive.svg', + title: this._translateService.instant(this._manualAnnotationService.getTitle('FALSE_POSITIVE')), + onClick: () => { + const selectedQuads = this.instance.docViewer.getSelectedTextQuads(); + const text = this.instance.docViewer.getSelectedText(); + const mre = this._getManualRedactionEntry(selectedQuads, text); + this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(this.instance.docViewer.getSelectedTextQuads(), mre, 'FALSE_POSITIVE')); + } + }); + this.instance.textPopup.add({ type: 'actionButton', dataElement: 'add-dictionary', @@ -249,6 +263,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { this.manualAnnotationRequested.emit(new ManualRedactionEntryWrapper(this.instance.docViewer.getSelectedTextQuads(), mre, 'DICTIONARY')); } }); + this.instance.textPopup.add({ type: 'actionButton', dataElement: 'add-redaction', @@ -266,12 +281,12 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { private _handleCustomActions() { if (this.canPerformActions) { - this.instance.enableElements(['add-redaction', 'add-rectangle', 'shapeToolGroupButton']); + this.instance.enableElements(['add-redaction', 'add-rectangle', 'add-false-positive', 'shapeToolGroupButton']); if (this._selectedText.length > 2) { - this.instance.enableElements(['add-dictionary']); + this.instance.enableElements(['add-dictionary', 'add-false-positive']); } } else { - this.instance.disableElements(['add-redaction', 'add-dictionary', 'add-rectangle', 'shapeToolGroupButton']); + this.instance.disableElements(['add-redaction', 'add-dictionary', 'add-false-positive', 'add-rectangle', 'shapeToolGroupButton']); } } diff --git a/apps/red-ui/src/app/screens/file/service/manual-annotation.service.ts b/apps/red-ui/src/app/screens/file/service/manual-annotation.service.ts index f2050be6c..dc350e838 100644 --- a/apps/red-ui/src/app/screens/file/service/manual-annotation.service.ts +++ b/apps/red-ui/src/app/screens/file/service/manual-annotation.service.ts @@ -203,18 +203,24 @@ export class ManualAnnotationService { }); } - getTitle(type: 'DICTIONARY' | 'REDACTION') { + getTitle(type: 'DICTIONARY' | 'REDACTION' | 'FALSE_POSITIVE') { if (this._permissionsService.isManagerAndOwner()) { - if (type === 'DICTIONARY') { - return 'manual-annotation.dialog.header.dictionary'; - } else { - return 'manual-annotation.dialog.header.redaction'; + switch (type) { + case 'DICTIONARY': + return 'manual-annotation.dialog.header.dictionary'; + case 'FALSE_POSITIVE': + return 'manual-annotation.dialog.header.false-positive'; + case 'REDACTION': + return 'manual-annotation.dialog.header.redaction'; } } else { - if (type === 'DICTIONARY') { - return 'manual-annotation.dialog.header.request-dictionary'; - } else { - return 'manual-annotation.dialog.header.request-redaction'; + switch (type) { + case 'DICTIONARY': + return 'manual-annotation.dialog.header.request-dictionary'; + case 'FALSE_POSITIVE': + return 'manual-annotation.dialog.header.request-false-positive'; + case 'REDACTION': + return 'manual-annotation.dialog.header.request-redaction'; } } } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 454b3a304..e2e5fd5c4 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -463,7 +463,9 @@ "dictionary": "Add to dictionary", "redaction": "Manual Redaction", "request-dictionary": "Request add to dictionary", - "request-redaction": "Request Redaction" + "request-redaction": "Request Redaction", + "false-positive": "Set false positive", + "request-false-positive": "Request false positive" }, "add-redaction": { "success": "Redaction suggestion added!",