RED-7069, treat ai/rule based redactions same as dict based, include ocr prefill for ocr hints.
This commit is contained in:
parent
75c4d111a0
commit
dee37cfab2
@ -48,12 +48,12 @@ export class EditRedactionDialogComponent
|
|||||||
this.#applyToAllDossiers = this.data.applyToAllDossiers;
|
this.#applyToAllDossiers = this.data.applyToAllDossiers;
|
||||||
const annotations = this.data.annotations;
|
const annotations = this.data.annotations;
|
||||||
const firstEntry = annotations[0];
|
const firstEntry = annotations[0];
|
||||||
this.isImage = IMAGE_CATEGORIES.includes(firstEntry.type);
|
this.isImage = [...IMAGE_CATEGORIES, 'ocr'].includes(firstEntry.type);
|
||||||
this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null;
|
this.redactedText = annotations.length === 1 && !this.isImage ? firstEntry.value : null;
|
||||||
this.isModifyDictionary = firstEntry.isModifyDictionary;
|
this.isModifyDictionary = firstEntry.isModifyDictionary;
|
||||||
this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction;
|
this.isManualRedaction = firstEntry.type === SuperTypes.ManualRedaction;
|
||||||
this.isHint = firstEntry.isHint;
|
this.isHint = firstEntry.isHint;
|
||||||
this.showExtras = this.isManualRedaction || ((firstEntry.isRedacted || firstEntry.isSkipped) && firstEntry.dictionaryOperation);
|
this.showExtras = !(this.isImage || this.isHint);
|
||||||
this.form = this.#getForm();
|
this.form = this.#getForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,12 @@ export class EditRedactionDialogComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
#setTypes() {
|
#setTypes() {
|
||||||
this.dictionaries = this._dictionaryService.getEditableRedactionTypes(this.#dossier.dossierTemplateId, this.isImage, this.isHint);
|
this.dictionaries = this._dictionaryService.getEditableRedactionTypes(
|
||||||
|
this.#dossier.dossierTemplateId,
|
||||||
|
this.isImage,
|
||||||
|
this.isHint,
|
||||||
|
this.data.annotations[0].isOCR,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#setOptions(type: string, reasonChanged = false) {
|
#setOptions(type: string, reasonChanged = false) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { List, ValuesOf } from '@iqser/common-ui/lib/utils';
|
import { List, ValuesOf } from '@iqser/common-ui/lib/utils';
|
||||||
|
|
||||||
export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image', 'ocr'];
|
export const IMAGE_CATEGORIES: readonly string[] = ['signature', 'logo', 'formula', 'image'];
|
||||||
export const ActionsHelpModeKeys = {
|
export const ActionsHelpModeKeys = {
|
||||||
redaction: 'redaction',
|
redaction: 'redaction',
|
||||||
'manual-redaction': 'redaction',
|
'manual-redaction': 'redaction',
|
||||||
|
|||||||
@ -166,14 +166,14 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
|
|||||||
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
return dictionaries.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
}
|
}
|
||||||
|
|
||||||
getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean): Dictionary[] {
|
getEditableRedactionTypes(dossierTemplateId: string, isImage: boolean, isHint: boolean, isOCR: boolean): Dictionary[] {
|
||||||
const types = [];
|
const types = [];
|
||||||
this._dictionariesMapService
|
this._dictionariesMapService
|
||||||
.get(dossierTemplateId)
|
.get(dossierTemplateId)
|
||||||
.filter(d =>
|
.filter(d =>
|
||||||
isImage
|
isImage
|
||||||
? IMAGE_CATEGORIES.includes(d.type)
|
? (isOCR ? [...IMAGE_CATEGORIES, 'ocr'] : IMAGE_CATEGORIES).includes(d.type)
|
||||||
: (isHint ? d.hint : !d.hint) && !d.virtual && !IMAGE_CATEGORIES.includes(d.type),
|
: (isHint ? d.hint : !d.hint) && !d.virtual && ![...IMAGE_CATEGORIES, 'ocr'].includes(d.type),
|
||||||
)
|
)
|
||||||
.forEach(d => !types.find(t => t.id === d.id) && types.push(d));
|
.forEach(d => !types.find(t => t.id === d.id) && types.push(d));
|
||||||
return types.sort((a, b) => a.label.localeCompare(b.label));
|
return types.sort((a, b) => a.label.localeCompare(b.label));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user