rework annotation types

This commit is contained in:
Timo Bejan 2021-11-10 09:25:17 +02:00
parent 96032bbe78
commit 4a30d9b3f3
8 changed files with 34 additions and 43 deletions

View File

@ -5,13 +5,13 @@ import { IComment, IPoint, IRectangle } from '@red/domain';
export type AnnotationSuperType =
| 'add-dictionary'
| 'remove-dictionary'
| 'remove-only-here'
| 'change-legal-basis'
| 'suggestion-change-legal-basis'
| 'suggestion-recategorize-image'
| 'suggestion-add-dictionary'
| 'suggestion-force-redaction'
| 'suggestion-resize'
| 'suggestion-remove-dictionary'
| 'suggestion-add'
| 'suggestion-remove'
@ -20,7 +20,6 @@ export type AnnotationSuperType =
| 'manual-redaction'
| 'recommendation'
| 'hint'
| 'pending-analysis'
| 'declined-suggestion';
export class AnnotationWrapper {
@ -122,13 +121,7 @@ export class AnnotationWrapper {
}
get isReadyForAnalysis() {
return (
this.superType === 'add-dictionary' ||
this.superType === 'remove-dictionary' ||
this.superType === 'remove-only-here' ||
this.superType === 'pending-analysis' ||
this.superType === 'change-legal-basis'
);
return this.superType === 'add-dictionary' || this.superType === 'remove-only-here' || this.superType === 'change-legal-basis';
}
get isApproved() {
@ -246,6 +239,13 @@ export class AnnotationWrapper {
return;
}
if (redactionLogEntryWrapper.manualRedactionType === 'RESIZE') {
if (redactionLogEntryWrapper.status === 'REQUESTED') {
annotationWrapper.superType = 'suggestion-resize';
return;
}
}
if (redactionLogEntryWrapper.manualRedactionType === 'FORCE_REDACT') {
annotationWrapper.force = true;
@ -371,7 +371,13 @@ export class AnnotationWrapper {
if (redactionLogEntryWrapper.status === 'APPROVED') {
if (redactionLogEntryWrapper.dictionaryEntry) {
annotationWrapper.superType =
redactionLogEntryWrapper.manualRedactionType === 'ADD' ? 'add-dictionary' : 'remove-dictionary';
redactionLogEntryWrapper.manualRedactionType === 'ADD'
? 'add-dictionary'
: annotationWrapper.redaction
? 'redaction'
: annotationWrapper.hint
? 'hint'
: 'skipped';
} else {
annotationWrapper.superType =
redactionLogEntryWrapper.manualRedactionType === 'ADD' ? 'manual-redaction' : 'remove-only-here';

View File

@ -17,7 +17,7 @@ export interface RedactionLogEntryWrapper {
id?: string;
legalBasis?: string;
manual?: boolean;
manualRedactionType?: 'ADD' | 'REMOVE' | 'UNDO' | 'LEGAL_BASIS_CHANGE' | 'FORCE_REDACT' | 'RECATEGORIZE';
manualRedactionType?: 'ADD' | 'REMOVE' | 'LEGAL_BASIS_CHANGE' | 'FORCE_REDACT' | 'RECATEGORIZE' | 'RESIZE';
matchedRule?: number;
positions?: Array<IRectangle>;
reason?: string;

View File

@ -20,14 +20,7 @@ export class TypeFilterComponent implements OnInit {
'suggestion-remove-dictionary',
'suggestion-add-dictionary',
];
private _needsAnalysisKeys = [
'add-dictionary',
'remove-dictionary',
'remove-only-here',
'pending-analysis',
'change-legal-basis',
'analysis',
];
private _needsAnalysisKeys = ['add-dictionary', 'remove-only-here', 'change-legal-basis', 'analysis'];
constructor(private readonly _appStateService: AppStateService) {}

View File

@ -338,6 +338,7 @@ export class AppStateService {
},
true,
);
// dictionary actions
dictionaryData['add-dictionary'] = new Dictionary(
{
@ -346,13 +347,7 @@ export class AppStateService {
},
true,
);
dictionaryData['remove-dictionary'] = new Dictionary(
{
hexColor: colors.analysisColor || FALLBACK_COLOR,
type: 'remove-dictionary',
},
true,
);
dictionaryData['remove-only-here'] = new Dictionary(
{
hexColor: colors.analysisColor || FALLBACK_COLOR,
@ -376,6 +371,7 @@ export class AppStateService {
},
true,
);
// add suggestions
dictionaryData['suggestion-change-legal-basis'] = new Dictionary(
{
@ -384,6 +380,7 @@ export class AppStateService {
},
true,
);
dictionaryData['suggestion-recategorize-image'] = new Dictionary(
{
hexColor: colors.requestAdd || FALLBACK_COLOR,
@ -391,6 +388,7 @@ export class AppStateService {
},
true,
);
dictionaryData['suggestion-add-dictionary'] = new Dictionary(
{
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
@ -399,6 +397,14 @@ export class AppStateService {
true,
);
dictionaryData['suggestion-resize'] = new Dictionary(
{
hexColor: colors.dictionaryRequestColor || FALLBACK_COLOR,
type: 'suggestion-resize',
},
true,
);
dictionaryData['suggestion-remove'] = new Dictionary(
{
hexColor: colors.requestRemove || FALLBACK_COLOR,
@ -447,14 +453,6 @@ export class AppStateService {
true,
);
dictionaryData['pending-analysis'] = new Dictionary(
{
hexColor: colors.analysisColor || FALLBACK_COLOR,
type: 'analysis',
},
true,
);
dictionaryData['change-legal-basis'] = new Dictionary(
{
hexColor: colors.analysisColor || FALLBACK_COLOR,

View File

@ -7,10 +7,8 @@ export const annotationTypesTranslations: { [key in AnnotationSuperType]: string
'declined-suggestion': _('annotation-type.declined-suggestion'),
hint: _('annotation-type.hint'),
'manual-redaction': _('annotation-type.manual-redaction'),
'pending-analysis': _('annotation-type.pending-analysis'),
recommendation: _('annotation-type.recommendation'),
redaction: _('annotation-type.redaction'),
'remove-dictionary': _('annotation-type.remove-dictionary'),
'remove-only-here': _('annotation-type.remove-only-here'),
skipped: _('annotation-type.skipped'),
'suggestion-add': _('annotation-type.suggestion-add'),
@ -20,4 +18,5 @@ export const annotationTypesTranslations: { [key in AnnotationSuperType]: string
'suggestion-force-redaction': _('annotation-type.suggestion-force-redaction'),
'suggestion-remove': _('annotation-type.suggestion-remove'),
'suggestion-remove-dictionary': _('annotation-type.suggestion-remove-dictionary'),
'suggestion-resize': _('annotation-type.suggestion-resize'),
} as const;

View File

@ -4,10 +4,9 @@ export const SuperTypeSorter: { [key in AnnotationSuperType]: number } = {
'suggestion-change-legal-basis': 14,
'suggestion-force-redaction': 15,
'suggestion-recategorize-image': 16,
'suggestion-resize': 18,
recommendation: 7,
'add-dictionary': 2,
'remove-dictionary': 3,
'pending-analysis': 4,
'change-legal-basis': 5,
'remove-only-here': 6,
'suggestion-add-dictionary': 12,

View File

@ -278,10 +278,8 @@
"declined-suggestion": "Abgelehnter Vorschlag",
"hint": "Hinweis",
"manual-redaction": "Manuelle Schwärzung",
"pending-analysis": "Reanalyse ausstehend",
"recommendation": "Empfehlung",
"redaction": "Schwärzung",
"remove-dictionary": "Ausstehende Löschung aus dem Wörterbuch",
"remove-only-here": "Ausstehende Löschung (nur hier)",
"skipped": "Übersprungen",
"suggestion-add": "Vorschlag für Schwärzung",
@ -1792,7 +1790,6 @@
"redactions": "Schwärzungs-Wörterbücher"
},
"OCR_PROCESSING": "OCR-Analyse",
"pending-analysis": "Reanalyse ausstehend",
"PROCESSING": "Wird analysiert",
"report": {
"action": {

View File

@ -263,15 +263,14 @@
"rule": "Redaction based on rule {rule}"
},
"annotation-type": {
"suggestion-resize": "Suggested Resize",
"add-dictionary": "Pending add to dictionary",
"change-legal-basis": "Pending Change of Legal Basis",
"declined-suggestion": "Declined Suggestion",
"hint": "Hint",
"manual-redaction": "Manual Redaction",
"pending-analysis": "Pending Re-Analysis",
"recommendation": "Recommendation",
"redaction": "Redaction",
"remove-dictionary": "Pending remove from dictionary",
"remove-only-here": "Pending removal ( only here )",
"skipped": "Skipped",
"suggestion-add": "Suggested redaction",