From 1bea2aecc9246f242f8f2e4f0da4fda0166b0cd6 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Tue, 3 Nov 2020 23:58:06 +0200 Subject: [PATCH] remove annotations/redactions UI WIP --- apps/red-ui/src/app/dialogs/dialog.service.ts | 25 ++++++++ .../manual-annotation-dialog.component.ts | 2 +- .../file-preview-screen.component.html | 14 ++++- .../file-preview-screen.component.ts | 16 ++--- .../file/service/manual-annotation.service.ts | 58 +++++++++++++++++-- .../project-overview-screen.component.html | 3 +- 6 files changed, 101 insertions(+), 17 deletions(-) diff --git a/apps/red-ui/src/app/dialogs/dialog.service.ts b/apps/red-ui/src/app/dialogs/dialog.service.ts index 5a8dcf645..95af06464 100644 --- a/apps/red-ui/src/app/dialogs/dialog.service.ts +++ b/apps/red-ui/src/app/dialogs/dialog.service.ts @@ -217,4 +217,29 @@ export class DialogService { return ref; } + + openRemoveAnnotationModal( + $event: MouseEvent, + annotation: AnnotationWrapper, + callback: () => void + ) { + $event.stopPropagation(); + + const ref = this._dialog.open(ConfirmationDialogComponent, { + width: '400px', + maxWidth: '90vw' + }); + + ref.afterClosed().subscribe((result) => { + if (result) { + this._manualAnnotationService.removeAnnotation(annotation).subscribe(() => { + if (callback) { + callback(); + } + }); + } + }); + + return ref; + } } diff --git a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts index 411e58904..942cc4609 100644 --- a/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts +++ b/apps/red-ui/src/app/dialogs/manual-redaction-dialog/manual-annotation-dialog.component.ts @@ -32,7 +32,7 @@ export class ManualAnnotationDialogComponent implements OnInit { ) {} async ngOnInit() { - this.isDocumentAdmin = this._appStateService.isActiveProjectOwner; + this.isDocumentAdmin = this._appStateService.isActiveProjectOwnerAndManager; const commentField = this.isDocumentAdmin ? [null] : [null, Validators.required]; this.redactionForm = this._formBuilder.group({ reason: diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index 60fdc9626..6c03e7761 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -171,13 +171,15 @@
+