Merge branch 'VM/RED-8638' into 'master'

RED-8638 - updated “Only annotations with manual changes” filter to include...

Closes RED-8638

See merge request redactmanager/red-ui!387
This commit is contained in:
Dan Percic 2024-04-11 11:33:15 +02:00
commit 68a1be0800
9 changed files with 15 additions and 12 deletions

View File

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

View File

@ -14,7 +14,7 @@ interface Engine {
readonly translateParams?: Record<string, any>;
}
const Engines = {
export const Engines = {
DICTIONARY: 'DICTIONARY',
NER: 'NER',
RULE: 'RULE',
@ -29,6 +29,7 @@ function isBasedOn(annotation: AnnotationWrapper, engineName: EngineName) {
}
const changesProperties: KeysOf<AnnotationWrapper>[] = [
'hasBeenAdded',
'hasBeenResized',
'hasBeenRecategorized',
'hasLegalBasisChanged',
@ -52,12 +53,12 @@ export class AnnotationDetailsComponent implements OnChanges {
noSelection: boolean;
getChangesTooltip(): string | undefined {
const changes = changesProperties.filter(key => this.annotation.item[key]);
if (!changes.length) {
if (!this.annotation.item.engines?.includes(Engines.MANUAL)) {
return;
}
const changes = changesProperties.filter(key => this.annotation.item[key]);
const header = this._translateService.instant(_('annotation-changes.header'));
const details = changes.map(change => this._translateService.instant(annotationChangesTranslations[change]));
return [header, ...details.map(change => `${change}`)].join('\n');
@ -93,11 +94,6 @@ export class AnnotationDetailsComponent implements OnChanges {
description: _('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';
import { FileDataService } from './file-data.service';
import { FilePreviewStateService } from './file-preview-state.service';
import { Engines } from '../components/annotation-details/annotation-details.component';
@Injectable()
export class AnnotationProcessingService {
@ -50,7 +51,7 @@ export class AnnotationProcessingService {
label: _('filter-menu.redaction-changes'),
checked: false,
topLevelFilter: true,
checker: (annotation: AnnotationWrapper) => annotation?.hasRedactionChanges,
checker: (annotation: AnnotationWrapper) => annotation?.engines?.includes(Engines.MANUAL),
},
{
id: 'unseen-pages',

View File

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

View File

@ -347,6 +347,7 @@
"undo": "Rückgängig"
},
"annotation-changes": {
"added": "",
"forced-hint": "Hint forced",
"forced-redaction": "Redaction forced",
"header": "Manuelle Änderungen:",

View File

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

View File

@ -347,6 +347,7 @@
"undo": "Rückgängig"
},
"annotation-changes": {
"added": "",
"forced-hint": "Hint forced",
"forced-redaction": "Annotation forced",
"header": "Manuelle Änderungen:",

View File

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

View File

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