Merge branch 'VM/RED-7761' into 'master'

RED-7761 - Missing fields in Edit Dialog for Signature (redacted images)

Closes RED-7761

See merge request redactmanager/red-ui!200
This commit is contained in:
Nicoleta Panaghiu 2023-11-23 14:33:17 +01:00
commit 67823cfc1d

View File

@ -10,6 +10,8 @@ import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog-
import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types';
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
const SIGNATURE = 'signature';
@Component({
templateUrl: './edit-redaction-dialog.component.html',
styleUrls: ['./edit-redaction-dialog.component.scss'],
@ -26,8 +28,8 @@ export class EditRedactionDialogComponent
readonly isImage: boolean;
readonly isManualRedaction: boolean;
readonly isHint: boolean;
readonly isRedacted: boolean;
readonly allRectangles = this.data.annotations.reduce((acc, a) => acc && a.AREA, true);
readonly showExtras: boolean;
options: DetailsRadioOption<RedactOrHintOption>[] | undefined;
legalOptions: LegalBasisOption[] = [];
dictionaries: Dictionary[] = [];
@ -44,8 +46,7 @@ export class EditRedactionDialogComponent
this.isModifyDictionary = annotations.every(annotation => annotation.isModifyDictionary);
this.isManualRedaction = annotations.every(annotation => annotation.type === SuperTypes.ManualRedaction);
this.isHint = annotations.every(annotation => annotation.HINT);
const isRedacted = annotations.every(annotation => annotation.isRedacted);
this.showExtras = !((this.isImage && !isRedacted) || this.isHint);
this.isRedacted = annotations.every(annotation => annotation.isRedacted);
}
get displayedDictionaryLabel() {
@ -102,9 +103,13 @@ export class EditRedactionDialogComponent
typeChanged() {
const selectedDictionaryType = this.form.controls.type.value;
const isSignature = selectedDictionaryType === SIGNATURE;
this.#setOptions(selectedDictionaryType);
if (this.redactBasedTypes.includes(selectedDictionaryType)) {
if (this.redactBasedTypes.includes(selectedDictionaryType) || (isSignature && !this.allSkipped)) {
if (isSignature) {
this.form.patchValue({ reason: this.initialFormValue.reason, option: this.initialFormValue.option });
}
this.form.controls.reason.enable();
} else {
this.form.patchValue({ reason: null, option: null });
@ -162,4 +167,10 @@ export class EditRedactionDialogComponent
value: new FormControl<string>(this.allRectangles ? this.data.annotations[0].value : null),
});
}
get showExtras() {
const type = this.form.get('type').value;
const isSignature = type === SIGNATURE;
return (isSignature && this.isRedacted) || !(this.isImage || this.isHint);
}
}