false positive for recommendations
This commit is contained in:
parent
988f333502
commit
b2724c9206
@ -47,17 +47,7 @@ export class AnnotationActionsService {
|
||||
}
|
||||
|
||||
public markAsFalsePositive($event: MouseEvent, annotation: AnnotationWrapper, annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
$event?.stopPropagation();
|
||||
|
||||
const falsePositiveRequest: AddRedactionRequest = {};
|
||||
falsePositiveRequest.reason = annotation.id;
|
||||
falsePositiveRequest.value = this._getFalsePositiveText(annotation);
|
||||
falsePositiveRequest.type = 'false_positive';
|
||||
falsePositiveRequest.positions = annotation.positions;
|
||||
falsePositiveRequest.addToDictionary = true;
|
||||
falsePositiveRequest.comment = { text: 'False Positive' };
|
||||
|
||||
this._processObsAndEmit(this._manualAnnotationService.addAnnotation(falsePositiveRequest), annotation, annotationsChanged);
|
||||
this._markAsFalsePositive($event, annotation, this._getFalsePositiveText(annotation), annotationsChanged);
|
||||
}
|
||||
|
||||
public undoDirectAction($event: MouseEvent, annotation: AnnotationWrapper, annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
@ -99,6 +89,19 @@ export class AnnotationActionsService {
|
||||
});
|
||||
}
|
||||
|
||||
if (annotationPermissions.canMarkRecommendationAsFalsePositive) {
|
||||
availableActions.push({
|
||||
type: 'actionButton',
|
||||
img: '/assets/icons/general/thumb-down.svg',
|
||||
title: this._translateService.instant('annotation-actions.remove-annotation.false-positive'),
|
||||
onClick: () => {
|
||||
this._ngZone.run(() => {
|
||||
this.markRecommendationAsFalsePositive(null, annotation, annotationsChanged);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (annotationPermissions.canAcceptSuggestion) {
|
||||
availableActions.push({
|
||||
type: 'actionButton',
|
||||
@ -180,6 +183,10 @@ export class AnnotationActionsService {
|
||||
return availableActions;
|
||||
}
|
||||
|
||||
markRecommendationAsFalsePositive($event: MouseEvent, annotation: AnnotationWrapper, annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
this._markAsFalsePositive($event, annotation, annotation.value, annotationsChanged);
|
||||
}
|
||||
|
||||
private _getFalsePositiveText(annotation: AnnotationWrapper) {
|
||||
if (annotation.canBeMarkedAsFalsePositive) {
|
||||
let text;
|
||||
@ -192,4 +199,18 @@ export class AnnotationActionsService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _markAsFalsePositive($event: MouseEvent, annotation: AnnotationWrapper, text: string, annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||
$event?.stopPropagation();
|
||||
|
||||
const falsePositiveRequest: AddRedactionRequest = {};
|
||||
falsePositiveRequest.reason = annotation.id;
|
||||
falsePositiveRequest.value = text;
|
||||
falsePositiveRequest.type = 'false_positive';
|
||||
falsePositiveRequest.positions = annotation.positions;
|
||||
falsePositiveRequest.addToDictionary = true;
|
||||
falsePositiveRequest.comment = { text: 'False Positive' };
|
||||
|
||||
this._processObsAndEmit(this._manualAnnotationService.addAnnotation(falsePositiveRequest), annotation, annotationsChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
{
|
||||
length: val.value,
|
||||
color: val.color,
|
||||
label: getLabel(val)
|
||||
label: getLabel(val),
|
||||
cssClass: val.color === 'PROCESSING' ? 'loading' : ''
|
||||
}
|
||||
]"
|
||||
>
|
||||
|
||||
@ -6,6 +6,6 @@
|
||||
'background-color': rect.color.includes('#') ? rect.color : ''
|
||||
}"
|
||||
></div>
|
||||
<div *ngIf="rect.label">{{ rect.label }}</div>
|
||||
<div *ngIf="rect.label" [class]="rect.cssClass">{{ rect.label }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -13,6 +13,7 @@ export class StatusBarComponent implements OnInit {
|
||||
length: number;
|
||||
color: Color;
|
||||
label?: string;
|
||||
cssClass?: string;
|
||||
}[] = [];
|
||||
|
||||
@Input()
|
||||
@ -20,5 +21,7 @@ export class StatusBarComponent implements OnInit {
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
ngOnInit(): void {
|
||||
console.log(this.config);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,15 @@
|
||||
>
|
||||
</redaction-circle-button>
|
||||
|
||||
<div
|
||||
(click)="annotationActionsService.markRecommendationAsFalsePositive($event, annotation, annotationsChanged)"
|
||||
mat-menu-item
|
||||
*ngIf="annotationPermissions.canMarkRecommendationAsFalsePositive"
|
||||
>
|
||||
<mat-icon svgIcon="red:thumb-down" class="false-positive-icon"></mat-icon>
|
||||
<div translate="annotation-actions.remove-annotation.false-positive"></div>
|
||||
</div>
|
||||
|
||||
<redaction-circle-button
|
||||
(action)="annotationActionsService.acceptSuggestion($event, annotation, annotationsChanged)"
|
||||
type="dark-bg"
|
||||
|
||||
@ -5,6 +5,7 @@ export class AnnotationPermissions {
|
||||
canUndo: boolean;
|
||||
|
||||
canAcceptRecommendation: boolean;
|
||||
canMarkRecommendationAsFalsePositive: boolean;
|
||||
canMarkAsFalsePositive: boolean;
|
||||
|
||||
canRemoveOrSuggestToRemoveOnlyHere: boolean;
|
||||
@ -19,6 +20,8 @@ export class AnnotationPermissions {
|
||||
permissions.canUndo = annotation.userId === user.id && annotation.isUndoableSuperType;
|
||||
|
||||
permissions.canAcceptRecommendation = annotation.isRecommendation;
|
||||
permissions.canMarkRecommendationAsFalsePositive = annotation.isRecommendation;
|
||||
|
||||
permissions.canMarkAsFalsePositive = annotation.canBeMarkedAsFalsePositive;
|
||||
|
||||
permissions.canRemoveOrSuggestToRemoveOnlyHere = annotation.isRedacted;
|
||||
|
||||
@ -222,7 +222,11 @@
|
||||
<div [class.extend-cols]="fileStatus.isError" class="status-container">
|
||||
<div *ngIf="fileStatus.isError" class="small-label error" translate="project-overview.file-listing.file-entry.file-error"></div>
|
||||
<div *ngIf="fileStatus.isPending" class="small-label" translate="project-overview.file-listing.file-entry.file-pending"></div>
|
||||
<div *ngIf="fileStatus.isProcessing" class="small-label" translate="project-overview.file-listing.file-entry.file-processing"></div>
|
||||
<div
|
||||
*ngIf="fileStatus.isProcessing"
|
||||
class="small-label loading"
|
||||
translate="project-overview.file-listing.file-entry.file-processing"
|
||||
></div>
|
||||
<redaction-status-bar
|
||||
*ngIf="fileStatus.isWorkable"
|
||||
[config]="[
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
"added": "Date added: {{added}}",
|
||||
"last-updated": "Last updated: {{lastUpdated}}",
|
||||
"file-pending": "Pending...",
|
||||
"file-processing": "Processing...",
|
||||
"file-processing": "Processing",
|
||||
"file-error": "Re-processing required"
|
||||
}
|
||||
},
|
||||
|
||||
23
apps/red-ui/src/assets/styles/red-loading.scss
Normal file
23
apps/red-ui/src/assets/styles/red-loading.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.loading:after {
|
||||
content: ' .';
|
||||
animation: dots 1s steps(5, end) infinite;
|
||||
}
|
||||
|
||||
@keyframes dots {
|
||||
0%,
|
||||
20% {
|
||||
color: rgba(40, 50, 65, 0);
|
||||
text-shadow: 0.25em 0 0 rgba(40, 50, 65, 0), 0.5em 0 0 rgba(40, 50, 65, 0);
|
||||
}
|
||||
40% {
|
||||
color: #283241;
|
||||
text-shadow: 0.25em 0 0 rgba(40, 50, 65, 0), 0.5em 0 0 rgba(40, 50, 65, 0);
|
||||
}
|
||||
60% {
|
||||
text-shadow: 0.25em 0 0 #283241, 0.5em 0 0 rgba(40, 50, 65, 0);
|
||||
}
|
||||
80%,
|
||||
100% {
|
||||
text-shadow: 0.25em 0 0 #283241, 0.5em 0 0 #283241;
|
||||
}
|
||||
}
|
||||
@ -25,3 +25,4 @@
|
||||
@import 'red-editor';
|
||||
@import 'red-slider';
|
||||
@import 'red-upload-download-overlay';
|
||||
@import 'red-loading';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user