RED-7115, add option for marking recommandations as false positives in dossier, update common-ui.
This commit is contained in:
parent
fc4757eabb
commit
a7d1eb115a
@ -17,9 +17,7 @@ export const canMarkAsFalsePositive = (annotation: AnnotationWrapper, annotation
|
||||
annotation.canBeMarkedAsFalsePositive && annotationEntity.hasDictionary;
|
||||
|
||||
export const canRemoveOnlyHere = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
|
||||
canAddRedaction &&
|
||||
!annotation.pending &&
|
||||
(annotation.isRedacted || annotation.isRecommendation || (annotation.isHint && !annotation.isImage));
|
||||
canAddRedaction && !annotation.pending && (annotation.isRedacted || (annotation.isHint && !annotation.isImage));
|
||||
|
||||
export const canRemoveFromDictionary = (annotation: AnnotationWrapper) =>
|
||||
annotation.isModifyDictionary &&
|
||||
|
||||
@ -166,7 +166,10 @@ export class AnnotationActionsService {
|
||||
const result = await this.#getRemoveRedactionDialog(data).result();
|
||||
|
||||
if (result) {
|
||||
if (result.option.value === RemoveRedactionOptions.FALSE_POSITIVE) {
|
||||
if (
|
||||
result.option.value === RemoveRedactionOptions.FALSE_POSITIVE ||
|
||||
result.option.value === RemoveRedactionOptions.DO_NOT_RECOMMEND
|
||||
) {
|
||||
this.#setAsFalsePositive(redaction, result);
|
||||
} else {
|
||||
this.#removeRedaction(redaction, result);
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
import { DetailsRadioOption } from '@iqser/common-ui';
|
||||
import { addHintTranslations } from '@translations/add-hint-translations';
|
||||
import {
|
||||
editRedactionTranslations,
|
||||
redactTextTranslations,
|
||||
removeActionDescriptorTranslations,
|
||||
} from '@translations/redact-text-translations';
|
||||
import { editRedactionTranslations, redactTextTranslations } from '@translations/redact-text-translations';
|
||||
import { Dossier } from '@red/domain';
|
||||
import { removeRedactionTranslations } from '@translations/remove-redaction-translations';
|
||||
import { RemoveRedactionData } from './dialog-types';
|
||||
@ -30,6 +26,7 @@ export const RemoveRedactionOptions = {
|
||||
ONLY_HERE: 'ONLY_HERE',
|
||||
IN_DOSSIER: 'IN_DOSSIER',
|
||||
FALSE_POSITIVE: 'FALSE_POSITIVE',
|
||||
DO_NOT_RECOMMEND: 'DO_NOT_RECOMMEND',
|
||||
} as const;
|
||||
export const RemoveAnnotationOptions = RemoveRedactionOptions;
|
||||
|
||||
@ -151,9 +148,6 @@ export const getRemoveRedactionOptions = (
|
||||
description: translations.ONLY_HERE.description,
|
||||
descriptionParams: {
|
||||
value: redaction.value,
|
||||
type: data.redaction.isRecommendation
|
||||
? removeActionDescriptorTranslations.recommend
|
||||
: removeActionDescriptorTranslations.redact,
|
||||
},
|
||||
icon: PIN_ICON,
|
||||
value: RemoveRedactionOptions.ONLY_HERE,
|
||||
@ -176,20 +170,37 @@ export const getRemoveRedactionOptions = (
|
||||
});
|
||||
}
|
||||
if (permissions.canMarkAsFalsePositive) {
|
||||
options.push({
|
||||
label: translations.FALSE_POSITIVE.label,
|
||||
description: translations.FALSE_POSITIVE.description,
|
||||
descriptionParams: { value: redaction.value, type: redaction.type, context: falsePositiveContext },
|
||||
icon: REMOVE_FROM_DICT_ICON,
|
||||
value: RemoveRedactionOptions.FALSE_POSITIVE,
|
||||
extraOption: !isDocumine
|
||||
? {
|
||||
label: translations.FALSE_POSITIVE.extraOptionLabel,
|
||||
checked: applyToAllDossiers ?? true,
|
||||
hidden: !isApprover,
|
||||
}
|
||||
: null,
|
||||
});
|
||||
if (data.redaction.isRecommendation) {
|
||||
options.push({
|
||||
label: translations.DO_NOT_RECOMMEND.label,
|
||||
description: translations.DO_NOT_RECOMMEND.description,
|
||||
descriptionParams: { value: redaction.value, type: redaction.type, context: falsePositiveContext },
|
||||
icon: FOLDER_ICON,
|
||||
value: RemoveRedactionOptions.DO_NOT_RECOMMEND,
|
||||
extraOption: !isDocumine
|
||||
? {
|
||||
label: translations.DO_NOT_RECOMMEND.extraOptionLabel,
|
||||
checked: applyToAllDossiers ?? true,
|
||||
hidden: !isApprover,
|
||||
}
|
||||
: null,
|
||||
});
|
||||
} else {
|
||||
options.push({
|
||||
label: translations.FALSE_POSITIVE.label,
|
||||
description: translations.FALSE_POSITIVE.description,
|
||||
descriptionParams: { value: redaction.value, type: redaction.type, context: falsePositiveContext },
|
||||
icon: REMOVE_FROM_DICT_ICON,
|
||||
value: RemoveRedactionOptions.FALSE_POSITIVE,
|
||||
extraOption: !isDocumine
|
||||
? {
|
||||
label: translations.FALSE_POSITIVE.extraOptionLabel,
|
||||
checked: applyToAllDossiers ?? true,
|
||||
hidden: !isApprover,
|
||||
}
|
||||
: null,
|
||||
});
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
@ -29,8 +29,3 @@ 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'),
|
||||
};
|
||||
|
||||
@ -15,4 +15,8 @@ export const removeAnnotationTranslations: { [key in RemoveAnnotationOption]: Di
|
||||
label: _('remove-annotation.dialog.content.options.false-positive.label'),
|
||||
description: _('remove-annotation.dialog.content.options.false-positive.description'),
|
||||
},
|
||||
DO_NOT_RECOMMEND: {
|
||||
label: _('remove-redaction.dialog.content.options.do-not-recommend.label'),
|
||||
description: _('remove-redaction.dialog.content.options.do-not-recommend.description'),
|
||||
},
|
||||
};
|
||||
|
||||
@ -17,4 +17,9 @@ export const removeRedactionTranslations: { [key in RemoveRedactionOption]: Dial
|
||||
description: _('remove-redaction.dialog.content.options.false-positive.description'),
|
||||
extraOptionLabel: _('remove-redaction.dialog.content.options.false-positive.extraOptionLabel'),
|
||||
},
|
||||
DO_NOT_RECOMMEND: {
|
||||
label: _('remove-redaction.dialog.content.options.do-not-recommend.label'),
|
||||
description: _('remove-redaction.dialog.content.options.do-not-recommend.description'),
|
||||
extraOptionLabel: _('remove-redaction.dialog.content.options.do-not-recommend.extraOptionLabel'),
|
||||
},
|
||||
};
|
||||
|
||||
@ -2055,6 +2055,11 @@
|
||||
"comment": "",
|
||||
"comment-placeholder": "",
|
||||
"options": {
|
||||
"do-not-recommend": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"false-positive": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
@ -2067,11 +2072,7 @@
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": "",
|
||||
"types": {
|
||||
"recommend": "",
|
||||
"redact": ""
|
||||
}
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -2055,6 +2055,11 @@
|
||||
"comment": "Comment",
|
||||
"comment-placeholder": "Add remarks or mentions ...",
|
||||
"options": {
|
||||
"do-not-recommend": {
|
||||
"description": "Do not recommend \"{value}\" as {type} in any document of the current dossier.",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
"label": "Remove from dossier"
|
||||
},
|
||||
"false-positive": {
|
||||
"description": "\"{value}\" is not a {type} in this context: \"{context}\".",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
@ -2066,12 +2071,8 @@
|
||||
"label": "Remove from dossier"
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Do not {type} \"{value}\" at this position in the current document.",
|
||||
"label": "Remove here",
|
||||
"types": {
|
||||
"recommend": "recommend",
|
||||
"redact": "redact"
|
||||
}
|
||||
"description": "Do not {type, select, undefined{redact} other{type}} \"{value}\" at this position in the current document.",
|
||||
"label": "Remove here"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -2055,6 +2055,11 @@
|
||||
"comment": "",
|
||||
"comment-placeholder": "",
|
||||
"options": {
|
||||
"do-not-recommend": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"false-positive": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
@ -2067,11 +2072,7 @@
|
||||
},
|
||||
"only-here": {
|
||||
"description": "",
|
||||
"label": "",
|
||||
"types": {
|
||||
"recommend": "",
|
||||
"redact": ""
|
||||
}
|
||||
"label": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -2055,6 +2055,11 @@
|
||||
"comment": "Comment",
|
||||
"comment-placeholder": "Add remarks or mentions ...",
|
||||
"options": {
|
||||
"do-not-recommend": {
|
||||
"description": "",
|
||||
"extraOptionLabel": "",
|
||||
"label": ""
|
||||
},
|
||||
"false-positive": {
|
||||
"description": "\"{value}\" is not a {type} in this context: \"{context}\".",
|
||||
"extraOptionLabel": "Apply to all dossiers",
|
||||
@ -2067,11 +2072,7 @@
|
||||
},
|
||||
"only-here": {
|
||||
"description": "Do not {type} \"{value}\" at this position in the current document.",
|
||||
"label": "Remove here",
|
||||
"types": {
|
||||
"recommend": "",
|
||||
"redact": ""
|
||||
}
|
||||
"label": "Remove here"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit fdaf591751c06a5fbeb9f504406cd97c078474e0
|
||||
Subproject commit 5a4ed98aafcc92c437022664787677fcccaf04eb
|
||||
Loading…
x
Reference in New Issue
Block a user