RED-5912 - Suggestions make redactions disappear in PREVIEW mode
This commit is contained in:
parent
7da45afb99
commit
4fd6774622
@ -112,6 +112,10 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
return this.type?.toLowerCase() === 'image' || this.image;
|
||||
}
|
||||
|
||||
get isNotSignatureImage() {
|
||||
return this.isImage && this.recategorizationType === 'signature';
|
||||
}
|
||||
|
||||
get isOCR() {
|
||||
return this.type?.toLowerCase() === 'ocr';
|
||||
}
|
||||
@ -192,10 +196,18 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
return this.superType === SuperTypes.SuggestionRecategorizeImage;
|
||||
}
|
||||
|
||||
get isSuggestionForceHint() {
|
||||
return this.superType === SuperTypes.SuggestionForceHint;
|
||||
}
|
||||
|
||||
get isSuggestionAdd() {
|
||||
return !!SuggestionAddSuperTypes[this.superType];
|
||||
}
|
||||
|
||||
get isSuggestionAddDictionary() {
|
||||
return this.superType === SuperTypes.SuggestionAddDictionary;
|
||||
}
|
||||
|
||||
get isSuggestionRemove() {
|
||||
return !!SuggestionRemoveSuperTypes[this.superType];
|
||||
}
|
||||
@ -334,9 +346,14 @@ export class AnnotationWrapper implements IListable, Record<string, unknown> {
|
||||
const entity = dictionaries.find(d => d.type === annotationWrapper.typeValue);
|
||||
annotationWrapper.entity = entity?.virtual ? null : entity;
|
||||
|
||||
const colorKey = annotationWrapper.isSuperTypeBasedColor
|
||||
let colorKey = annotationWrapper.isSuperTypeBasedColor
|
||||
? annotationDefaultColorConfig[annotationWrapper.superType]
|
||||
: annotationEntityColorConfig[annotationWrapper.superType];
|
||||
|
||||
if (annotationWrapper.isSuperTypeBasedColor && annotationWrapper.isSuggestionResize && !annotationWrapper.isModifyDictionary) {
|
||||
colorKey = annotationDefaultColorConfig[SuperTypes.SuggestionAdd];
|
||||
}
|
||||
|
||||
annotationWrapper.color = annotationWrapper.isSuperTypeBasedColor ? defaultColors[colorKey] : (entity[colorKey] as string);
|
||||
|
||||
return annotationWrapper;
|
||||
|
||||
@ -220,7 +220,6 @@ export class FilePreviewScreenComponent
|
||||
|
||||
switch (this._viewModeService.viewMode) {
|
||||
case ViewModes.STANDARD: {
|
||||
this._readableRedactionsService.setAnnotationsColor(redactions, 'annotationColor');
|
||||
const wrappers = await this._fileDataService.annotations;
|
||||
const ocrAnnotationIds = wrappers.filter(a => a.isOCR).map(a => a.id);
|
||||
const standardEntries = annotations
|
||||
@ -229,6 +228,7 @@ export class FilePreviewScreenComponent
|
||||
const nonStandardEntries = annotations.filter(
|
||||
a => bool(a.getCustomData('changeLogRemoved')) || this._annotationManager.isHidden(a.Id),
|
||||
);
|
||||
this._readableRedactionsService.setAnnotationsColor(standardEntries, 'annotationColor');
|
||||
this._readableRedactionsService.setAnnotationsOpacity(standardEntries, true);
|
||||
this._annotationManager.show(standardEntries);
|
||||
this._annotationManager.hide(nonStandardEntries);
|
||||
|
||||
@ -208,7 +208,12 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
const redactionLogCopy = JSON.parse(JSON.stringify(redactionLog));
|
||||
redactionLogCopy.redactionLogEntry = redactionLogCopy.redactionLogEntry?.reduce((filtered, entry) => {
|
||||
const lastChange = entry.manualChanges.at(-1);
|
||||
if (lastChange?.annotationStatus === LogEntryStatuses.REQUESTED && !entry.hint) {
|
||||
|
||||
if (
|
||||
lastChange?.annotationStatus === LogEntryStatuses.REQUESTED &&
|
||||
!entry.hint &&
|
||||
!entry.reason.includes('requested to force hint')
|
||||
) {
|
||||
entry.manualChanges.pop();
|
||||
entry.reason = null;
|
||||
filtered.push(entry);
|
||||
|
||||
@ -27,7 +27,7 @@ export class SuggestionsService {
|
||||
if (this._readableRedactionsService.active) {
|
||||
if (this._userPreferenceService.getDisplaySuggestionsInPreview()) {
|
||||
const suggestionsRemove = annotations.filter(
|
||||
a => bool(a.getCustomData('suggestionRemove')) || bool(a.getCustomData('suggestionRecategorizeImage')),
|
||||
a => bool(a.getCustomData('suggestionRemove')) || bool(a.getCustomData('suggestionForceHint')),
|
||||
);
|
||||
this._annotationManager.hide(suggestionsRemove);
|
||||
return;
|
||||
@ -36,7 +36,7 @@ export class SuggestionsService {
|
||||
const suggestionsToHide = annotations.filter(
|
||||
a =>
|
||||
(bool(a.getCustomData('suggestionAdd')) && !bool(a.getCustomData('suggestionAddToFalsePositive'))) ||
|
||||
bool(a.getCustomData('suggestionRecategorizeImage')),
|
||||
bool(a.getCustomData('notSignatureImage')),
|
||||
);
|
||||
annotations.forEach(a => {
|
||||
if (bool(a.getCustomData('suggestionRemove'))) {
|
||||
@ -52,11 +52,11 @@ export class SuggestionsService {
|
||||
filterWorkloadSuggestionsInPreview(annotations: AnnotationWrapper[]): AnnotationWrapper[] {
|
||||
if (this._readableRedactionsService.active) {
|
||||
if (this._userPreferenceService.getDisplaySuggestionsInPreview()) {
|
||||
return annotations.filter(a => !a.isSuggestionRemove && !a.isSuggestionRecategorizeImage);
|
||||
return annotations.filter(a => !a.isSuggestionRemove && !a.isSuggestionForceHint);
|
||||
}
|
||||
}
|
||||
|
||||
annotations = annotations.filter(a => !a.isSuggestionAdd || a.isSuggestionAddToFalsePositive);
|
||||
annotations = annotations.filter(a => (!a.isSuggestionAdd || a.isSuggestionAddToFalsePositive) && !a.isNotSignatureImage);
|
||||
for (let i = annotations.length - 1; i >= 0; i--) {
|
||||
const foundRemovedRedaction = this.#removedRedactions.find(r => r.id === annotations[i].id);
|
||||
if (foundRemovedRedaction) {
|
||||
|
||||
@ -160,14 +160,21 @@ export class AnnotationDrawService {
|
||||
annotation.setCustomData('suggestionAddToFalsePositive', String(annotationWrapper.isSuggestionAddToFalsePositive));
|
||||
annotation.setCustomData('suggestionRemove', String(annotationWrapper.isSuggestionRemove));
|
||||
annotation.setCustomData('suggestionRecategorizeImage', String(annotationWrapper.isSuggestionRecategorizeImage));
|
||||
annotation.setCustomData('suggestionForceHint', String(annotationWrapper.isSuggestionForceHint));
|
||||
annotation.setCustomData('skipped', String(annotationWrapper.isSkipped));
|
||||
annotation.setCustomData('notSignatureImage', String(annotationWrapper.isNotSignatureImage));
|
||||
annotation.setCustomData('changeLog', String(annotationWrapper.isChangeLogEntry));
|
||||
annotation.setCustomData('changeLogRemoved', String(annotationWrapper.isChangeLogRemoved));
|
||||
annotation.setCustomData('opacity', String(annotation.Opacity));
|
||||
|
||||
const dictionaryRequestColor =
|
||||
annotationWrapper.isSuggestionAddDictionary || (annotationWrapper.isSuggestionResize && annotationWrapper.isModifyDictionary);
|
||||
|
||||
const redactionColor =
|
||||
annotationWrapper.isSuggestion && this._userPreferenceService.getDisplaySuggestionsInPreview()
|
||||
? this._defaultColorsService.getColor(dossierTemplateId, 'requestAddColor')
|
||||
? dictionaryRequestColor
|
||||
? this._defaultColorsService.getColor(dossierTemplateId, 'dictionaryRequestColor')
|
||||
: this._defaultColorsService.getColor(dossierTemplateId, 'requestAddColor')
|
||||
: this._defaultColorsService.getColor(dossierTemplateId, 'previewColor');
|
||||
annotation.setCustomData('redactionColor', String(redactionColor));
|
||||
annotation.setCustomData('annotationColor', String(annotationWrapper.color));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user