add engines property and show relevant messages in popover
This commit is contained in:
parent
6ddaac654b
commit
0123356287
@ -57,6 +57,7 @@ export class AnnotationWrapper {
|
||||
|
||||
isChangeLogEntry?: boolean;
|
||||
changeLogType?: 'ADDED' | 'REMOVED';
|
||||
engines?: string[];
|
||||
|
||||
private _origin: RedactionLogEntryWrapper;
|
||||
|
||||
@ -218,6 +219,7 @@ export class AnnotationWrapper {
|
||||
annotationWrapper.legalBasisValue = redactionLogEntry.legalBasis;
|
||||
annotationWrapper.comments = redactionLogEntry.comments || [];
|
||||
annotationWrapper.manual = redactionLogEntry.manual;
|
||||
annotationWrapper.engines = redactionLogEntry.engines;
|
||||
|
||||
this._createContent(annotationWrapper, redactionLogEntry);
|
||||
this._setSuperType(annotationWrapper, redactionLogEntry);
|
||||
|
||||
@ -35,4 +35,5 @@ export interface RedactionLogEntryWrapper {
|
||||
|
||||
recategorizationType?: string;
|
||||
legalBasisChangeValue?: string;
|
||||
engines?: string[];
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<ng-container *ngIf="hasSourcesToShow">
|
||||
<ng-container *ngIf="hasEnginesToShow">
|
||||
<div cdkOverlayOrigin #trigger="cdkOverlayOrigin" class="chip" (mouseover)="isPopoverOpen = true" (mouseout)="isPopoverOpen = false">
|
||||
<ng-container *ngFor="let source of sources">
|
||||
<mat-icon *ngIf="source.show" [svgIcon]="source.icon"></mat-icon>
|
||||
<ng-container *ngFor="let engine of engines">
|
||||
<mat-icon *ngIf="engine.show" [svgIcon]="engine.icon"></mat-icon>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
[cdkConnectedOverlayOpen]="isPopoverOpen"
|
||||
>
|
||||
<div class="popover">
|
||||
<ng-container *ngFor="let source of sources">
|
||||
<div *ngIf="source.show" class="flex-align-items-center">
|
||||
<mat-icon [svgIcon]="source.icon"></mat-icon>
|
||||
<span>Redaction based on ceva mai lung care să vină pe 2 rânduri</span>
|
||||
<ng-container *ngFor="let engine of engines">
|
||||
<div *ngIf="engine.show" class="flex-align-items-center">
|
||||
<mat-icon [svgIcon]="engine.icon"></mat-icon>
|
||||
<span>{{ engine.description }}</span>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
@ -1,35 +1,65 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { OnChange } from '@iqser/common-ui';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
interface Source {
|
||||
interface Engine {
|
||||
readonly icon: string;
|
||||
readonly description: string;
|
||||
readonly show: boolean;
|
||||
}
|
||||
|
||||
type Engines = readonly Engine[];
|
||||
|
||||
const Engines = {
|
||||
DICTIONARY: 'DICTIONARY',
|
||||
NER: 'NER',
|
||||
RULE: 'RULE'
|
||||
} as const;
|
||||
|
||||
type EngineName = keyof typeof Engines;
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-annotation-source',
|
||||
templateUrl: './annotation-source.component.html',
|
||||
styleUrls: ['./annotation-source.component.scss']
|
||||
styleUrls: ['./annotation-source.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class AnnotationSourceComponent {
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
isPopoverOpen = false;
|
||||
readonly sources: readonly Source[] = [
|
||||
{
|
||||
icon: 'red:dictionary',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
icon: 'red:ai',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
icon: 'red:rule',
|
||||
show: true
|
||||
}
|
||||
];
|
||||
@Input()
|
||||
@OnChange<AnnotationWrapper, AnnotationSourceComponent>('updateEngines')
|
||||
annotation: AnnotationWrapper;
|
||||
|
||||
get hasSourcesToShow(): boolean {
|
||||
return this.sources.length && this.sources.some(source => source.show)
|
||||
isPopoverOpen = false;
|
||||
engines: Engines;
|
||||
|
||||
constructor(private readonly _translateService: TranslateService) {}
|
||||
|
||||
get hasEnginesToShow(): boolean {
|
||||
return this.engines.length && this.engines.some(source => source.show);
|
||||
}
|
||||
|
||||
updateEngines(): void {
|
||||
this.engines = [
|
||||
{
|
||||
icon: 'red:dictionary',
|
||||
description: this._translateService.instant('annotation-engines.dictionary'),
|
||||
show: this._isBasedOn(Engines.DICTIONARY)
|
||||
},
|
||||
{
|
||||
icon: 'red:ai',
|
||||
description: this._translateService.instant('annotation-engines.ner'),
|
||||
show: this._isBasedOn(Engines.NER)
|
||||
},
|
||||
{
|
||||
icon: 'red:rule',
|
||||
description: this._translateService.instant('annotation-engines.rule', { rule: this.annotation.legalBasisValue }),
|
||||
show: this._isBasedOn(Engines.RULE)
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
private _isBasedOn(engineName: EngineName) {
|
||||
return !!this.annotation.engines?.includes(engineName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1379,5 +1379,10 @@
|
||||
"text-placeholder": "Text eingeben"
|
||||
},
|
||||
"title": "Wasserzeichen"
|
||||
},
|
||||
"annotation-engines": {
|
||||
"dictionary": "",
|
||||
"ner": "",
|
||||
"rule": ""
|
||||
}
|
||||
}
|
||||
|
||||
@ -1521,5 +1521,10 @@
|
||||
},
|
||||
"title": "Watermark"
|
||||
},
|
||||
"yesterday": "Yesterday"
|
||||
"yesterday": "Yesterday",
|
||||
"annotation-engines": {
|
||||
"dictionary": "Redaction based on dictionary",
|
||||
"ner": "Redaction based on AI",
|
||||
"rule": "Redaction based on rule {rule}"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 4f0d8022eddb1fa3306a653883ac5b0972f75d13
|
||||
Subproject commit b55e3bf0ddbda8e8459cb0ae23c8abd5fff46a18
|
||||
@ -40,6 +40,7 @@ export interface RedactionLogEntry {
|
||||
type?: string;
|
||||
value?: string;
|
||||
legalBasisChangeValue?: string;
|
||||
engines?: string[];
|
||||
}
|
||||
|
||||
export namespace RedactionLogEntry {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user