added removal request for annotations, this request however does not work at the moment

This commit is contained in:
Timo Bejan 2020-10-14 16:59:17 +03:00
parent 46e23d4505
commit 093b3a01fc
5 changed files with 43 additions and 9 deletions

View File

@ -9,10 +9,10 @@
translate="top-bar.navigation-items.projects.label">
</button>
<button *ngIf="appStateService.activeProject"
[routerLink]="'/ui/projects/'+appStateService.activeProject.project.projectId"
[routerLink]="'/ui/projects/'+appStateService.activeProjectId"
mat-menu-item>{{appStateService.activeProject.project.projectName}}</button>
<button *ngIf="appStateService.activeFile"
[routerLink]="'/ui/projects/'+appStateService.activeProject.project.projectId+'/file/'+appStateService.activeFile.fileId"
[routerLink]="'/ui/projects/'+appStateService.activeProjectId+'/file/'+appStateService.activeFile.fileId"
mat-menu-item>{{appStateService.activeFile.filename}}</button>
</mat-menu>
</div>
@ -23,14 +23,14 @@
<mat-icon svgIcon="red:chevron-right"></mat-icon>
</div>
<a *ngIf="appStateService.activeProject" class="breadcrumb"
[routerLink]="'/ui/projects/'+appStateService.activeProject.project.projectId">
[routerLink]="'/ui/projects/'+appStateService.activeProjectId">
{{appStateService.activeProject.project.projectName}}
</a>
<div *ngIf="appStateService.activeFile" class="breadcrumb">
<mat-icon svgIcon="red:chevron-right"></mat-icon>
</div>
<a *ngIf="appStateService.activeFile" class="breadcrumb"
[routerLink]="'/ui/projects/'+appStateService.activeProject.project.projectId+'/file/'+appStateService.activeFile.fileId">
[routerLink]="'/ui/projects/'+appStateService.activeProjectId+'/file/'+appStateService.activeFile.fileId">
{{appStateService.activeFile.filename}}
</a>
</div>

View File

@ -2,12 +2,13 @@ import {ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild} from '@angu
import {ActivatedRoute, Router} from '@angular/router';
import {
FileUploadControllerService,
ManualRedactionControllerService,
ManualRedactionEntry,
ProjectControllerService,
StatusControllerService
} from '@redaction/red-ui-http';
import {TranslateService} from '@ngx-translate/core';
import {NotificationService} from '../../../notification/notification.service';
import {NotificationService, NotificationType} from '../../../notification/notification.service';
import {MatDialog} from '@angular/material/dialog';
import {AppStateService} from '../../../state/app-state.service';
import {FileDetailsDialogComponent} from './file-details-dialog/file-details-dialog.component';
@ -19,6 +20,7 @@ import {ManualRedactionDialogComponent} from "../manual-redaction-dialog/manual-
import {UserService} from "../../../user/user.service";
import {debounce} from "../../../utils/debounce";
import scrollIntoView from 'scroll-into-view-if-needed'
import {ConfirmationDialogComponent} from "../../../common/confirmation-dialog/confirmation-dialog.component";
@Component({
selector: 'redaction-file-preview-screen',
@ -58,6 +60,7 @@ export class FilePreviewScreenComponent implements OnInit {
private readonly _viewerSyncService: ViewerSyncService,
private readonly _dialog: MatDialog,
private readonly _router: Router,
private readonly _manualRedactionControllerService: ManualRedactionControllerService,
private readonly _userService: UserService,
private readonly _fileUploadControllerService: FileUploadControllerService,
private readonly _projectControllerService: ProjectControllerService) {
@ -263,5 +266,24 @@ export class FilePreviewScreenComponent implements OnInit {
suggestRemoveAnnotation($event: MouseEvent, annotation: Annotations.Annotation) {
$event.stopPropagation();
const dialogRef = this._dialog.open(ConfirmationDialogComponent, {
width: '400px',
maxWidth: '90vw'
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this._manualRedactionControllerService.updateManualRedaction({
idsToRemove: [{
id: annotation.Id,
removeFromDictionary: false
}]
}, this.appStateService.activeProjectId, this.appStateService.activeFile.fileId).subscribe(ok=>{
this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.remove-annotation.success.label'), null, NotificationType.SUCCESS);
},(err)=>{
this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.remove-annotation.failed.label',err), null, NotificationType.ERROR);
});
}
});
}
}

View File

@ -48,11 +48,11 @@ export class ManualRedactionDialogComponent implements OnInit {
saveManualRedaction() {
const mre = Object.assign({}, this.manualRedactionInput);
this._enhanceManualRedaction(mre);
this._manualRedactionControllerService.updateManualRedaction({entriesToAdd: [mre]}, this._appStateService.activeProject.project.projectId, this._appStateService.activeFile.fileId).subscribe(ok=>{
this._manualRedactionControllerService.updateManualRedaction({entriesToAdd: [mre]}, this._appStateService.activeProject.project.projectId, this._appStateService.activeFile.fileId).subscribe(ok => {
this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.success.label'), null, NotificationType.SUCCESS);
this.dialogRef.close();
},(err)=>{
this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.failed.label',err), null, NotificationType.SUCCESS);
}, (err) => {
this._notificationService.showToastNotification(this._translateService.instant('manual-redaction.dialog.add-redaction.failed.label', err), null, NotificationType.ERROR);
});
}
@ -63,7 +63,7 @@ export class ManualRedactionDialogComponent implements OnInit {
mre.reason = this.redactionForm.get('reason').value;
}
get showDictionary(){
get showDictionary() {
return !this.redactionForm.get('addToDictionary').value
}

View File

@ -44,6 +44,10 @@ export class AppStateService {
}
}
get activeProjectId(): string {
return this._appState.activeProject?.project?.projectId;
}
get activeProject(): ProjectWrapper {
return this._appState.activeProject;
}

View File

@ -1,5 +1,13 @@
{
"manual-redaction": {
"remove-annotation": {
"success": {
"label": "Annotation Suggested for removal!"
},
"failed": {
"label": "Error requesting Annotation removal!"
}
},
"dialog": {
"header": {
"label": "Add Manual Redaction"