RED-7115, update remove redaction dialog.

This commit is contained in:
George 2023-08-03 14:35:26 +03:00
parent db45d2e8b9
commit c39f3087fa
11 changed files with 48 additions and 14 deletions

View File

@ -17,7 +17,9 @@ 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 && !annotation.pending && (annotation.isRedacted || (annotation.isHint && !annotation.isImage)); canAddRedaction &&
!annotation.pending &&
(annotation.isRedacted || annotation.isRecommendation || (annotation.isHint && !annotation.isImage));
export const canRemoveFromDictionary = (annotation: AnnotationWrapper) => export const canRemoveFromDictionary = (annotation: AnnotationWrapper) =>
annotation.isModifyDictionary && annotation.isModifyDictionary &&

View File

@ -8,12 +8,12 @@
<div class="iqser-input-group w-450"> <div class="iqser-input-group w-450">
<label [translate]="'remove-annotation.dialog.content.comment'"></label> <label [translate]="'remove-annotation.dialog.content.comment'"></label>
<textarea <textarea
[placeholder]="'remove-annotation.dialog.content.comment-placeholder' | translate"
formControlName="comment" formControlName="comment"
iqserHasScrollbar iqserHasScrollbar
name="comment" name="comment"
rows="4" rows="4"
type="text" type="text"
[placeholder]="'remove-annotation.dialog.content.comment-placeholder' | translate"
></textarea> ></textarea>
</div> </div>
</div> </div>
@ -26,7 +26,7 @@
> >
</iqser-icon-button> </iqser-icon-button>
<div class="all-caps-label cancel" mat-dialog-close [translate]="'remove-annotation.dialog.actions.cancel'"></div> <div [translate]="'remove-annotation.dialog.actions.cancel'" class="all-caps-label cancel" mat-dialog-close></div>
</div> </div>
</form> </form>

View File

@ -1,7 +1,9 @@
<section class="dialog"> <section class="dialog">
<form (submit)="save()" [formGroup]="form"> <form (submit)="save()" [formGroup]="form">
<div <div
[innerHTML]="'remove-redaction.dialog.title' | translate : { type: hint ? 'hint' : 'redaction' }" [innerHTML]="
'remove-redaction.dialog.title' | translate : { type: hint ? 'hint' : recommendation ? 'recommendation' : 'redaction' }
"
class="dialog-header heading-l" class="dialog-header heading-l"
></div> ></div>
@ -11,12 +13,12 @@
<div class="iqser-input-group w-450"> <div class="iqser-input-group w-450">
<label [translate]="'remove-redaction.dialog.content.comment'"></label> <label [translate]="'remove-redaction.dialog.content.comment'"></label>
<textarea <textarea
[placeholder]="'remove-redaction.dialog.content.comment-placeholder' | translate"
formControlName="comment" formControlName="comment"
iqserHasScrollbar iqserHasScrollbar
name="comment" name="comment"
rows="4" rows="4"
type="text" type="text"
[placeholder]="'remove-redaction.dialog.content.comment-placeholder' | translate"
></textarea> ></textarea>
</div> </div>
</div> </div>
@ -29,7 +31,7 @@
> >
</iqser-icon-button> </iqser-icon-button>
<div class="all-caps-label cancel" mat-dialog-close [translate]="'remove-redaction.dialog.actions.cancel'"></div> <div [translate]="'remove-redaction.dialog.actions.cancel'" class="all-caps-label cancel" mat-dialog-close></div>
</div> </div>
</form> </form>

View File

@ -17,7 +17,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
> { > {
readonly iconButtonTypes = IconButtonTypes; readonly iconButtonTypes = IconButtonTypes;
readonly options: DetailsRadioOption<RemoveRedactionOption>[]; readonly options: DetailsRadioOption<RemoveRedactionOption>[];
readonly isRecommendation = this.data.redaction.isRecommendation; readonly recommendation = this.data.redaction.isRecommendation;
form!: UntypedFormGroup; form!: UntypedFormGroup;
hint: boolean; hint: boolean;

View File

@ -1,6 +1,10 @@
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 { editRedactionTranslations, redactTextTranslations } from '@translations/redact-text-translations'; import {
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';
@ -145,7 +149,12 @@ export const getRemoveRedactionOptions = (
options.push({ options.push({
label: translations.ONLY_HERE.label, label: translations.ONLY_HERE.label,
description: translations.ONLY_HERE.description, description: translations.ONLY_HERE.description,
descriptionParams: { value: redaction.value }, descriptionParams: {
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,
}); });

View File

@ -29,3 +29,8 @@ 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'),
};

View File

@ -2066,7 +2066,11 @@
}, },
"only-here": { "only-here": {
"description": "", "description": "",
"label": "" "label": "",
"types": {
"recommend": "",
"redact": ""
}
} }
} }
}, },

View File

@ -2066,7 +2066,11 @@
}, },
"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": "recommend",
"redact": "redact"
}
} }
} }
}, },

View File

@ -2066,7 +2066,11 @@
}, },
"only-here": { "only-here": {
"description": "", "description": "",
"label": "" "label": "",
"types": {
"recommend": "",
"redact": ""
}
} }
} }
}, },

View File

@ -2066,7 +2066,11 @@
}, },
"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 b1b8ce2e49cb087908b347193c25d0db33de0d01 Subproject commit 60b0d502ae203f5eb48ea81aed7051c2f3c6de71