RED-7887 - UI saves the last saved dictionary in compare and no longer updates itself after selecting another template

This commit is contained in:
Valentin Mihai 2023-11-21 12:44:38 +02:00
parent bcd9527696
commit f08500b61b

View File

@ -143,7 +143,7 @@ export class DictionaryManagerComponent implements OnChanges, OnInit {
this._dictionariesMapService.get(this.#compareDictionary.dossierTemplateId, this.#compareDictionary.type).getEntries(this.type);
if (entries.length) {
this.diffEditorText = this.#toString([...entries]);
this.diffEditorText = entries.join('\n');
this.showDiffEditor = true;
return;
}
@ -152,7 +152,7 @@ export class DictionaryManagerComponent implements OnChanges, OnInit {
.getForType(this.#compareDictionary.dossierTemplateId, this.#compareDictionary.type)
.then(values => {
this.#compareDictionary.setEntries([...values[DICTIONARY_TYPE_KEY_MAP[this.type]]] ?? [], this.type);
this.diffEditorText = this.#toString([...(this.#compareDictionary.getEntries(this.type) as string[])]);
this.diffEditorText = [...(this.#compareDictionary.getEntries(this.type) as string[])].join('\n');
this.showDiffEditor = true;
this._changeRef.markForCheck();
this._loadingService.stop();
@ -296,10 +296,6 @@ export class DictionaryManagerComponent implements OnChanges, OnInit {
: this.activeEntryType === DictionaryEntryTypes.FALSE_POSITIVE
? [...dictionary.falsePositiveEntries]
: [...dictionary.falseRecommendationEntries];
return this.#toString(activeEntries);
}
#toString(entries: string[]): string {
return entries.sort((a, b) => a.localeCompare(b)).join('\n');
return activeEntries.join('\n');
}
}