bulk actions for multiple selected annotations

This commit is contained in:
Timo 2021-02-23 09:40:31 +02:00
parent 79e568abbf
commit 3b3dc5739f
6 changed files with 75 additions and 31 deletions

View File

@ -151,20 +151,7 @@ export class DialogService {
$event?.stopPropagation();
const ref = this._dialog.open(RemoveAnnotationsDialogComponent, {
...dialogConfig,
data: annotations
// new ConfirmationDialogInput({
// title: annotation.isManualRedaction
// ? 'confirmation-dialog.remove-manual-redaction.title'
// : removeFromDictionary
// ? 'confirmation-dialog.remove-from-dictionary.title'
// : 'confirmation-dialog.remove-only-here.title',
// question: annotation.isManualRedaction
// ? 'confirmation-dialog.remove-manual-redaction.question'
// : removeFromDictionary
// ? 'confirmation-dialog.remove-from-dictionary.question'
// : 'confirmation-dialog.remove-only-here.question',
// translateParams: { entry: annotation.value, dictionary: annotation.dictionary }
// })
data: { annotationsToRemove: annotations, removeFromDictionary: removeFromDictionary }
});
ref.afterClosed().subscribe(async (result) => {
if (result) {

View File

@ -1,18 +1,47 @@
<section class="dialog">
<div class="dialog-header heading-l">
<!-- {{ confirmationDialogInput.title | translate: confirmationDialogInput.translateParams }}-->
{{
(data.removeFromDictionary ? 'remove-annotations-dialog.remove-from-dictionary.title' : 'remove-annotations-dialog.remove-only-here.title')
| translate
}}
</div>
<div class="dialog-content">
<!-- <p [innerHTML]="confirmationDialogInput.question | translate: confirmationDialogInput.translateParams"></p>-->
{{
(data.removeFromDictionary ? 'remove-annotations-dialog.remove-from-dictionary.question' : 'remove-annotations-dialog.remove-only-here.question')
| translate
}}
<div class="content-wrapper" *ngIf="data.removeFromDictionary">
<table class="default-table">
<thead>
<tr>
<th>{{ 'remove-annotations-dialog.dictionary' | translate }}</th>
<th>{{ 'remove-annotations-dialog.value' | translate }}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let annotation of data.annotationsToRemove">
<td>{{ annotation.dictionary }}</td>
<td>{{ annotation.value }}</td>
</tr>
</tbody>
</table>
</div>
<ul *ngIf="!data.removeFromDictionary">
<li *ngFor="let annotation of data.annotationsToRemove">
{{ annotation.value }}
</li>
</ul>
</div>
<div class="dialog-actions">
<button (click)="confirm()" color="primary" mat-flat-button>
<!-- {{ confirmationDialogInput.confirmationText | translate: confirmationDialogInput.translateParams }}-->
{{ 'remove-annotations-dialog.confirm' | translate }}
</button>
<button (click)="deny()" color="primary" mat-flat-button>
<!-- {{ confirmationDialogInput.denyText | translate: confirmationDialogInput.translateParams }}-->
{{ 'remove-annotations-dialog.deny' | translate }}
</button>
</div>

View File

@ -0,0 +1,10 @@
.content-wrapper {
padding-top: 20px;
padding-bottom: 8px;
}
ul {
li {
padding-top: 4px;
}
}

View File

@ -4,6 +4,11 @@ import { TranslateService } from '@ngx-translate/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { ConfirmationDialogInput } from '../confirmation-dialog/confirmation-dialog.component';
export interface RemoveAnnotationsDialogInput {
annotationsToRemove: AnnotationWrapper[];
removeFromDictionary: boolean;
}
@Component({
selector: 'redaction-remove-annotations-dialog',
templateUrl: './remove-annotations-dialog.component.html',
@ -13,7 +18,7 @@ export class RemoveAnnotationsDialogComponent implements OnInit {
constructor(
private readonly _translateService: TranslateService,
public dialogRef: MatDialogRef<RemoveAnnotationsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public annotationsToRemove: AnnotationWrapper[]
@Inject(MAT_DIALOG_DATA) public data: RemoveAnnotationsDialogInput
) {}
ngOnInit(): void {}

View File

@ -546,6 +546,20 @@
"error": "Failed to add redaction."
}
},
"remove-annotations-dialog": {
"remove-from-dictionary": {
"title": "Remove From Dictionary",
"question": "Following entries will be removed from their respective dictionaries:"
},
"remove-only-here": {
"title": "Remove Redaction",
"question": "Following redactions will be removed only here:"
},
"dictionary": "Dictionary",
"value": "Value",
"confirm": "Yes, proceed and remove!",
"deny": "Cancel"
},
"confirmation-dialog": {
"delete-file": {
"title": "Delete Document",
@ -554,18 +568,6 @@
"delete-project": {
"title": "Delete Project",
"question": "Do you wish to proceed?"
},
"remove-manual-redaction": {
"title": "Remove Redaction",
"question": "Are you sure you wish to remove this redaction?"
},
"remove-from-dictionary": {
"title": "Remove From Dictionary",
"question": "Are you sure you want to remove <b>{{entry}}</b> from the <b>{{dictionary}}</b> dictionary?"
},
"remove-only-here": {
"title": "Remove Only Here",
"question": "Are you sure you want to remove <b>{{entry}}</b> only here?"
}
},
"add-edit-dictionary": {

View File

@ -1,6 +1,17 @@
@import 'red-variables';
@import 'red-mixins';
.default-table {
border-collapse: collapse;
th,
td {
padding: 8px;
text-align: left;
border: 1px solid $separator;
}
}
.no-data {
padding: 24px;
}