From c39f3087faee4bde00ce18a8d55395669c9ebbf0 Mon Sep 17 00:00:00 2001 From: George Date: Thu, 3 Aug 2023 14:35:26 +0300 Subject: [PATCH] RED-7115, update remove redaction dialog. --- .../app/models/file/annotation-permissions.utils.ts | 4 +++- .../remove-annotation-dialog.component.html | 4 ++-- .../remove-redaction-dialog.component.html | 8 +++++--- .../remove-redaction-dialog.component.ts | 2 +- .../modules/file-preview/utils/dialog-options.ts | 13 +++++++++++-- .../app/translations/redact-text-translations.ts | 5 +++++ apps/red-ui/src/assets/i18n/redact/de.json | 6 +++++- apps/red-ui/src/assets/i18n/redact/en.json | 6 +++++- apps/red-ui/src/assets/i18n/scm/de.json | 6 +++++- apps/red-ui/src/assets/i18n/scm/en.json | 6 +++++- libs/common-ui | 2 +- 11 files changed, 48 insertions(+), 14 deletions(-) diff --git a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts index f158e3354..516445c5b 100644 --- a/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts +++ b/apps/red-ui/src/app/models/file/annotation-permissions.utils.ts @@ -17,7 +17,9 @@ export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotation annotation.canBeMarkedAsFalsePositive && annotationEntity.hasDictionary; export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean) => - canAddRedaction && !annotation.pending && (annotation.isRedacted || (annotation.isHint && !annotation.isImage)); + canAddRedaction && + !annotation.pending && + (annotation.isRedacted || annotation.isRecommendation || (annotation.isHint && !annotation.isImage)); export const canRemoveFromDictionary = (annotation: AnnotationWrapper) => annotation.isModifyDictionary && diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.html index 30b92426c..bd37014b1 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/docu-mine/remove-annotation-dialog/remove-annotation-dialog.component.html @@ -8,12 +8,12 @@
@@ -26,7 +26,7 @@ > -
+
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html index 556a20194..2afd68543 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.html @@ -1,7 +1,9 @@
@@ -11,12 +13,12 @@
@@ -29,7 +31,7 @@ > -
+
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts index 6ffd20905..1593aec54 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts @@ -17,7 +17,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< > { readonly iconButtonTypes = IconButtonTypes; readonly options: DetailsRadioOption[]; - readonly isRecommendation = this.data.redaction.isRecommendation; + readonly recommendation = this.data.redaction.isRecommendation; form!: UntypedFormGroup; hint: boolean; diff --git a/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts b/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts index 8298a2281..9c5962597 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/dialog-options.ts @@ -1,6 +1,10 @@ import { DetailsRadioOption } from '@iqser/common-ui'; import { addHintTranslations } from '@translations/add-hint-translations'; -import { editRedactionTranslations, redactTextTranslations } from '@translations/redact-text-translations'; +import { + editRedactionTranslations, + redactTextTranslations, + removeActionDescriptorTranslations, +} from '@translations/redact-text-translations'; import { Dossier } from '@red/domain'; import { removeRedactionTranslations } from '@translations/remove-redaction-translations'; import { RemoveRedactionData } from './dialog-types'; @@ -145,7 +149,12 @@ export const getRemoveRedactionOptions = ( options.push({ label: translations.ONLY_HERE.label, description: translations.ONLY_HERE.description, - descriptionParams: { value: redaction.value }, + descriptionParams: { + value: redaction.value, + type: data.redaction.isRecommendation + ? removeActionDescriptorTranslations.recommend + : removeActionDescriptorTranslations.redact, + }, icon: PIN_ICON, value: RemoveRedactionOptions.ONLY_HERE, }); diff --git a/apps/red-ui/src/app/translations/redact-text-translations.ts b/apps/red-ui/src/app/translations/redact-text-translations.ts index 5c149848b..65953bf11 100644 --- a/apps/red-ui/src/app/translations/redact-text-translations.ts +++ b/apps/red-ui/src/app/translations/redact-text-translations.ts @@ -29,3 +29,8 @@ export const editRedactionTranslations: Record<'onlyHere' | 'inDossier', DialogO extraOptionLabel: _('edit-redaction.dialog.content.options.in-dossier.extraOptionLabel'), }, } as const; + +export const removeActionDescriptorTranslations = { + redact: _('remove-redaction.dialog.content.options.only-here.types.redact'), + recommend: _('remove-redaction.dialog.content.options.only-here.types.recommend'), +}; diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 945a774fe..61652dca4 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -2066,7 +2066,11 @@ }, "only-here": { "description": "", - "label": "" + "label": "", + "types": { + "recommend": "", + "redact": "" + } } } }, diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 1d31bc6fb..84402e32d 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -2066,7 +2066,11 @@ }, "only-here": { "description": "Do not {type} \"{value}\" at this position in the current document.", - "label": "Remove here" + "label": "Remove here", + "types": { + "recommend": "recommend", + "redact": "redact" + } } } }, diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index c52f9eeef..98d1522a1 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -2066,7 +2066,11 @@ }, "only-here": { "description": "", - "label": "" + "label": "", + "types": { + "recommend": "", + "redact": "" + } } } }, diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index e9817afce..a31b8bebd 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -2066,7 +2066,11 @@ }, "only-here": { "description": "Do not {type} \"{value}\" at this position in the current document.", - "label": "Remove here" + "label": "Remove here", + "types": { + "recommend": "", + "redact": "" + } } } }, diff --git a/libs/common-ui b/libs/common-ui index b1b8ce2e4..60b0d502a 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit b1b8ce2e49cb087908b347193c25d0db33de0d01 +Subproject commit 60b0d502ae203f5eb48ea81aed7051c2f3c6de71