RED-6774 - updates for remove here, remove in dossier and set as false positive
This commit is contained in:
parent
2d76b6c1eb
commit
f0ae6b659f
@ -179,7 +179,7 @@
|
||||
|
||||
<iqser-circle-button
|
||||
(action)="removeOrSuggestRemoveRedaction()"
|
||||
*ngIf="annotationPermissions.canRemoveOrSuggestToRemoveOnlyHere"
|
||||
*ngIf="annotationPermissions.canRemoveOrSuggestToRemoveOnlyHere && annotations.length === 1"
|
||||
[tooltipPosition]="tooltipPosition"
|
||||
[tooltip]="'annotation-actions.remove-annotation.remove-redaction' | translate"
|
||||
[type]="buttonType"
|
||||
|
||||
@ -14,7 +14,12 @@ const REMOVE_FROM_DICT_ICON = 'red:remove-from-dict';
|
||||
export interface RemoveRedactionData {
|
||||
redaction: AnnotationWrapper;
|
||||
dossier: Dossier;
|
||||
hint: boolean;
|
||||
falsePositiveContext: string;
|
||||
}
|
||||
|
||||
export interface RemoveRedactionResult {
|
||||
comment: string;
|
||||
option: DetailsRadioOption<RemoveRedactionOption>;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -28,20 +33,18 @@ export class RemoveRedactionDialogComponent extends BaseDialogComponent {
|
||||
readonly #translations = removeRedactionTranslations;
|
||||
|
||||
constructor(
|
||||
protected readonly _dialogRef: MatDialogRef<RemoveRedactionDialogComponent>,
|
||||
protected readonly _dialogRef: MatDialogRef<RemoveRedactionDialogComponent, RemoveRedactionResult>,
|
||||
@Inject(MAT_DIALOG_DATA) readonly data: RemoveRedactionData,
|
||||
) {
|
||||
super(_dialogRef);
|
||||
|
||||
this.#redaction = data.redaction;
|
||||
console.log('redaction: ', this.#redaction);
|
||||
this.options = this.#options();
|
||||
this.form = this.#getForm();
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
|
||||
save(): void {
|
||||
console.log('test');
|
||||
this._dialogRef.close(this.form.getRawValue());
|
||||
}
|
||||
|
||||
#getForm(): UntypedFormGroup {
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
|
||||
<div class="dialog-actions">
|
||||
<iqser-icon-button
|
||||
[disabled]="disabled"
|
||||
[label]="'remove-redaction.dialog.actions.save' | translate"
|
||||
[submit]="true"
|
||||
[type]="iconButtonTypes.primary"
|
||||
|
||||
@ -30,7 +30,8 @@ import { PdfViewer } from '../../pdf-viewer/services/pdf-viewer.service';
|
||||
import { REDAnnotationManager } from '../../pdf-viewer/services/annotation-manager.service';
|
||||
import { SkippedService } from './skipped.service';
|
||||
import { REDDocumentViewer } from '../../pdf-viewer/services/document-viewer.service';
|
||||
import { RemoveRedactionData } from '../dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
|
||||
import { RemoveRedactionData, RemoveRedactionResult } from '../dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
|
||||
import { RemoveRedactionOptions } from '../dialogs/remove-redaction-dialog/remove-redaction-options';
|
||||
|
||||
@Injectable()
|
||||
export class AnnotationActionsService {
|
||||
@ -134,17 +135,16 @@ export class AnnotationActionsService {
|
||||
const data: RemoveRedactionData = {
|
||||
redaction,
|
||||
dossier: this._state.dossier(),
|
||||
hint: redaction.hintDictionary,
|
||||
falsePositiveContext: this._getFalsePositiveText(redaction),
|
||||
};
|
||||
this._dialogService.openDialog('removeRedaction', data, (result: { comment: string }) => {
|
||||
const body = {
|
||||
annotationId: redaction.id,
|
||||
comment: result.comment,
|
||||
};
|
||||
const { dossierId, fileId } = this._state;
|
||||
this.#processObsAndEmit(
|
||||
this._manualRedactionService.removeOrSuggestRemove([body], dossierId, fileId, true, redaction.isHint),
|
||||
).then();
|
||||
|
||||
this._dialogService.openDialog('removeRedaction', data, (result: RemoveRedactionResult) => {
|
||||
if (result.option.value === RemoveRedactionOptions.FALSE_POSITIVE) {
|
||||
this.#setAsFalsePositive(redaction, result.comment);
|
||||
} else {
|
||||
const removeFromDictionary = result.option.value === RemoveRedactionOptions.IN_DOSSIER;
|
||||
this.#removeRedaction(redaction, result.comment, removeFromDictionary);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -394,4 +394,34 @@ export class AnnotationActionsService {
|
||||
}
|
||||
return words;
|
||||
}
|
||||
|
||||
#setAsFalsePositive(redaction: AnnotationWrapper, comment: string) {
|
||||
const request = {
|
||||
sourceId: redaction.id,
|
||||
value: this._getFalsePositiveText(redaction),
|
||||
type: redaction.type,
|
||||
positions: redaction.positions,
|
||||
addToDictionary: true,
|
||||
reason: 'False Positive',
|
||||
dictionaryEntryType: redaction.isRecommendation
|
||||
? DictionaryEntryTypes.FALSE_RECOMMENDATION
|
||||
: DictionaryEntryTypes.FALSE_POSITIVE,
|
||||
comment: comment ? { text: comment } : null,
|
||||
};
|
||||
const { dossierId, fileId } = this._state;
|
||||
|
||||
this.#processObsAndEmit(this._manualRedactionService.addAnnotation([request], dossierId, fileId)).then();
|
||||
}
|
||||
|
||||
#removeRedaction(redaction: AnnotationWrapper, comment: string, removeFromDictionary: boolean) {
|
||||
const body = {
|
||||
annotationId: redaction.id,
|
||||
comment: comment,
|
||||
removeFromDictionary,
|
||||
};
|
||||
const { dossierId, fileId } = this._state;
|
||||
this.#processObsAndEmit(
|
||||
this._manualRedactionService.removeOrSuggestRemove([body], dossierId, fileId, removeFromDictionary, redaction.isHint),
|
||||
).then();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user