From 3631df461924a62341021bbb4899536f58214ef9 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Wed, 22 Nov 2023 18:52:27 +0200 Subject: [PATCH 1/4] RED-7761 - Missing fields in Edit Dialog for Signature (redacted images) --- .../edit-redaction-dialog.component.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 123006f92..7cee4dbe2 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -26,8 +26,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[] | undefined; legalOptions: LegalBasisOption[] = []; dictionaries: Dictionary[] = []; @@ -44,8 +44,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() { @@ -104,6 +103,8 @@ export class EditRedactionDialogComponent const selectedDictionaryType = this.form.controls.type.value; this.#setOptions(selectedDictionaryType); + console.log(this.redactBasedTypes); + console.log(selectedDictionaryType); if (this.redactBasedTypes.includes(selectedDictionaryType)) { this.form.controls.reason.enable(); } else { @@ -162,4 +163,10 @@ export class EditRedactionDialogComponent value: new FormControl(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); + } } From d45490ccaf096528fcde5ad47c29d29c8c702073 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 23 Nov 2023 14:40:03 +0200 Subject: [PATCH 2/4] RED-7761 - Missing fields in Edit Dialog for Signature (redacted images) --- .../edit-redaction-dialog.component.ts | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 7cee4dbe2..a13c08778 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -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'], @@ -88,24 +90,21 @@ export class EditRedactionDialogComponent description: lbm.description, label: lbm.name, })); - - const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis); - const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis); - this.form.patchValue({ - reason: sameLegalBasis ? reason : null, - }); - this.legalOptions.sort((a, b) => a.label.localeCompare(b.label)); + this.#resetReason(); this.initialFormValue = this.form.getRawValue(); + console.log(JSON.stringify(this.form.getRawValue())); } typeChanged() { const selectedDictionaryType = this.form.controls.type.value; + const isSignature = selectedDictionaryType === SIGNATURE; this.#setOptions(selectedDictionaryType); - console.log(this.redactBasedTypes); - console.log(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 }); @@ -124,6 +123,14 @@ export class EditRedactionDialogComponent }); } + #resetReason() { + const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis); + const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis); + this.form.patchValue({ + reason: sameLegalBasis ? reason : null, + }); + } + #setTypes() { this.dictionaries = this._dictionaryService.getEditableRedactionTypes( this.#dossier.dossierTemplateId, @@ -166,7 +173,7 @@ export class EditRedactionDialogComponent get showExtras() { const type = this.form.get('type').value; - const isSignature = type === 'signature'; + const isSignature = type === SIGNATURE; return (isSignature && this.isRedacted) || !(this.isImage || this.isHint); } } From 86c83311c770313c99263324f3a9a06973d93952 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 23 Nov 2023 14:41:00 +0200 Subject: [PATCH 3/4] RED-7761 - removed logs --- .../edit-redaction-dialog/edit-redaction-dialog.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index a13c08778..45f46c2a1 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -93,7 +93,6 @@ export class EditRedactionDialogComponent this.legalOptions.sort((a, b) => a.label.localeCompare(b.label)); this.#resetReason(); this.initialFormValue = this.form.getRawValue(); - console.log(JSON.stringify(this.form.getRawValue())); } typeChanged() { From fe83a9c75a3fde805211e32c32c96eb7bf7bdf37 Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 23 Nov 2023 15:29:33 +0200 Subject: [PATCH 4/4] RED-7761 - removed reset reason method --- .../edit-redaction-dialog.component.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 45f46c2a1..f82044acc 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -90,8 +90,14 @@ export class EditRedactionDialogComponent description: lbm.description, label: lbm.name, })); + + const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis); + const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis); + this.form.patchValue({ + reason: sameLegalBasis ? reason : null, + }); + this.legalOptions.sort((a, b) => a.label.localeCompare(b.label)); - this.#resetReason(); this.initialFormValue = this.form.getRawValue(); } @@ -122,14 +128,6 @@ export class EditRedactionDialogComponent }); } - #resetReason() { - const reason = this.legalOptions.find(o => o.legalBasis === this.data.annotations[0].legalBasis); - const sameLegalBasis = this.data.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis); - this.form.patchValue({ - reason: sameLegalBasis ? reason : null, - }); - } - #setTypes() { this.dictionaries = this._dictionaryService.getEditableRedactionTypes( this.#dossier.dossierTemplateId,