RED-5108: added redact functionality for hint images.

This commit is contained in:
Nicoleta Panaghiu 2024-06-03 13:07:14 +03:00
parent ca7c145457
commit 050b0bc55a
8 changed files with 21 additions and 5 deletions

View File

@ -8,7 +8,10 @@ export const canForceHint = (annotation: AnnotationWrapper, canAddRedaction: boo
canAddRedaction && annotation.isIgnoredHint && !annotation.pending;
export const canForceRedaction = (annotation: AnnotationWrapper, canAddRedaction: boolean) =>
canAddRedaction && annotation.isSkipped && !annotation.isFalsePositive && !annotation.pending;
canAddRedaction &&
(annotation.isSkipped || (annotation.IMAGE_HINT && !annotation.hasBeenForcedRedaction)) &&
!annotation.isFalsePositive &&
!annotation.pending;
export const canAcceptRecommendation = (annotation: AnnotationWrapper) => annotation.isRecommendation && !annotation.pending;

View File

@ -108,7 +108,7 @@
[tooltip]="'annotation-actions.force-redaction.label' | translate"
[type]="buttonType"
[buttonId]="annotations.length === 1 ? 'annotation-' + annotations[0].id + '-force_redaction' : 'annotations-force_redaction'"
icon="iqser:thumb-up"
[icon]="isImageHint ? 'red:pdftron-action-add-redaction' : 'iqser:thumb-up'"
></iqser-circle-button>
<iqser-circle-button

View File

@ -58,6 +58,10 @@ export class AnnotationActionsComponent implements OnChanges {
return this.#annotations;
}
get isImageHint(): boolean {
return this.annotations.every(annotation => annotation.IMAGE_HINT);
}
@Input()
set annotations(annotations: AnnotationWrapper[]) {
this.#annotations = annotations.filter(a => a !== undefined);

View File

@ -8,6 +8,7 @@
[columns]="tableColumns"
[data]="tableData"
[staticColumns]="true"
*ngIf="!isImageHint"
></redaction-selected-annotations-table>
<div *ngIf="!isHintDialog && !isDocumine" class="iqser-input-group required w-400">
<label [translate]="'manual-annotation.dialog.content.reason'"></label>

View File

@ -53,6 +53,10 @@ export class ForceAnnotationDialogComponent extends BaseDialogComponent implemen
this.form = this.#getForm();
}
get isImageHint() {
return this._data.annotations.every(annotation => annotation.IMAGE_HINT);
}
get isHintDialog() {
return this._data.hint;
}

View File

@ -81,8 +81,11 @@ export class PdfAnnotationActionsService {
}
if (permissions.canForceRedaction && annotationChangesAllowed) {
const forceRedactionButton = this.#getButton('thumb-up', _('annotation-actions.force-redaction.label'), () =>
this.#annotationActionsService.forceAnnotation(annotations),
const isImageHint = annotations.every(annotation => annotation.IMAGE_HINT);
const forceRedactionButton = this.#getButton(
isImageHint ? 'general/pdftron-action-add-redaction' : 'thumb-up',
_('annotation-actions.force-redaction.label'),
() => this.#annotationActionsService.forceAnnotation(annotations),
);
availableActions.push(forceRedactionButton);
}

View File

@ -86,6 +86,7 @@ export class IconsModule {
'visibility',
'visibility-off',
'warning',
'pdftron-action-add-redaction',
];
for (const icon of icons) {

View File

@ -88,7 +88,7 @@ export const SuperTypeMapper: Record<EntityType, Record<EntryState, (entry: IEnt
[EntryStates.PENDING]: entry => resolveRedactionType(entry),
},
[EntityTypes.IMAGE_HINT]: {
[EntryStates.APPLIED]: wrongSuperTypeHandler,
[EntryStates.APPLIED]: entry => resolveRedactionType(entry),
[EntryStates.SKIPPED]: () => SuperTypes.Hint,
[EntryStates.IGNORED]: () => SuperTypes.IgnoredHint,
[EntryStates.REMOVED]: wrongSuperTypeHandler,