RED-10484: removed multiplePages option for imported rectangles.

This commit is contained in:
Nicoleta Panaghiu 2024-11-21 14:47:52 +02:00
parent c02863b079
commit 4e3de53e45
3 changed files with 17 additions and 12 deletions

View File

@ -82,14 +82,14 @@ export class EditRedactionDialogComponent
readonly isManualRedaction = this.annotations.some(annotation => annotation.type === SuperTypes.ManualRedaction);
readonly isHint = this.annotations.every(annotation => annotation.HINT || annotation.IMAGE_HINT);
readonly isRedacted = this.annotations.every(annotation => annotation.isRedacted);
readonly isImported: boolean = this.annotations.every(annotation => annotation.imported);
readonly isImported: boolean = this.annotations.every(annotation => annotation.imported || annotation.type === 'imported_redaction');
readonly allRectangles = this.annotations.reduce((acc, a) => acc && a.AREA, true);
readonly tableColumns: ValueColumn[] = [{ label: 'Value' }, { label: 'Type' }];
readonly tableData: ValueColumn[][] = this.data.annotations.map(redaction => [
{ label: redaction.value, bold: true },
{ label: redaction.typeLabel },
]);
options = this.allRectangles ? getRectangleRedactOptions('edit') : getEditRedactionOptions(this.isHint);
options = this.allRectangles ? getRectangleRedactOptions('edit', this.data.annotations) : getEditRedactionOptions(this.isHint);
legalOptions: LegalBasisOption[] = [];
dictionaries: Dictionary[] = [];
typeSelectOptions: TypeSelectOptions[] = [];
@ -104,8 +104,7 @@ export class EditRedactionDialogComponent
private readonly _dictionaryService: DictionaryService,
) {
super();
if (this.allRectangles) {
if (this.allRectangles && !this.isImported) {
prefillPageRange(
this.data.annotations[0],
this.data.allFileAnnotations,

View File

@ -104,6 +104,9 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
extra: false,
},
};
readonly isImported: boolean = this.data.redactions.every(
annotation => annotation.imported || annotation.type === 'imported_redaction',
);
readonly allRectangles = this.data.redactions.reduce((acc, a) => acc && a.AREA, true);
readonly #applyToAllDossiers = this.systemDefaultByType[this.annotationsType].extra;
readonly isSystemDefault = this.optionByType[this.annotationsType].main === SystemDefaultOption.SYSTEM_DEFAULT;
@ -113,7 +116,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
: this.optionByType[this.annotationsType].main;
readonly extraOptionPreference = stringToBoolean(this.optionByType[this.annotationsType].extra);
readonly options: DetailsRadioOption<RectangleRedactOption | RemoveRedactionOption>[] = this.allRectangles
? getRectangleRedactOptions('remove', this.data)
? getRectangleRedactOptions('remove', this.data.redactions)
: getRemoveRedactionOptions(
this.data,
this.isSystemDefault || this.isExtraOptionSystemDefault ? this.#applyToAllDossiers : this.extraOptionPreference,
@ -151,7 +154,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
) {
super();
if (this.allRectangles) {
if (this.allRectangles && !this.isImported) {
prefillPageRange(
this.data.redactions[0],
this.data.allFileRedactions,

View File

@ -104,12 +104,11 @@ export const getRedactOrHintOptions = (
export const getRectangleRedactOptions = (
action: 'add' | 'edit' | 'remove' = 'add',
data?: RemoveRedactionData,
redactions: AnnotationWrapper[] = [],
): DetailsRadioOption<RectangleRedactOption>[] => {
const translations =
action === 'add' ? rectangleRedactTranslations : action === 'edit' ? editRectangleTranslations : removeRectangleTranslations;
const redactions = data?.redactions ?? [];
return [
const options: DetailsRadioOption<RectangleRedactOption>[] = [
{
label: translations.onlyThisPage.label,
description: translations.onlyThisPage.description,
@ -117,7 +116,10 @@ export const getRectangleRedactOptions = (
icon: PIN_ICON,
value: RectangleRedactOptions.ONLY_THIS_PAGE,
},
{
];
const isImportedWithoutValue = redactions.some(redaction => redaction.type === 'imported_redaction' && !redaction.value);
if (!['edit', 'remove'].includes(action) || !isImportedWithoutValue) {
options.push({
label: translations.multiplePages.label,
description: translations.multiplePages.description,
descriptionParams: { length: redactions.length },
@ -130,8 +132,9 @@ export const getRectangleRedactOptions = (
value: '',
errorCode: 'invalidRange',
},
},
];
});
}
return options;
};
export const getResizeRedactionOptions = (