RED-3643: Fix skipped image becomes hint after resize
This commit is contained in:
parent
73b241c5c2
commit
d21372c83c
@ -228,8 +228,8 @@ export class AnnotationWrapper implements Record<string, unknown> {
|
||||
|
||||
annotationWrapper.annotationId = entry.id;
|
||||
annotationWrapper.pageNumber = entry.positions[0].page;
|
||||
annotationWrapper.superType = 'text-highlight';
|
||||
annotationWrapper.typeValue = 'text-highlight';
|
||||
annotationWrapper.superType = SuperTypes.TextHighlight;
|
||||
annotationWrapper.typeValue = SuperTypes.TextHighlight;
|
||||
annotationWrapper.value = 'Imported';
|
||||
annotationWrapper.color = color;
|
||||
annotationWrapper.positions = entry.positions;
|
||||
@ -293,14 +293,14 @@ export class AnnotationWrapper implements Record<string, unknown> {
|
||||
}
|
||||
|
||||
private static _handleRecommendations(annotationWrapper: AnnotationWrapper, redactionLogEntry: RedactionLogEntry) {
|
||||
if (annotationWrapper.superType === 'recommendation') {
|
||||
if (annotationWrapper.superType === SuperTypes.Recommendation) {
|
||||
annotationWrapper.recommendationType = redactionLogEntry.type.substr('recommendation_'.length);
|
||||
}
|
||||
}
|
||||
|
||||
private static _setSuperType(annotationWrapper: AnnotationWrapper, redactionLogEntryWrapper: RedactionLogEntry) {
|
||||
if (redactionLogEntryWrapper.recommendation && !redactionLogEntryWrapper.redacted) {
|
||||
annotationWrapper.superType = 'recommendation';
|
||||
annotationWrapper.superType = SuperTypes.Recommendation;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -320,13 +320,13 @@ export class AnnotationWrapper implements Record<string, unknown> {
|
||||
}
|
||||
} else {
|
||||
if (redactionLogEntryWrapper.recommendation) {
|
||||
annotationWrapper.superType = 'recommendation';
|
||||
annotationWrapper.superType = SuperTypes.Recommendation;
|
||||
} else if (redactionLogEntryWrapper.redacted) {
|
||||
annotationWrapper.superType = 'redaction';
|
||||
annotationWrapper.superType = SuperTypes.Redaction;
|
||||
} else if (redactionLogEntryWrapper.hint) {
|
||||
annotationWrapper.superType = 'hint';
|
||||
annotationWrapper.superType = SuperTypes.Hint;
|
||||
} else {
|
||||
annotationWrapper.superType = 'skipped';
|
||||
annotationWrapper.superType = SuperTypes.Skipped;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -376,61 +376,61 @@ export class AnnotationWrapper implements Record<string, unknown> {
|
||||
case ManualRedactionType.ADD_LOCALLY:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
return 'manual-redaction';
|
||||
return SuperTypes.ManualRedaction;
|
||||
case LogEntryStatus.DECLINED:
|
||||
return 'declined-suggestion';
|
||||
return SuperTypes.DeclinedSuggestion;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-add';
|
||||
return SuperTypes.SuggestionAdd;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.ADD_TO_DICTIONARY:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
return isHintDictionary ? 'hint' : 'redaction';
|
||||
return isHintDictionary ? SuperTypes.Hint : SuperTypes.Redaction;
|
||||
case LogEntryStatus.DECLINED:
|
||||
return 'declined-suggestion';
|
||||
return SuperTypes.DeclinedSuggestion;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-add-dictionary';
|
||||
return SuperTypes.SuggestionAddDictionary;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.REMOVE_LOCALLY:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
return isHintDictionary ? 'ignored-hint' : 'skipped';
|
||||
return isHintDictionary ? SuperTypes.IgnoredHint : SuperTypes.Skipped;
|
||||
case LogEntryStatus.DECLINED:
|
||||
return isHintDictionary ? 'hint' : redactionLogEntry.redacted ? 'redaction' : 'skipped';
|
||||
return isHintDictionary ? SuperTypes.Hint : redactionLogEntry.redacted ? SuperTypes.Redaction : SuperTypes.Skipped;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-remove';
|
||||
return SuperTypes.SuggestionRemove;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.REMOVE_FROM_DICTIONARY:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
return 'skipped';
|
||||
return SuperTypes.Skipped;
|
||||
case LogEntryStatus.DECLINED:
|
||||
return 'redaction';
|
||||
return SuperTypes.Redaction;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-remove-dictionary';
|
||||
return SuperTypes.SuggestionRemoveDictionary;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.FORCE_REDACT:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
return 'redaction';
|
||||
return SuperTypes.Redaction;
|
||||
case LogEntryStatus.DECLINED:
|
||||
return 'skipped';
|
||||
return SuperTypes.Skipped;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-force-redaction';
|
||||
return SuperTypes.SuggestionForceRedaction;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.FORCE_HINT:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
return 'hint';
|
||||
return SuperTypes.Hint;
|
||||
case LogEntryStatus.DECLINED:
|
||||
return 'ignored-hint';
|
||||
return SuperTypes.IgnoredHint;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-force-hint';
|
||||
return SuperTypes.SuggestionForceHint;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.RECATEGORIZE:
|
||||
@ -438,26 +438,26 @@ export class AnnotationWrapper implements Record<string, unknown> {
|
||||
case LogEntryStatus.APPROVED:
|
||||
case LogEntryStatus.DECLINED: {
|
||||
if (redactionLogEntry.recommendation) {
|
||||
return 'recommendation';
|
||||
return SuperTypes.Recommendation;
|
||||
} else if (redactionLogEntry.redacted) {
|
||||
return 'redaction';
|
||||
return SuperTypes.Redaction;
|
||||
} else if (redactionLogEntry.hint) {
|
||||
return 'hint';
|
||||
return SuperTypes.Hint;
|
||||
} else {
|
||||
return 'skipped';
|
||||
return SuperTypes.Skipped;
|
||||
}
|
||||
}
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-recategorize-image';
|
||||
return SuperTypes.SuggestionRecategorizeImage;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.LEGAL_BASIS_CHANGE:
|
||||
switch (lastManualChange.annotationStatus) {
|
||||
case LogEntryStatus.APPROVED:
|
||||
case LogEntryStatus.DECLINED:
|
||||
return redactionLogEntry.type === 'manual' ? 'manual-redaction' : 'redaction';
|
||||
return redactionLogEntry.type === 'manual' ? SuperTypes.ManualRedaction : SuperTypes.Redaction;
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-change-legal-basis';
|
||||
return SuperTypes.SuggestionChangeLegalBasis;
|
||||
}
|
||||
break;
|
||||
case ManualRedactionType.RESIZE:
|
||||
@ -465,13 +465,16 @@ export class AnnotationWrapper implements Record<string, unknown> {
|
||||
case LogEntryStatus.APPROVED:
|
||||
case LogEntryStatus.DECLINED:
|
||||
if (redactionLogEntry.recommendation) {
|
||||
return 'recommendation';
|
||||
return SuperTypes.Recommendation;
|
||||
} else if (redactionLogEntry.redacted) {
|
||||
return redactionLogEntry.type === 'manual' ? 'manual-redaction' : 'redaction';
|
||||
return redactionLogEntry.type === 'manual' ? SuperTypes.ManualRedaction : SuperTypes.Redaction;
|
||||
} else if (redactionLogEntry.hint) {
|
||||
return SuperTypes.Hint;
|
||||
} else {
|
||||
return SuperTypes.Skipped;
|
||||
}
|
||||
return 'hint';
|
||||
case LogEntryStatus.REQUESTED:
|
||||
return 'suggestion-resize';
|
||||
return SuperTypes.SuggestionResize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import { PdfViewer } from './pdf-viewer.service';
|
||||
import { FilePreviewStateService } from './file-preview-state.service';
|
||||
import { ViewModeService } from './view-mode.service';
|
||||
import { FileDataService } from './file-data.service';
|
||||
import { SuperTypes } from '@models/file/super-types';
|
||||
import Annotation = Core.Annotations.Annotation;
|
||||
|
||||
@Injectable()
|
||||
@ -47,12 +48,12 @@ export class AnnotationDrawService {
|
||||
getColor(superType: string, dictionary?: string) {
|
||||
let color: string;
|
||||
switch (superType) {
|
||||
case 'hint':
|
||||
case 'redaction':
|
||||
case 'recommendation':
|
||||
case SuperTypes.Hint:
|
||||
case SuperTypes.Redaction:
|
||||
case SuperTypes.Recommendation:
|
||||
color = this._dictionariesMapService.getDictionaryColor(dictionary, this._state.dossierTemplateId);
|
||||
break;
|
||||
case 'skipped':
|
||||
case SuperTypes.Skipped:
|
||||
color = this._dictionariesMapService.getDictionaryColor(superType, this._state.dossierTemplateId);
|
||||
break;
|
||||
default:
|
||||
@ -151,7 +152,7 @@ export class AnnotationDrawService {
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotationWrapper.superType === 'text-highlight') {
|
||||
if (annotationWrapper.superType === SuperTypes.TextHighlight) {
|
||||
const rectangleAnnot = new this._pdf.Annotations.RectangleAnnotation();
|
||||
const pageHeight = this._pdf.documentViewer.getPageHeight(pageNumber);
|
||||
const rectangle: IRectangle = annotationWrapper.positions[0];
|
||||
|
||||
@ -10,6 +10,7 @@ import { FALLBACK_COLOR } from '@utils/constants';
|
||||
import { hexToRgb } from '@utils/functions';
|
||||
import { FileAttributesService } from '@services/entity-services/file-attributes.service';
|
||||
import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';
|
||||
import { SuperTypes } from '@models/file/super-types';
|
||||
|
||||
const MIN_WORD_LENGTH = 2;
|
||||
|
||||
@ -234,24 +235,24 @@ export class DictionaryService extends EntitiesService<Dictionary, IDictionary>
|
||||
hint: false,
|
||||
recommendation: false,
|
||||
},
|
||||
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: 'declined-suggestion' },
|
||||
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: SuperTypes.DeclinedSuggestion },
|
||||
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'manual' },
|
||||
{ hexColor: colors.ignoredHintColor || FALLBACK_COLOR, type: 'ignored-hint' },
|
||||
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: 'manual-redaction' },
|
||||
{ hexColor: colors.ignoredHintColor || FALLBACK_COLOR, type: SuperTypes.IgnoredHint },
|
||||
{ hexColor: colors.manualRedactionColor || FALLBACK_COLOR, type: SuperTypes.ManualRedaction },
|
||||
// dictionary actions
|
||||
{ hexColor: '#c5d3eb', type: 'recommendation' },
|
||||
{ hexColor: '#c5d3eb', type: SuperTypes.Recommendation },
|
||||
{ hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'remove-only-here' },
|
||||
// generic suggestions
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion' },
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion-add' },
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionAdd },
|
||||
// add suggestions
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion-change-legal-basis' },
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'suggestion-recategorize-image' },
|
||||
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: 'suggestion-add-dictionary' },
|
||||
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: 'suggestion-resize' },
|
||||
{ hexColor: colors.requestRemove || FALLBACK_COLOR, type: 'suggestion-remove' },
|
||||
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: 'suggestion-remove-dictionary' },
|
||||
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: 'skipped' },
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionChangeLegalBasis },
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: SuperTypes.SuggestionRecategorizeImage },
|
||||
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionAddDictionary },
|
||||
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionResize },
|
||||
{ hexColor: colors.requestRemove || FALLBACK_COLOR, type: SuperTypes.SuggestionRemove },
|
||||
{ hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR, type: SuperTypes.SuggestionRemoveDictionary },
|
||||
{ hexColor: colors.notRedacted || FALLBACK_COLOR, type: SuperTypes.Skipped },
|
||||
{ hexColor: colors.defaultColor || FALLBACK_COLOR, type: 'default' },
|
||||
{ hexColor: colors.requestAdd || FALLBACK_COLOR, type: 'add' },
|
||||
{ hexColor: colors.analysisColor || FALLBACK_COLOR, type: 'analysis' },
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { SuperType } from '@models/file/super-types';
|
||||
import { SuperType, SuperTypes } from '@models/file/super-types';
|
||||
|
||||
export const annotationTypesTranslations: { [key in SuperType]: string } = {
|
||||
'text-highlight': _('annotation-type.text-highlight'),
|
||||
'declined-suggestion': _('annotation-type.declined-suggestion'),
|
||||
hint: _('annotation-type.hint'),
|
||||
'ignored-hint': _('annotation-type.ignored-hint'),
|
||||
'manual-redaction': _('annotation-type.manual-redaction'),
|
||||
recommendation: _('annotation-type.recommendation'),
|
||||
redaction: _('annotation-type.redaction'),
|
||||
skipped: _('annotation-type.skipped'),
|
||||
'suggestion-add': _('annotation-type.suggestion-add'),
|
||||
'suggestion-add-dictionary': _('annotation-type.suggestion-add-dictionary'),
|
||||
'suggestion-change-legal-basis': _('annotation-type.suggestion-change-legal-basis'),
|
||||
'suggestion-recategorize-image': _('annotation-type.suggestion-recategorize-image'),
|
||||
'suggestion-force-redaction': _('annotation-type.suggestion-force-redaction'),
|
||||
'suggestion-force-hint': _('annotation-type.suggestion-force-hint'),
|
||||
'suggestion-remove': _('annotation-type.suggestion-remove'),
|
||||
'suggestion-remove-dictionary': _('annotation-type.suggestion-remove-dictionary'),
|
||||
'suggestion-resize': _('annotation-type.suggestion-resize'),
|
||||
[SuperTypes.TextHighlight]: _('annotation-type.text-highlight'),
|
||||
[SuperTypes.DeclinedSuggestion]: _('annotation-type.declined-suggestion'),
|
||||
[SuperTypes.Hint]: _('annotation-type.hint'),
|
||||
[SuperTypes.IgnoredHint]: _('annotation-type.ignored-hint'),
|
||||
[SuperTypes.ManualRedaction]: _('annotation-type.manual-redaction'),
|
||||
[SuperTypes.Recommendation]: _('annotation-type.recommendation'),
|
||||
[SuperTypes.Redaction]: _('annotation-type.redaction'),
|
||||
[SuperTypes.Skipped]: _('annotation-type.skipped'),
|
||||
[SuperTypes.SuggestionAdd]: _('annotation-type.suggestion-add'),
|
||||
[SuperTypes.SuggestionAddDictionary]: _('annotation-type.suggestion-add-dictionary'),
|
||||
[SuperTypes.SuggestionChangeLegalBasis]: _('annotation-type.suggestion-change-legal-basis'),
|
||||
[SuperTypes.SuggestionRecategorizeImage]: _('annotation-type.suggestion-recategorize-image'),
|
||||
[SuperTypes.SuggestionForceRedaction]: _('annotation-type.suggestion-force-redaction'),
|
||||
[SuperTypes.SuggestionForceHint]: _('annotation-type.suggestion-force-hint'),
|
||||
[SuperTypes.SuggestionRemove]: _('annotation-type.suggestion-remove'),
|
||||
[SuperTypes.SuggestionRemoveDictionary]: _('annotation-type.suggestion-remove-dictionary'),
|
||||
[SuperTypes.SuggestionResize]: _('annotation-type.suggestion-resize'),
|
||||
} as const;
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import { SuperType } from '@models/file/super-types';
|
||||
import { SuperType, SuperTypes } from '@models/file/super-types';
|
||||
|
||||
export const SuperTypeSorter: { [key in SuperType]: number } = {
|
||||
'text-highlight': 100,
|
||||
'suggestion-change-legal-basis': 14,
|
||||
'suggestion-force-redaction': 15,
|
||||
'suggestion-force-hint': 16,
|
||||
'suggestion-recategorize-image': 17,
|
||||
'suggestion-resize': 18,
|
||||
recommendation: 7,
|
||||
'suggestion-add-dictionary': 12,
|
||||
'suggestion-remove-dictionary': 13,
|
||||
'suggestion-add': 10,
|
||||
'suggestion-remove': 11,
|
||||
'ignored-hint': 45,
|
||||
skipped: 50,
|
||||
redaction: 1,
|
||||
'manual-redaction': 2,
|
||||
hint: 19,
|
||||
'declined-suggestion': 20,
|
||||
[SuperTypes.TextHighlight]: 100,
|
||||
[SuperTypes.SuggestionChangeLegalBasis]: 14,
|
||||
[SuperTypes.SuggestionForceRedaction]: 15,
|
||||
[SuperTypes.SuggestionForceHint]: 16,
|
||||
[SuperTypes.SuggestionRecategorizeImage]: 17,
|
||||
[SuperTypes.SuggestionResize]: 18,
|
||||
[SuperTypes.Recommendation]: 7,
|
||||
[SuperTypes.SuggestionAddDictionary]: 12,
|
||||
[SuperTypes.SuggestionRemoveDictionary]: 13,
|
||||
[SuperTypes.SuggestionAdd]: 10,
|
||||
[SuperTypes.SuggestionRemove]: 11,
|
||||
[SuperTypes.IgnoredHint]: 45,
|
||||
[SuperTypes.Skipped]: 50,
|
||||
[SuperTypes.Redaction]: 1,
|
||||
[SuperTypes.ManualRedaction]: 2,
|
||||
[SuperTypes.Hint]: 19,
|
||||
[SuperTypes.DeclinedSuggestion]: 20,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user