diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/rectangle-annotation-dialog/rectangle-annotation-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/rectangle-annotation-dialog/rectangle-annotation-dialog.component.ts index 2427d4aa4..0fd48e9db 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/rectangle-annotation-dialog/rectangle-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/rectangle-annotation-dialog/rectangle-annotation-dialog.component.ts @@ -170,10 +170,6 @@ export class RectangleAnnotationDialog } for (let page = startPage; page <= endPage; page++) { - if (page === wrapper.manualRedactionEntry.positions[0].page) { - continue; - } - wrapper.manualRedactionEntry.pageNumbers.push(page); } }); diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts index 7ce207c0c..b7c80d8ed 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-redaction-dialog/remove-redaction-dialog.component.ts @@ -112,7 +112,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< readonly redactedTexts = this.data.redactions.map(annotation => annotation.value); form: UntypedFormGroup = this._formBuilder.group({ comment: [null], - option: [this.defaultOption, validatePageRange()], + option: [this.defaultOption, validatePageRange(true)], }); readonly selectedOption = toSignal(this.form.get('option').valueChanges.pipe(map(value => value.value))); @@ -177,6 +177,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< } save(): void { + const optionValue = this.form.controls.option.value.value; const pageNumbers = parseSelectedPageNumbers( this.form.get('option').value.additionalInput?.value, this.data.file, @@ -186,7 +187,7 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent< this.close({ ...this.form.getRawValue(), - bulkLocal: this.form.controls.option.value.value === ResizeOptions.IN_DOCUMENT, + bulkLocal: optionValue === ResizeOptions.IN_DOCUMENT || optionValue === RectangleRedactOptions.MULTIPLE_PAGES, pageNumbers, position, }); diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index d0d81ee5c..04bae147e 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -596,20 +596,13 @@ export class AnnotationActionsService { ): List | IBulkLocalRemoveRequest { if (dialogResult.bulkLocal || !!dialogResult.pageNumbers.length) { const redaction = redactions[0]; - if (redaction.value === NON_READABLE_CONTENT) { - return { - value: redaction.value, - rectangle: true, - originTypes: [redaction.entry.type], - pageNumbers: dialogResult.pageNumbers, - position: dialogResult.position, - comment: dialogResult.comment, - }; - } - return { value: redaction.value, - rectangle: false, + rectangle: redaction.value === NON_READABLE_CONTENT, + originTypes: [redaction.entry.type], + originLegalBases: [redaction.legalBasis], + pageNumbers: dialogResult.pageNumbers, + position: dialogResult.position, comment: dialogResult.comment, }; } diff --git a/apps/red-ui/src/app/modules/file-preview/utils/enhance-manual-redaction-request.utils.ts b/apps/red-ui/src/app/modules/file-preview/utils/enhance-manual-redaction-request.utils.ts index bdf220456..3a28bf209 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/enhance-manual-redaction-request.utils.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/enhance-manual-redaction-request.utils.ts @@ -65,10 +65,6 @@ export const parseSelectedPageNumbers = (inputValue: string, file: File, annotat } for (let page = startPage; page <= endPage; page++) { - if (page === annotation.positions[0].page) { - continue; - } - pageNumbers.push(page); } }); @@ -77,12 +73,9 @@ export const parseSelectedPageNumbers = (inputValue: string, file: File, annotat }; export const parseRectanglePosition = (annotation: AnnotationWrapper) => { - if (annotation.AREA) { - const position = annotation.positions[0]; - return { - rectangle: [position.topLeft.x, position.topLeft.y, position.width, position.height], - pageNumber: position.page, - } as IEntityLogEntryPosition; - } - return null; + const position = annotation.positions[0]; + return { + rectangle: [position.topLeft.x, position.topLeft.y, position.width, position.height], + pageNumber: position.page, + } as IEntityLogEntryPosition; }; diff --git a/apps/red-ui/src/app/modules/file-preview/utils/form-validators.ts b/apps/red-ui/src/app/modules/file-preview/utils/form-validators.ts index 233aed553..b66980731 100644 --- a/apps/red-ui/src/app/modules/file-preview/utils/form-validators.ts +++ b/apps/red-ui/src/app/modules/file-preview/utils/form-validators.ts @@ -1,11 +1,12 @@ import { AbstractControl, ValidatorFn } from '@angular/forms'; -export const validatePageRange = (): ValidatorFn => { +export const validatePageRange = (allowEmpty = false): ValidatorFn => { return (control: AbstractControl): { [key: string]: any } | null => { const option = control.value; if (option?.additionalInput) { - const validRange = /^(\d+(-\d+)?)(,\d+(-\d+)?)*$/.test(option.additionalInput.value); - return validRange ? null : { invalidRange: true }; + const value = option.additionalInput.value; + const validRange = /^(\d+(-\d+)?)(,\d+(-\d+)?)*$/.test(value); + return validRange || (!value.length && allowEmpty) ? null : { invalidRange: true }; } return null; };