Merge branch 'RED-8979' into 'master'

RED-8979: Indicate dossier dictionary-based annotations in workload

Closes RED-8979

See merge request redactmanager/red-ui!441
This commit is contained in:
Dan Percic 2024-06-03 20:42:49 +02:00
commit 8f2484e736
7 changed files with 21 additions and 21 deletions

View File

@ -6,6 +6,7 @@ import { ListItem } from '@models/file/list-item';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { annotationChangesTranslations } from '@translations/annotation-changes-translations'; import { annotationChangesTranslations } from '@translations/annotation-changes-translations';
import { MultiSelectService } from '../../services/multi-select.service'; import { MultiSelectService } from '../../services/multi-select.service';
import { LogEntryEngine, LogEntryEngines } from '@red/domain';
interface Engine { interface Engine {
readonly icon: string; readonly icon: string;
@ -14,17 +15,7 @@ interface Engine {
readonly translateParams?: Record<string, any>; readonly translateParams?: Record<string, any>;
} }
export const Engines = { function isBasedOn(annotation: AnnotationWrapper, engineName: LogEntryEngine) {
DICTIONARY: 'DICTIONARY',
NER: 'NER',
RULE: 'RULE',
IMPORTED: 'IMPORTED',
MANUAL: 'MANUAL',
} as const;
type EngineName = keyof typeof Engines;
function isBasedOn(annotation: AnnotationWrapper, engineName: EngineName) {
return !!annotation.engines?.includes(engineName); return !!annotation.engines?.includes(engineName);
} }
@ -43,18 +34,18 @@ const changesProperties: KeysOf<AnnotationWrapper>[] = [
styleUrls: ['./annotation-details.component.scss'], styleUrls: ['./annotation-details.component.scss'],
}) })
export class AnnotationDetailsComponent implements OnChanges { export class AnnotationDetailsComponent implements OnChanges {
private readonly _translateService = inject(TranslateService);
private readonly _multiSelectService = inject(MultiSelectService);
@Input() annotation: ListItem<AnnotationWrapper>; @Input() annotation: ListItem<AnnotationWrapper>;
isPopoverOpen = false; isPopoverOpen = false;
engines: Engine[]; engines: Engine[];
changesTooltip: string; changesTooltip: string;
noSelection: boolean; noSelection: boolean;
private readonly _translateService = inject(TranslateService);
private readonly _multiSelectService = inject(MultiSelectService);
getChangesTooltip(): string | undefined { getChangesTooltip(): string | undefined {
const changes = changesProperties.filter(key => this.annotation.item[key]); const changes = changesProperties.filter(key => this.annotation.item[key]);
if (!changes.length || !this.annotation.item.engines?.includes(Engines.MANUAL)) { if (!changes.length || !this.annotation.item.engines?.includes(LogEntryEngines.MANUAL)) {
return; return;
} }
@ -74,24 +65,29 @@ export class AnnotationDetailsComponent implements OnChanges {
{ {
icon: 'red:dictionary', icon: 'red:dictionary',
description: _('annotation-engines.dictionary'), description: _('annotation-engines.dictionary'),
show: isBasedOn(annotation, Engines.DICTIONARY), show: isBasedOn(annotation, LogEntryEngines.DICTIONARY),
translateParams: { isHint: annotation.HINT }, translateParams: { isHint: annotation.HINT },
}, },
{
icon: 'red:folder',
description: _('annotation-engines.dossier-dictionary'),
show: isBasedOn(annotation, LogEntryEngines.DOSSIER_DICTIONARY),
},
{ {
icon: 'red:ai', icon: 'red:ai',
description: _('annotation-engines.ner'), description: _('annotation-engines.ner'),
show: isBasedOn(annotation, Engines.NER), show: isBasedOn(annotation, LogEntryEngines.NER),
}, },
{ {
icon: 'red:rule', icon: 'red:rule',
description: _('annotation-engines.rule'), description: _('annotation-engines.rule'),
show: isBasedOn(annotation, Engines.RULE), show: isBasedOn(annotation, LogEntryEngines.RULE),
translateParams: { rule: annotation.legalBasisValue || '' }, translateParams: { rule: annotation.legalBasisValue || '' },
}, },
{ {
icon: 'red:import_redactions', icon: 'red:import_redactions',
description: _('annotation-engines.imported'), description: _('annotation-engines.imported'),
show: isBasedOn(annotation, Engines.IMPORTED), show: isBasedOn(annotation, LogEntryEngines.IMPORTED),
}, },
]; ];
} }

View File

@ -3,7 +3,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { getConfig } from '@iqser/common-ui'; import { getConfig } from '@iqser/common-ui';
import { Filter, handleCheckedValue, IFilter, INestedFilter, NestedFilter } from '@iqser/common-ui/lib/filtering'; import { Filter, handleCheckedValue, IFilter, INestedFilter, NestedFilter } from '@iqser/common-ui/lib/filtering';
import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { annotationDefaultColorConfig } from '@red/domain'; import { annotationDefaultColorConfig, LogEntryEngines } from '@red/domain';
import { DefaultColorsService } from '@services/entity-services/default-colors.service'; import { DefaultColorsService } from '@services/entity-services/default-colors.service';
import { ViewedPagesMapService } from '@services/files/viewed-pages-map.service'; import { ViewedPagesMapService } from '@services/files/viewed-pages-map.service';
import { annotationTypesTranslations } from '@translations/annotation-types-translations'; import { annotationTypesTranslations } from '@translations/annotation-types-translations';
@ -19,7 +19,6 @@ 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 {
@ -52,7 +51,7 @@ export class AnnotationProcessingService {
checked: false, checked: false,
topLevelFilter: true, topLevelFilter: true,
checker: (annotation: AnnotationWrapper) => checker: (annotation: AnnotationWrapper) =>
annotation?.hasRedactionChanges && annotation?.engines?.includes(Engines.MANUAL), annotation?.hasRedactionChanges && annotation?.engines?.includes(LogEntryEngines.MANUAL),
}, },
{ {
id: 'unseen-pages', id: 'unseen-pages',

View File

@ -354,6 +354,7 @@
}, },
"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",
"dossier-dictionary": "",
"imported": "Imported", "imported": "Imported",
"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

@ -354,6 +354,7 @@
}, },
"annotation-engines": { "annotation-engines": {
"dictionary": "Based on dictionary", "dictionary": "Based on dictionary",
"dossier-dictionary": "Based on dossier dictionary",
"imported": "Imported", "imported": "Imported",
"ner": "Based on AI", "ner": "Based on AI",
"rule": "Based on rule" "rule": "Based on rule"

View File

@ -354,6 +354,7 @@
}, },
"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",
"dossier-dictionary": "",
"imported": "Annotation is imported", "imported": "Annotation is imported",
"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

@ -354,6 +354,7 @@
}, },
"annotation-engines": { "annotation-engines": {
"dictionary": "{isHint, select, true{Hint} other{Annotation}} based on dictionary", "dictionary": "{isHint, select, true{Hint} other{Annotation}} based on dictionary",
"dossier-dictionary": "Annotation based on dossier dictionary",
"imported": "Annotation is imported", "imported": "Annotation is imported",
"ner": "Annotation based on AI", "ner": "Annotation based on AI",
"rule": "Annotation based on rule {rule}" "rule": "Annotation based on rule {rule}"

View File

@ -6,6 +6,7 @@ export const LogEntryEngines = {
RULE: 'RULE', RULE: 'RULE',
IMPORTED: 'IMPORTED', IMPORTED: 'IMPORTED',
MANUAL: 'MANUAL', MANUAL: 'MANUAL',
DOSSIER_DICTIONARY: 'DOSSIER_DICTIONARY',
} as const; } as const;
export type LogEntryEngine = ValuesOf<typeof LogEntryEngines>; export type LogEntryEngine = ValuesOf<typeof LogEntryEngines>;