RED-8638 - updated “Only annotations with manual changes” filter to include only the anotations with manual engine

This commit is contained in:
Valentin Mihai 2024-04-11 10:44:28 +03:00
parent 63bb6e3a9a
commit 698892e3e7
9 changed files with 15 additions and 14 deletions

View File

@ -63,6 +63,7 @@ export class AnnotationWrapper implements IListable {
hasBeenForcedHint: boolean; hasBeenForcedHint: boolean;
hasBeenForcedRedaction: boolean; hasBeenForcedRedaction: boolean;
hasBeenRemovedByManualOverride: boolean; hasBeenRemovedByManualOverride: boolean;
hasBeenAdded: boolean;
isRemoved = false; isRemoved = false;
isRemovedLocally = false; isRemovedLocally = false;
hiddenInWorkload = false; hiddenInWorkload = false;
@ -269,6 +270,7 @@ export class AnnotationWrapper implements IListable {
annotationWrapper.hasBeenRemovedByManualOverride = !!logEntry.manualChanges?.find( annotationWrapper.hasBeenRemovedByManualOverride = !!logEntry.manualChanges?.find(
c => c.manualRedactionType === ManualRedactionTypes.REMOVE, c => c.manualRedactionType === ManualRedactionTypes.REMOVE,
); );
annotationWrapper.hasBeenAdded = !!logEntry.manualChanges?.find(c => c.manualRedactionType === ManualRedactionTypes.ADD);
const content = this.#createContent(annotationWrapper, logEntry, isDocumine); const content = this.#createContent(annotationWrapper, logEntry, isDocumine);
annotationWrapper.shortContent = this.#getShortContent(annotationWrapper, legalBasisList) || content; annotationWrapper.shortContent = this.#getShortContent(annotationWrapper, legalBasisList) || content;

View File

@ -14,7 +14,7 @@ interface Engine {
readonly translateParams?: Record<string, any>; readonly translateParams?: Record<string, any>;
} }
const Engines = { export const Engines = {
DICTIONARY: 'DICTIONARY', DICTIONARY: 'DICTIONARY',
NER: 'NER', NER: 'NER',
RULE: 'RULE', RULE: 'RULE',
@ -29,6 +29,7 @@ function isBasedOn(annotation: AnnotationWrapper, engineName: EngineName) {
} }
const changesProperties: KeysOf<AnnotationWrapper>[] = [ const changesProperties: KeysOf<AnnotationWrapper>[] = [
'hasBeenAdded',
'hasBeenResized', 'hasBeenResized',
'hasBeenRecategorized', 'hasBeenRecategorized',
'hasLegalBasisChanged', 'hasLegalBasisChanged',
@ -52,12 +53,12 @@ export class AnnotationDetailsComponent implements OnChanges {
noSelection: boolean; noSelection: boolean;
getChangesTooltip(): string | undefined { getChangesTooltip(): string | undefined {
const changes = changesProperties.filter(key => this.annotation.item[key]); if (!this.annotation.item.engines?.includes(Engines.MANUAL)) {
if (!changes.length) {
return; return;
} }
const changes = changesProperties.filter(key => this.annotation.item[key]);
const header = this._translateService.instant(_('annotation-changes.header')); const header = this._translateService.instant(_('annotation-changes.header'));
const details = changes.map(change => this._translateService.instant(annotationChangesTranslations[change])); const details = changes.map(change => this._translateService.instant(annotationChangesTranslations[change]));
return [header, ...details.map(change => `${change}`)].join('\n'); return [header, ...details.map(change => `${change}`)].join('\n');
@ -93,11 +94,6 @@ export class AnnotationDetailsComponent implements OnChanges {
description: _('annotation-engines.imported'), description: _('annotation-engines.imported'),
show: isBasedOn(annotation, Engines.IMPORTED), show: isBasedOn(annotation, Engines.IMPORTED),
}, },
{
icon: 'red:redaction-changes',
description: _('annotation-engines.manual'),
show: isBasedOn(annotation, Engines.MANUAL),
},
]; ];
} }
} }

View File

