Merge branch 'RED-7487' into 'master'
RED-7487, deduplicate dossier_redaction dictionary in redact text dialog Closes RED-7487 See merge request redactmanager/red-ui!43
This commit is contained in:
commit
a84b14f17a
@ -149,34 +149,23 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
||||
}
|
||||
|
||||
getRedactTextDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean): Dictionary[] {
|
||||
const dictionaries: Dictionary[] = [];
|
||||
|
||||
this._dictionariesMapService.get(dossierTemplateId).forEach((d: Dictionary) => {
|
||||
if (!d.hint && d.addToDictionaryAction) {
|
||||
if (dossierDictionaryOnly) {
|
||||
dictionaries.push(d);
|
||||
} else {
|
||||
if (!d.dossierDictionaryOnly) {
|
||||
dictionaries.push(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||
return this._dictionariesMapService
|
||||
.get(dossierTemplateId)
|
||||
.filter(d => d.model['typeId'] && !d.hint && d.addToDictionaryAction && (dossierDictionaryOnly || !d.dossierDictionaryOnly))
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean, isOCR: boolean): Dictionary[] {
|
||||
const types = [];
|
||||
this._dictionariesMapService
|
||||
return this._dictionariesMapService
|
||||
.get(dossierTemplateId)
|
||||
.filter(d =>
|
||||
isImage
|
||||
? (isOCR ? [...IMAGE_CATEGORIES, 'ocr'] : IMAGE_CATEGORIES).includes(d.type)
|
||||
: (isHint ? d.hint : !d.hint) && !d.virtual && !d.systemManaged && ![...IMAGE_CATEGORIES, 'ocr'].includes(d.type),
|
||||
.filter(
|
||||
d =>
|
||||
d.model['typeId'] &&
|
||||
(isImage
|
||||
? (isOCR ? [...IMAGE_CATEGORIES, 'ocr'] : IMAGE_CATEGORIES).includes(d.type)
|
||||
: (isHint ? d.hint : !d.hint) && !d.virtual && !d.systemManaged && ![...IMAGE_CATEGORIES, 'ocr'].includes(d.type)),
|
||||
)
|
||||
.forEach(d => !types.find(t => t.id === d.id) && types.push(d));
|
||||
return types.sort((a, b) => a.label.localeCompare(b.label));
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
}
|
||||
|
||||
getAddHintDictionaries(dossierTemplateId: string, dossierDictionaryOnly: boolean, dictionaryRequest: boolean): Dictionary[] {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user