diff --git a/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts b/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts index 1e3c5fd86..d06824982 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/annotation-details/annotation-details.component.ts @@ -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; } -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[] = [ styleUrls: ['./annotation-details.component.scss'], }) export class AnnotationDetailsComponent implements OnChanges { - private readonly _translateService = inject(TranslateService); - private readonly _multiSelectService = inject(MultiSelectService); @Input() annotation: ListItem; 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), }, ]; } diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts index 42d467dd9..3941d297d 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-processing.service.ts @@ -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', diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index 9710d328d..93f906d01 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -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}" diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 2667b6bee..90605613e 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -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" diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index 745ec016c..3fec888e4 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -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}" diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index 5d4c0487b..552193a45 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -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}" diff --git a/libs/red-domain/src/lib/redaction-log/types.ts b/libs/red-domain/src/lib/redaction-log/types.ts index c35068387..2586dd09c 100644 --- a/libs/red-domain/src/lib/redaction-log/types.ts +++ b/libs/red-domain/src/lib/redaction-log/types.ts @@ -6,6 +6,7 @@ export const LogEntryEngines = { RULE: 'RULE', IMPORTED: 'IMPORTED', MANUAL: 'MANUAL', + DOSSIER_DICTIONARY: 'DOSSIER_DICTIONARY', } as const; export type LogEntryEngine = ValuesOf;