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

This commit is contained in:
Adina Țeudan 2024-06-03 20:43:56 +03:00
parent 6b30ac27ea
commit 8a32910084
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 { annotationChangesTranslations } from '@translations/annotation-changes-translations';
import { MultiSelectService } from '../../services/multi-select.service';
import { LogEntryEngine, LogEntryEngines } from '@red/domain';
interface Engine {
readonly icon: string;
@ -14,17 +15,7 @@ interface Engine {
readonly translateParams?: Record<string, any>;
}
export const Engines = {
DICTIONARY: 'DICTIONARY',
NER: 'NER',
RULE: 'RULE',
IMPORTED: 'IMPORTED',
MANUAL: 'MANUAL',
} as const;
type EngineName = keyof typeof Engines;
function isBasedOn(annotation: AnnotationWrapper, engineName: EngineName) {
function isBasedOn(annotation: AnnotationWrapper, engineName: LogEntryEngine) {
return !!annotation.engines?.includes(engineName);
}
@ -43,18 +34,18 @@ const changesProperties: KeysOf<AnnotationWrapper>[] = [
styleUrls: ['./annotation-details.component.scss'],
})
export class AnnotationDetailsComponent implements OnChanges {
private readonly _translateService = inject(TranslateService);
private readonly _multiSelectService = inject(MultiSelectService);
@Input() annotation: ListItem<AnnotationWrapper>;
isPopoverOpen = false;
engines: Engine[];
changesTooltip: string;
noSelection: boolean;
private readonly _translateService = inject(TranslateService);
private readonly _multiSelectService = inject(MultiSelectService);
getChangesTooltip(): string | undefined {
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;
}
@ -74,24 +65,29 @@ export class AnnotationDetailsComponent implements OnChanges {
{
icon: 'red:dictionary',
description: _('annotation-engines.dictionary'),
show: isBasedOn(annotation, Engines.DICTIONARY),
show: isBasedOn(annotation, LogEntryEngines.DICTIONARY),
translateParams: { isHint: annotation.HINT },
},
{
icon: 'red:folder',
description: _('annotation-engines.dossier-dictionary'),
show: isBasedOn(annotation, LogEntryEngines.DOSSIER_DICTIONARY),
},
{
icon: 'red:ai',
description: _('annotation-engines.ner'),
show: isBasedOn(annotation, Engines.NER),
show: isBasedOn(annotation, LogEntryEngines.NER),
},
{
icon: 'red:rule',
description: _('annotation-engines.rule'),
show: isBasedOn(annotation, Engines.RULE),
show: isBasedOn(annotation, LogEntryEngines.RULE),
translateParams: { rule: annotation.legalBasisValue || '' },
},
{
icon: 'red:import_redactions',
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 { Filter, handleCheckedValue, IFilter, INestedFilter, NestedFilter } from '@iqser/common-ui/lib/filtering';
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 { ViewedPagesMapService } from '@services/files/viewed-pages-map.service';
import { annotationTypesTranslations } from '@translations/annotation-types-translations';
@ -19,7 +19,6 @@ 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 {
@ -52,7 +51,7 @@ export class AnnotationProcessingService {
checked: false,
topLevelFilter: true,
checker: (annotation: AnnotationWrapper) =>
annotation?.hasRedactionChanges && annotation?.engines?.includes(Engines.MANUAL),
annotation?.hasRedactionChanges && annotation?.engines?.includes(LogEntryEngines.MANUAL),
},
{
id: 'unseen-pages',

View File

@ -354,6 +354,7 @@
},
"annotation-engines": {
"dictionary": "{isHint, select, true{Hint} other{Redaction}} basierend auf Wörterbuch",
"dossier-dictionary": "",
"imported": "Imported",
"ner": "Redaktion basierend auf KI",
"rule": "Schwärzung basierend auf Regel {rule}"

View File

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

View File

@ -354,6 +354,7 @@
},
"annotation-engines": {
"dictionary": "{isHint, select, true{Hint} other{Redaction}} basierend auf Wörterbuch",
"dossier-dictionary": "",
"imported": "Annotation is imported",
"ner": "Redaktion basierend auf KI",
"rule": "Schwärzung basierend auf Regel {rule}"

View File

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

View File

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