remove annotations/redactions UI WIP
This commit is contained in:
parent
9c3aa3fb0e
commit
1bea2aecc9
@ -217,4 +217,29 @@ export class DialogService {
|
|||||||
|
|
||||||
return ref;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export class ManualAnnotationDialogComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.isDocumentAdmin = this._appStateService.isActiveProjectOwner;
|
this.isDocumentAdmin = this._appStateService.isActiveProjectOwnerAndManager;
|
||||||
const commentField = this.isDocumentAdmin ? [null] : [null, Validators.required];
|
const commentField = this.isDocumentAdmin ? [null] : [null, Validators.required];
|
||||||
this.redactionForm = this._formBuilder.group({
|
this.redactionForm = this._formBuilder.group({
|
||||||
reason:
|
reason:
|
||||||
|
|||||||
@ -171,13 +171,15 @@
|
|||||||
<redaction-comments [annotation]="annotation"></redaction-comments>
|
<redaction-comments [annotation]="annotation"></redaction-comments>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
*ngIf="annotation.superType === 'request'"
|
|
||||||
[class.visible]="isAnnotationMenuOpen(annotation)"
|
[class.visible]="isAnnotationMenuOpen(annotation)"
|
||||||
class="annotation-actions"
|
class="annotation-actions"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
(click)="openAcceptSuggestionMenu($event, annotation)"
|
(click)="openAcceptSuggestionMenu($event, annotation)"
|
||||||
*ngIf="appStateService.isActiveProjectOwnerAndManager"
|
*ngIf="
|
||||||
|
appStateService.isActiveProjectOwnerAndManager &&
|
||||||
|
annotation.superType === 'request'
|
||||||
|
"
|
||||||
[class.active]="isAnnotationMenuOpen(annotation)"
|
[class.active]="isAnnotationMenuOpen(annotation)"
|
||||||
[matMenuTriggerFor]="menu"
|
[matMenuTriggerFor]="menu"
|
||||||
class="confirm"
|
class="confirm"
|
||||||
@ -217,6 +219,14 @@
|
|||||||
</mat-menu>
|
</mat-menu>
|
||||||
<button
|
<button
|
||||||
(click)="rejectSuggestion($event, annotation)"
|
(click)="rejectSuggestion($event, annotation)"
|
||||||
|
*ngIf="annotation.superType === 'request'"
|
||||||
|
mat-icon-button
|
||||||
|
>
|
||||||
|
<mat-icon svgIcon="red:trash"></mat-icon>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
(click)="suggestRemoveAnnotation($event, annotation)"
|
||||||
|
*ngIf="annotation.superType !== 'request'"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
>
|
>
|
||||||
<mat-icon svgIcon="red:trash"></mat-icon>
|
<mat-icon svgIcon="red:trash"></mat-icon>
|
||||||
|
|||||||
@ -291,14 +291,14 @@ export class FilePreviewScreenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
|
public rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||||
this.ngZone.run(() => {
|
this._dialogRef = this._dialogService.openRejectSuggestionModal($event, annotation, () => {
|
||||||
this._dialogRef = this._dialogService.openRejectSuggestionModal(
|
this._cleanupAndRedrawManualAnnotations();
|
||||||
$event,
|
});
|
||||||
annotation,
|
}
|
||||||
() => {
|
|
||||||
this._cleanupAndRedrawManualAnnotations();
|
suggestRemoveAnnotation($event: MouseEvent, annotation: AnnotationWrapper) {
|
||||||
}
|
this._dialogRef = this._dialogService.openRemoveAnnotationModal($event, annotation, () => {
|
||||||
);
|
this._cleanupAndRedrawManualAnnotations();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,13 +3,12 @@ import { AppStateService } from '../../../state/app-state.service';
|
|||||||
import {
|
import {
|
||||||
DictionaryControllerService,
|
DictionaryControllerService,
|
||||||
ManualRedactionControllerService,
|
ManualRedactionControllerService,
|
||||||
ManualRedactionEntry,
|
ManualRedactionEntry
|
||||||
ManualRedactions
|
|
||||||
} from '@redaction/red-ui-http';
|
} from '@redaction/red-ui-http';
|
||||||
import { AnnotationWrapper } from '../model/annotation.wrapper';
|
import { AnnotationWrapper } from '../model/annotation.wrapper';
|
||||||
import { NotificationService, NotificationType } from '../../../notification/notification.service';
|
import { NotificationService, NotificationType } from '../../../notification/notification.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { map, mergeMap, tap } from 'rxjs/operators';
|
import { mergeMap, tap } from 'rxjs/operators';
|
||||||
import { UserService } from '../../../user/user.service';
|
import { UserService } from '../../../user/user.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@ -111,7 +110,56 @@ export class ManualAnnotationService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeRedaction(annotationWrapper: AnnotationWrapper) {}
|
public removeAnnotation(
|
||||||
|
annotationWrapper: AnnotationWrapper,
|
||||||
|
removeFromDictionary: boolean = false
|
||||||
|
) {
|
||||||
|
if (this._appStateService.isActiveProjectOwnerAndManager) {
|
||||||
|
return this._manualRedactionControllerService
|
||||||
|
.removeRedaction(
|
||||||
|
{
|
||||||
|
annotationId: annotationWrapper.id,
|
||||||
|
removeFromDictionary: removeFromDictionary,
|
||||||
|
comment: { text: 'Auto' }
|
||||||
|
},
|
||||||
|
this._appStateService.activeProjectId,
|
||||||
|
this._appStateService.activeFileId
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
tap(
|
||||||
|
() => this._notify('manual-annotation.remove-redaction-request.success'),
|
||||||
|
() => {
|
||||||
|
this._notify(
|
||||||
|
'manual-annotation.remove-redaction-request.error',
|
||||||
|
NotificationType.ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return this._manualRedactionControllerService
|
||||||
|
.requestRemoveRedaction(
|
||||||
|
{
|
||||||
|
annotationId: annotationWrapper.id,
|
||||||
|
removeFromDictionary: removeFromDictionary,
|
||||||
|
comment: { text: 'Auto' }
|
||||||
|
},
|
||||||
|
this._appStateService.activeProjectId,
|
||||||
|
this._appStateService.activeFileId
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
tap(
|
||||||
|
() => this._notify('manual-annotation.remove-redaction-request.success'),
|
||||||
|
() => {
|
||||||
|
this._notify(
|
||||||
|
'manual-annotation.remove-redaction-request.error',
|
||||||
|
NotificationType.ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private _makeRedactionRequest(manualRedactionEntry: ManualRedactionEntry) {
|
private _makeRedactionRequest(manualRedactionEntry: ManualRedactionEntry) {
|
||||||
return this._manualRedactionControllerService
|
return this._manualRedactionControllerService
|
||||||
@ -162,7 +210,7 @@ export class ManualAnnotationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTitle(type: 'DICTIONARY' | 'REDACTION') {
|
getTitle(type: 'DICTIONARY' | 'REDACTION') {
|
||||||
if (this._appStateService.isActiveProjectOwner) {
|
if (this._appStateService.isActiveProjectOwnerAndManager) {
|
||||||
if (type === 'DICTIONARY') {
|
if (type === 'DICTIONARY') {
|
||||||
return 'manual-redaction.dialog.header.dictionary';
|
return 'manual-redaction.dialog.header.dictionary';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -246,7 +246,8 @@
|
|||||||
<button
|
<button
|
||||||
(click)="openDeleteFileDialog($event, fileStatus)"
|
(click)="openDeleteFileDialog($event, fileStatus)"
|
||||||
*ngIf="
|
*ngIf="
|
||||||
userService.isManager(user) || appStateService.isActiveProjectOwner
|
userService.isManager(user) ||
|
||||||
|
appStateService.isActiveProjectOwnerAndManager
|
||||||
"
|
"
|
||||||
[matTooltip]="'project-overview.delete.action' | translate"
|
[matTooltip]="'project-overview.delete.action' | translate"
|
||||||
[matTooltipPosition]="'above'"
|
[matTooltipPosition]="'above'"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user