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