From 20722dbd3dec004734b61595b7512034d7fbfd37 Mon Sep 17 00:00:00 2001 From: George Date: Thu, 17 Aug 2023 17:24:54 +0300 Subject: [PATCH 1/3] RED-7069, fix issues, test type filtering, improvements. --- .../annotation-actions.component.html | 7 +++++- .../edit-redaction-dialog.component.html | 13 +++++----- .../edit-redaction-dialog.component.ts | 24 +++---------------- .../services/annotation-actions.service.ts | 6 ++--- .../pdf-annotation-actions.service.ts | 7 +++++- .../modules/file-preview/utils/constants.ts | 2 +- .../file-preview/utils/dialog-types.ts | 1 - .../entity-services/dictionary.service.ts | 8 ++++--- apps/red-ui/src/assets/config/config.json | 2 +- apps/red-ui/src/assets/i18n/redact/en.json | 2 +- 10 files changed, 32 insertions(+), 40 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html index cb5b3a1f0..eae5e9d7d 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-actions/annotation-actions.component.html @@ -35,7 +35,12 @@ - - +
@@ -58,12 +57,12 @@
-
-
- - -
+
+ + +
+
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 2df530cec..e7f904677 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -27,13 +27,12 @@ export class EditRedactionDialogComponent readonly isManualRedaction: boolean; readonly showLegalReason: boolean; readonly isHint: boolean; + readonly showExtras: boolean; options: DetailsRadioOption[] | undefined; legalOptions: LegalBasisOption[] = []; dictionaries: Dictionary[] = []; form: UntypedFormGroup; - readonly #initialType: string; - readonly #initialReason: string; readonly #dossier: Dossier; #applyToAllDossiers: boolean; @@ -51,27 +50,11 @@ export class EditRedactionDialogComponent const firstEntry = annotations[0]; this.isImage = IMAGE_CATEGORIES.includes(firstEntry.type); this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null; - this.#initialReason = firstEntry.legalBasis; - this.#initialType = firstEntry.type; this.isModifyDictionary = firstEntry.isModifyDictionary; this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction; this.isHint = firstEntry.isHint; - this.showLegalReason = !(firstEntry.isSkipped || firstEntry.isHint || this.isImage); + this.showExtras = this.isManualRedaction || ((firstEntry.isRedacted || firstEntry.isSkipped) && firstEntry.dictionaryOperation); this.form = this.#getForm(); - console.log(firstEntry); - - // this.form.valueChanges - // .pipe( - // tap(value => { - // const reasonChanged = this.#initialReason !== value?.reason?.legalBasis; - // const typeChanged = this.#initialType !== value?.type; - // if (typeChanged || reasonChanged) { - // this.#setOptions(value.type, reasonChanged); - // } - // }), - // takeUntilDestroyed(), - // ) - // .subscribe(); } get displayedDictionaryLabel() { @@ -110,8 +93,7 @@ export class EditRedactionDialogComponent save(): void { const value = this.form.value; this.dialogRef.close({ - typeChanged: this.#initialType !== value.type, - legalBasis: value.reason?.legalBasis ?? null, + legalBasis: value.reason?.legalBasis ?? '', section: value.section, comment: value.comment, type: value.type, diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index ffa1e89be..1e18dd0e3 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -117,7 +117,7 @@ export class AnnotationActionsService { return; } - if (!this.#isDocumine) { + if (!this.#isDocumine && result.legalBasis !== annotations[0].legalBasis) { const changeLegalBasisBody = annotations.map(annotation => ({ annotationId: annotation.id, legalBasis: result.legalBasis, @@ -126,7 +126,7 @@ export class AnnotationActionsService { })); requests.push(this._manualRedactionService.changeLegalBasis(changeLegalBasisBody, dossierId, fileId)); } - if (result.typeChanged || this.#isDocumine) { + if (result.type !== annotations[0].type || this.#isDocumine) { const recategorizeBody: List = annotations.map(({ id }) => ({ annotationId: id, type: result.type, @@ -134,7 +134,7 @@ export class AnnotationActionsService { requests.push(this._manualRedactionService.recategorizeRedactions(recategorizeBody, dossierId, fileId)); } - if (result.comment) { + if (result.comment && requests.length) { requests.push( from(Promise.all(annotations.map(a => this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId)))), ); diff --git a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts index 238727638..ab888107e 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/pdf-annotation-actions.service.ts @@ -51,7 +51,12 @@ export class PdfAnnotationActionsService { availableActions.push(resizeButton); } - if (permissions.canChangeLegalBasis || permissions.canRecategorizeAnnotation) { + if ( + permissions.canChangeLegalBasis || + permissions.canRecategorizeAnnotation || + permissions.canForceHint || + permissions.canForceRedaction + ) { const editButton = this.#getButton('edit', _('annotation-actions.edit-redaction.label'), () => this.#annotationActionsService.editRedaction(annotations), ); diff --git a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts index 093e039e2..ac5b4ceb0 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts @@ -1,6 +1,6 @@ import { List, ValuesOf } from '@iqser/common-ui/lib/utils'; -export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image']; +export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image', 'ocr']; export const ActionsHelpModeKeys = { redaction: 'redaction', 'manual-redaction': 'redaction', diff --git a/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts b/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts index 679285324..11d89beee 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/dialog-types.ts @@ -35,7 +35,6 @@ export interface RedactRecommendationResult { } export interface EditRedactResult { - typeChanged: boolean; legalBasis: string; section: string; comment: string; diff --git a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts index 2a7330941..59a407b9c 100644 --- a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts +++ b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts @@ -167,14 +167,16 @@ export class DictionaryService extends EntitiesService } getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean): Dictionary[] { - return this._dictionariesMapService + const types = []; + this._dictionariesMapService .get(dossierTemplateId) .filter(d => isImage ? IMAGE_CATEGORIES.includes(d.type) - : (isHint ? d.hint : !d.hint) && !d.systemManaged && !d.virtual && d.hasDictionary, + : (isHint ? d.hint : !d.hint) && !d.virtual && !IMAGE_CATEGORIES.includes(d.type), ) - .sort((a, b) => a.label.localeCompare(b.label)); + .forEach(d => !types.find(t => t.id === d.id) && types.push(d)); + return types.sort((a, b) => a.label.localeCompare(b.label)); } getAddHintDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] { diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index e3ee6fa7b..27c9f3c29 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -3,7 +3,7 @@ "ADMIN_CONTACT_URL": null, "API_URL": "https://qa2.iqser.cloud", "APP_NAME": "RedactManager", - "IS_DOCUMINE": true, + "IS_DOCUMINE": false, "RULE_EDITOR_DEV_ONLY": false, "AUTO_READ_TIME": 3, "BACKEND_APP_VERSION": "4.4.40", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 3b9ec027b..748f217ba 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1239,7 +1239,7 @@ "section": "Paragraph / Location", "type": "Type" }, - "title-edit-image": "Edit image redaction", + "title-edit-image": "Edit image", "title-edit-text": "Edit redaction", "title-hint": "Edit hint" } From 75c4d111a0cc3421413aaa6570340f2d05741757 Mon Sep 17 00:00:00 2001 From: George Date: Thu, 17 Aug 2023 17:46:55 +0300 Subject: [PATCH 2/3] Change title translations to use param, dont reload if no changes. --- .../edit-annotation-dialog.component.html | 2 +- .../edit-redaction-dialog.component.html | 9 ++------- .../edit-redaction-dialog.component.ts | 2 +- .../services/annotation-actions.service.ts | 6 +++++- apps/red-ui/src/assets/config/config.json | 4 ++-- apps/red-ui/src/assets/i18n/redact/de.json | 11 ++++------- apps/red-ui/src/assets/i18n/redact/en.json | 11 ++++------- apps/red-ui/src/assets/i18n/scm/de.json | 11 ++++------- apps/red-ui/src/assets/i18n/scm/en.json | 11 ++++------- 9 files changed, 27 insertions(+), 40 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/edit-annotation-dialog/edit-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/edit-annotation-dialog/edit-annotation-dialog.component.html index edfd9e7ae..10baea1b0 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/edit-annotation-dialog/edit-annotation-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/edit-annotation-dialog/edit-annotation-dialog.component.html @@ -1,6 +1,6 @@
-
+
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html index c1f7dba7a..f272c2b53 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.html @@ -1,13 +1,8 @@
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index e7f904677..912a2b4fd 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -92,7 +92,7 @@ export class EditRedactionDialogComponent save(): void { const value = this.form.value; - this.dialogRef.close({ + this.close({ legalBasis: value.reason?.legalBasis ?? '', section: value.section, comment: value.comment, diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index 1e18dd0e3..43e6136a1 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -134,7 +134,11 @@ export class AnnotationActionsService { requests.push(this._manualRedactionService.recategorizeRedactions(recategorizeBody, dossierId, fileId)); } - if (result.comment && requests.length) { + if (!requests.length) { + return; + } + + if (result.comment) { requests.push( from(Promise.all(annotations.map(a => this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId)))), ); diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 27c9f3c29..42bf5941f 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -1,7 +1,7 @@ { "ADMIN_CONTACT_NAME": null, "ADMIN_CONTACT_URL": null, - "API_URL": "https://qa2.iqser.cloud", + "API_URL": "https://dan.iqser.cloud", "APP_NAME": "RedactManager", "IS_DOCUMINE": false, "RULE_EDITOR_DEV_ONLY": false, @@ -13,7 +13,7 @@ "MAX_RETRIES_ON_SERVER_ERROR": 3, "OAUTH_CLIENT_ID": "redaction", "OAUTH_IDP_HINT": null, - "OAUTH_URL": "https://qa2.iqser.cloud/auth", + "OAUTH_URL": "https://dan.iqser.cloud/auth", "RECENT_PERIOD_IN_HOURS": 24, "SELECTION_MODE": "structural", "MANUAL_BASE_URL": "https://docs.redactmanager.com/preview", diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 2efc7d673..74e19c919 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -1239,9 +1239,7 @@ "section": "", "type": "" }, - "title-edit-image": "", - "title-edit-text": "", - "title-hint": "" + "title": "" } }, "entities-listing": { @@ -1927,9 +1925,9 @@ "search": "" } }, + "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers", "toggle-readable-redactions": "", - "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} Kurzinfos für Anmerkungen", - "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers" + "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} Kurzinfos für Anmerkungen" }, "permissions-screen": { "dossier": { @@ -1958,8 +1956,7 @@ "auto-expand-filters-on-action": "", "load-all-annotations-warning": "", "open-structured-view-by-default": "", - "table-extraction-type": "", - "unapproved-suggestions-warning": "" + "table-extraction-type": "" }, "label": "", "title": "", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 748f217ba..a65c84d65 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1239,9 +1239,7 @@ "section": "Paragraph / Location", "type": "Type" }, - "title-edit-image": "Edit image", - "title-edit-text": "Edit redaction", - "title-hint": "Edit hint" + "title": "Edit {type, select, image{Image} hint{Hint} other{Redaction}}" } }, "entities-listing": { @@ -1927,9 +1925,9 @@ "search": "Search for selection" } }, + "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers", "toggle-readable-redactions": "Show redactions {active, select, true{as in final document} false{in preview color} other{}}", - "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips", - "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers" + "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips" }, "permissions-screen": { "dossier": { @@ -1958,8 +1956,7 @@ "auto-expand-filters-on-action": "Auto-expand filters on my actions", "load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview", "open-structured-view-by-default": "Display structured component management modal by default", - "table-extraction-type": "Table extraction type", - "unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode" + "table-extraction-type": "Table extraction type" }, "label": "Preferences", "title": "Edit preferences", diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index 39ee9563b..6745e76d0 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -1239,9 +1239,7 @@ "section": "", "type": "" }, - "title-edit-image": "", - "title-edit-text": "", - "title-hint": "" + "title": "" } }, "entities-listing": { @@ -1927,9 +1925,9 @@ "search": "" } }, + "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers grid", "toggle-readable-redactions": "", - "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} Kurzinfos für Anmerkungen", - "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers grid" + "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} Kurzinfos für Anmerkungen" }, "permissions-screen": { "dossier": { @@ -1958,8 +1956,7 @@ "auto-expand-filters-on-action": "", "load-all-annotations-warning": "", "open-structured-view-by-default": "", - "table-extraction-type": "", - "unapproved-suggestions-warning": "" + "table-extraction-type": "" }, "label": "", "title": "", diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index a188b3726..80fb466b0 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -1239,9 +1239,7 @@ "section": "", "type": "Type" }, - "title-edit-image": "", - "title-edit-text": "Edit annotation", - "title-hint": "" + "title": "Edit annotation" } }, "entities-listing": { @@ -1927,9 +1925,9 @@ "search": "Search for selection" } }, + "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers grid", "toggle-readable-redactions": "Show components {active, select, true{as in final document} false{in preview color} other{}}", - "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips", - "toggle-layers": "{active, select, true{Disable} false{Enable} other{}} layers grid" + "toggle-tooltips": "{active, select, true{Disable} false{Enable} other{}} annotation tooltips" }, "permissions-screen": { "dossier": { @@ -1958,8 +1956,7 @@ "auto-expand-filters-on-action": "Auto expand filters on my actions", "load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview", "open-structured-view-by-default": "Display Component View by default when opening a document", - "table-extraction-type": "Table extraction type", - "unapproved-suggestions-warning": "Warning regarding unapproved suggestions in document Preview mode" + "table-extraction-type": "Table extraction type" }, "label": "Preferences", "title": "Edit preferences", From dee37cfab2c245df5dcc1a8a5a982287cac539d5 Mon Sep 17 00:00:00 2001 From: George Date: Fri, 18 Aug 2023 10:57:06 +0300 Subject: [PATCH 3/3] RED-7069, treat ai/rule based redactions same as dict based, include ocr prefill for ocr hints. --- .../edit-redaction-dialog.component.ts | 11 ++++++++--- .../src/app/modules/file-preview/utils/constants.ts | 2 +- .../services/entity-services/dictionary.service.ts | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 912a2b4fd..5cdc94841 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -48,12 +48,12 @@ export class EditRedactionDialogComponent this.#applyToAllDossiers = this.data.applyToAllDossiers; const annotations = this.data.annotations; const firstEntry = annotations[0]; - this.isImage = IMAGE_CATEGORIES.includes(firstEntry.type); + this.isImage = [...IMAGE_CATEGORIES, 'ocr'].includes(firstEntry.type); this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null; this.isModifyDictionary = firstEntry.isModifyDictionary; this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction; this.isHint = firstEntry.isHint; - this.showExtras = this.isManualRedaction || ((firstEntry.isRedacted || firstEntry.isSkipped) && firstEntry.dictionaryOperation); + this.showExtras = !(this.isImage || this.isHint); this.form = this.#getForm(); } @@ -102,7 +102,12 @@ export class EditRedactionDialogComponent } #setTypes() { - this.dictionaries = this._dictionaryService.getEditableRedactionTypes(this.#dossier.dossierTemplateId, this.isImage, this.isHint); + this.dictionaries = this._dictionaryService.getEditableRedactionTypes( + this.#dossier.dossierTemplateId, + this.isImage, + this.isHint, + this.data.annotations[0].isOCR, + ); } #setOptions(type: string, reasonChanged = false) { diff --git a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts index ac5b4ceb0..093e039e2 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/constants.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/constants.ts @@ -1,6 +1,6 @@ import { List, ValuesOf } from '@iqser/common-ui/lib/utils'; -export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image', 'ocr']; +export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image']; export const ActionsHelpModeKeys = { redaction: 'redaction', 'manual-redaction': 'redaction', diff --git a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts index 59a407b9c..732595cd0 100644 --- a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts +++ b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts @@ -166,14 +166,14 @@ export class DictionaryService extends EntitiesService return dictionaries.sort((a, b) => a.label.localeCompare(b.label)); } - getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean): Dictionary[] { + getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean, isOCR: boolean): Dictionary[] { const types = []; this._dictionariesMapService .get(dossierTemplateId) .filter(d => isImage - ? IMAGE_CATEGORIES.includes(d.type) - : (isHint ? d.hint : !d.hint) && !d.virtual && !IMAGE_CATEGORIES.includes(d.type), + ? (isOCR ? [...IMAGE_CATEGORIES, 'ocr'] : IMAGE_CATEGORIES).includes(d.type) + : (isHint ? d.hint : !d.hint) && !d.virtual && ![...IMAGE_CATEGORIES, 'ocr'].includes(d.type), ) .forEach(d => !types.find(t => t.id === d.id) && types.push(d)); return types.sort((a, b) => a.label.localeCompare(b.label));