@ -19,6 +19,7 @@ import {
} from '../utils/sort-by-page-rotation.utils'; } from '../utils/sort-by-page-rotation.utils';
import { FileDataService } from './file-data.service'; import { FileDataService } from './file-data.service';
import { FilePreviewStateService } from './file-preview-state.service'; import { FilePreviewStateService } from './file-preview-state.service';
import { Engines } from '../components/annotation-details/annotation-details.component';
@Injectable() @Injectable()
export class AnnotationProcessingService { export class AnnotationProcessingService {
@ -50,7 +51,7 @@ export class AnnotationProcessingService {
label: _('filter-menu.redaction-changes'), label: _('filter-menu.redaction-changes'),
checked: false, checked: false,
topLevelFilter: true, topLevelFilter: true,
checker: (annotation: AnnotationWrapper) => annotation?.hasRedactionChanges, checker: (annotation: AnnotationWrapper) => annotation?.engines?.includes(Engines.MANUAL),
}, },
{ {
id: 'unseen-pages', id: 'unseen-pages',

View File

@ -3,6 +3,7 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { KeysOf } from '@iqser/common-ui/lib/utils'; import { KeysOf } from '@iqser/common-ui/lib/utils';
export const annotationChangesTranslations: { [key in KeysOf<AnnotationWrapper>]?: string } = { export const annotationChangesTranslations: { [key in KeysOf<AnnotationWrapper>]?: string } = {
hasBeenAdded: _('annotation-changes.added'),
hasBeenResized: _('annotation-changes.resized'), hasBeenResized: _('annotation-changes.resized'),
hasBeenRecategorized: _('annotation-changes.recategorized'), hasBeenRecategorized: _('annotation-changes.recategorized'),
hasLegalBasisChanged: _('annotation-changes.legal-basis'), hasLegalBasisChanged: _('annotation-changes.legal-basis'),

View File

@ -340,6 +340,7 @@
"undo": "Rückgängig" "undo": "Rückgängig"
}, },
"annotation-changes": { "annotation-changes": {
"added": "",
"forced-hint": "Hint forced", "forced-hint": "Hint forced",
"forced-redaction": "Redaction forced", "forced-redaction": "Redaction forced",
"header": "Manuelle Änderungen:", "header": "Manuelle Änderungen:",
@ -351,7 +352,6 @@
"annotation-engines": { "annotation-engines": {
"dictionary": "{isHint, select, true{Hint} other{Redaction}} basierend auf Wörterbuch", "dictionary": "{isHint, select, true{Hint} other{Redaction}} basierend auf Wörterbuch",
"imported": "Imported", "imported": "Imported",
"manual": "",
"ner": "Redaktion basierend auf KI", "ner": "Redaktion basierend auf KI",
"rule": "Schwärzung basierend auf Regel {rule}" "rule": "Schwärzung basierend auf Regel {rule}"
}, },

View File

@ -340,6 +340,7 @@
"undo": "Undo" "undo": "Undo"
}, },
"annotation-changes": { "annotation-changes": {
"added": "Redaction/Hint added",
"forced-hint": "Hint forced", "forced-hint": "Hint forced",
"forced-redaction": "Redaction forced", "forced-redaction": "Redaction forced",
"header": "Manual changes:", "header": "Manual changes:",
@ -351,7 +352,6 @@
"annotation-engines": { "annotation-engines": {
"dictionary": "Based on dictionary", "dictionary": "Based on dictionary",
"imported": "Imported", "imported": "Imported",
"manual": "Manual",
"ner": "Based on AI", "ner": "Based on AI",
"rule": "Based on rule" "rule": "Based on rule"
}, },

View File

@ -340,6 +340,7 @@
"undo": "Rückgängig" "undo": "Rückgängig"
}, },
"annotation-changes": { "annotation-changes": {
"added": "",
"forced-hint": "Hint forced", "forced-hint": "Hint forced",
"forced-redaction": "Annotation forced", "forced-redaction": "Annotation forced",
"header": "Manuelle Änderungen:", "header": "Manuelle Änderungen:",
@ -351,7 +352,6 @@
"annotation-engines": { "annotation-engines": {
"dictionary": "{isHint, select, true{Hint} other{Redaction}} basierend auf Wörterbuch", "dictionary": "{isHint, select, true{Hint} other{Redaction}} basierend auf Wörterbuch",
"imported": "Annotation is imported", "imported": "Annotation is imported",
"manual": "",
"ner": "Redaktion basierend auf KI", "ner": "Redaktion basierend auf KI",
"rule": "Schwärzung basierend auf Regel {rule}" "rule": "Schwärzung basierend auf Regel {rule}"
}, },

View File

@ -340,6 +340,7 @@
"undo": "Undo" "undo": "Undo"
}, },
"annotation-changes": { "annotation-changes": {
"added": "Redaction/Hint added",
"forced-hint": "Hint forced", "forced-hint": "Hint forced",
"forced-redaction": "Annotation forced", "forced-redaction": "Annotation forced",
"header": "Manual changes:", "header": "Manual changes:",
@ -351,7 +352,6 @@
"annotation-engines": { "annotation-engines": {
"dictionary": "{isHint, select, true{Hint} other{Annotation}} based on dictionary", "dictionary": "{isHint, select, true{Hint} other{Annotation}} based on dictionary",
"imported": "Annotation is imported", "imported": "Annotation is imported",
"manual": "Manual",
"ner": "Annotation based on AI", "ner": "Annotation based on AI",
"rule": "Annotation based on rule {rule}" "rule": "Annotation based on rule {rule}"
}, },

View File

@ -11,6 +11,7 @@ export const LogEntryEngines = {
export type LogEntryEngine = ValuesOf<typeof LogEntryEngines>; export type LogEntryEngine = ValuesOf<typeof LogEntryEngines>;
export const ManualRedactionTypes = { export const ManualRedactionTypes = {
ADD: 'ADD',
ADD_LOCALLY: 'ADD_LOCALLY', ADD_LOCALLY: 'ADD_LOCALLY',
ADD_TO_DICTIONARY: 'ADD_TO_DICTIONARY', ADD_TO_DICTIONARY: 'ADD_TO_DICTIONARY',
REMOVE: 'REMOVE', REMOVE: 'REMOVE',