Merge branch 'RED-10484' into 'master'
RED-10484: removed multiplePages option for imported rectangles. See merge request redactmanager/red-ui!713
This commit is contained in:
commit
7c719b4d26
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user