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 isManualRedaction = this.annotations.some(annotation => annotation.type === SuperTypes.ManualRedaction);
|
||||||
readonly isHint = this.annotations.every(annotation => annotation.HINT || annotation.IMAGE_HINT);
|
readonly isHint = this.annotations.every(annotation => annotation.HINT || annotation.IMAGE_HINT);
|
||||||
readonly isRedacted = this.annotations.every(annotation => annotation.isRedacted);
|
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 allRectangles = this.annotations.reduce((acc, a) => acc && a.AREA, true);
|
||||||
readonly tableColumns: ValueColumn[] = [{ label: 'Value' }, { label: 'Type' }];
|
readonly tableColumns: ValueColumn[] = [{ label: 'Value' }, { label: 'Type' }];
|
||||||
readonly tableData: ValueColumn[][] = this.data.annotations.map(redaction => [
|
readonly tableData: ValueColumn[][] = this.data.annotations.map(redaction => [
|
||||||
{ label: redaction.value, bold: true },
|
{ label: redaction.value, bold: true },
|
||||||
{ label: redaction.typeLabel },
|
{ label: redaction.typeLabel },
|
||||||
]);
|
]);
|
||||||
options = this.allRectangles ? getRectangleRedactOptions('edit') : getEditRedactionOptions(this.isHint);
|
options = this.allRectangles ? getRectangleRedactOptions('edit', this.data.annotations) : getEditRedactionOptions(this.isHint);
|
||||||
legalOptions: LegalBasisOption[] = [];
|
legalOptions: LegalBasisOption[] = [];
|
||||||
dictionaries: Dictionary[] = [];
|
dictionaries: Dictionary[] = [];
|
||||||
typeSelectOptions: TypeSelectOptions[] = [];
|
typeSelectOptions: TypeSelectOptions[] = [];
|
||||||
@ -104,8 +104,7 @@ export class EditRedactionDialogComponent
|
|||||||
private readonly _dictionaryService: DictionaryService,
|
private readonly _dictionaryService: DictionaryService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
if (this.allRectangles && !this.isImported) {
|
||||||
if (this.allRectangles) {
|
|
||||||
prefillPageRange(
|
prefillPageRange(
|
||||||
this.data.annotations[0],
|
this.data.annotations[0],
|
||||||
this.data.allFileAnnotations,
|
this.data.allFileAnnotations,
|
||||||
|
|||||||
@ -104,6 +104,9 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
|||||||
extra: false,
|
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 allRectangles = this.data.redactions.reduce((acc, a) => acc && a.AREA, true);
|
||||||
readonly #applyToAllDossiers = this.systemDefaultByType[this.annotationsType].extra;
|
readonly #applyToAllDossiers = this.systemDefaultByType[this.annotationsType].extra;
|
||||||
readonly isSystemDefault = this.optionByType[this.annotationsType].main === SystemDefaultOption.SYSTEM_DEFAULT;
|
readonly isSystemDefault = this.optionByType[this.annotationsType].main === SystemDefaultOption.SYSTEM_DEFAULT;
|
||||||
@ -113,7 +116,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
|||||||
: this.optionByType[this.annotationsType].main;
|
: this.optionByType[this.annotationsType].main;
|
||||||
readonly extraOptionPreference = stringToBoolean(this.optionByType[this.annotationsType].extra);
|
readonly extraOptionPreference = stringToBoolean(this.optionByType[this.annotationsType].extra);
|
||||||
readonly options: DetailsRadioOption<RectangleRedactOption | RemoveRedactionOption>[] = this.allRectangles
|
readonly options: DetailsRadioOption<RectangleRedactOption | RemoveRedactionOption>[] = this.allRectangles
|
||||||
? getRectangleRedactOptions('remove', this.data)
|
? getRectangleRedactOptions('remove', this.data.redactions)
|
||||||
: getRemoveRedactionOptions(
|
: getRemoveRedactionOptions(
|
||||||
this.data,
|
this.data,
|
||||||
this.isSystemDefault || this.isExtraOptionSystemDefault ? this.#applyToAllDossiers : this.extraOptionPreference,
|
this.isSystemDefault || this.isExtraOptionSystemDefault ? this.#applyToAllDossiers : this.extraOptionPreference,
|
||||||
@ -151,7 +154,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
|
|||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (this.allRectangles) {
|
if (this.allRectangles && !this.isImported) {
|
||||||
prefillPageRange(
|
prefillPageRange(
|
||||||
this.data.redactions[0],
|
this.data.redactions[0],
|
||||||
this.data.allFileRedactions,
|
this.data.allFileRedactions,
|
||||||
|
|||||||
@ -104,12 +104,11 @@ export const getRedactOrHintOptions = (
|
|||||||
|
|
||||||
export const getRectangleRedactOptions = (
|
export const getRectangleRedactOptions = (
|
||||||
action: 'add' | 'edit' | 'remove' = 'add',
|
action: 'add' | 'edit' | 'remove' = 'add',
|
||||||
data?: RemoveRedactionData,
|
redactions: AnnotationWrapper[] = [],
|
||||||
): DetailsRadioOption<RectangleRedactOption>[] => {
|
): DetailsRadioOption<RectangleRedactOption>[] => {
|
||||||
const translations =
|
const translations =
|
||||||
action === 'add' ? rectangleRedactTranslations : action === 'edit' ? editRectangleTranslations : removeRectangleTranslations;
|
action === 'add' ? rectangleRedactTranslations : action === 'edit' ? editRectangleTranslations : removeRectangleTranslations;
|
||||||
const redactions = data?.redactions ?? [];
|
const options: DetailsRadioOption<RectangleRedactOption>[] = [
|
||||||
return [
|
|
||||||
{
|
{
|
||||||
label: translations.onlyThisPage.label,
|
label: translations.onlyThisPage.label,
|
||||||
description: translations.onlyThisPage.description,
|
description: translations.onlyThisPage.description,
|
||||||
@ -117,7 +116,10 @@ export const getRectangleRedactOptions = (
|
|||||||
icon: PIN_ICON,
|
icon: PIN_ICON,
|
||||||
value: RectangleRedactOptions.ONLY_THIS_PAGE,
|
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,
|
label: translations.multiplePages.label,
|
||||||
description: translations.multiplePages.description,
|
description: translations.multiplePages.description,
|
||||||
descriptionParams: { length: redactions.length },
|
descriptionParams: { length: redactions.length },
|
||||||
@ -130,8 +132,9 @@ export const getRectangleRedactOptions = (
|
|||||||
value: '',
|
value: '',
|
||||||
errorCode: 'invalidRange',
|
errorCode: 'invalidRange',
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
];
|
}
|
||||||
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getResizeRedactionOptions = (
|
export const getResizeRedactionOptions = (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user