From 9fb08bde8f7b9b8487ac025bfa3302ed0a66400b Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Thu, 10 Aug 2023 13:16:28 +0300 Subject: [PATCH] RED-7041 - filtered types by the new rules --- .../redact-text-dialog.component.ts | 5 +++-- .../entity-services/dictionary.service.ts | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts index 236db50b8..dc2cb0bb2 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts @@ -54,7 +54,9 @@ export class RedactTextDialogComponent .valueChanges.pipe( tap((option: DetailsRadioOption) => { this.dictionaryRequest = option.value === RedactOrHintOptions.IN_DOSSIER; - this.#setDictionaries(); + if (this.dictionaryRequest) { + this.#setDictionaries(); + } this.#resetValues(); }), takeUntilDestroyed(), @@ -78,7 +80,6 @@ export class RedactTextDialogComponent } async ngOnInit(): Promise { - this.#setDictionaries(); const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.#dossier.dossierTemplateId)); this.legalOptions = data.map(lbm => ({ legalBasis: lbm.reason, diff --git a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts index 254e3d71e..84c2497e0 100644 --- a/apps/red-ui/src/app/services/entity-services/dictionary.service.ts +++ b/apps/red-ui/src/app/services/entity-services/dictionary.service.ts @@ -152,13 +152,14 @@ export class DictionaryService extends EntitiesService const dictionaries: Dictionary[] = []; this._dictionariesMapService.get(dossierTemplateId).forEach((d: Dictionary) => { - if ( - !d.hint && - d.addToDictionaryAction && - ((!d.virtual && !d.systemManaged && d.hasDictionary && !d.dossierDictionaryOnly) || - (dossierDictionaryOnly && d.dossierDictionaryOnly)) - ) { - dictionaries.push(d); + if (!d.hint && d.addToDictionaryAction) { + if (dossierDictionaryOnly) { + dictionaries.push(d); + } else { + if (!d.dossierDictionaryOnly) { + dictionaries.push(d); + } + } } }); @@ -187,7 +188,7 @@ export class DictionaryService extends EntitiesService dictionaries.push(d); } } - } else if (!d.dossierDictionaryOnly && !IMAGE_TYPES.includes(d.type)) { + } else if (!IMAGE_TYPES.includes(d.type)) { dictionaries.push(d); } }