Refactor dossiers dialog service: remove annotations, force redaction
This commit is contained in:
parent
df54ab3fc2
commit
92fcc329ba
@ -43,8 +43,7 @@ export class AnnotationActionsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
forceRedaction($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
|
||||||
$event?.stopPropagation();
|
this._dialogService.openDialog('forceRedaction', $event, null, request => {
|
||||||
this._dialogService.openForceRedactionDialog($event, request => {
|
|
||||||
annotations.forEach(annotation => {
|
annotations.forEach(annotation => {
|
||||||
this._processObsAndEmit(
|
this._processObsAndEmit(
|
||||||
this._manualAnnotationService.forceRedaction({
|
this._manualAnnotationService.forceRedaction({
|
||||||
@ -76,7 +75,8 @@ export class AnnotationActionsService {
|
|||||||
removeFromDictionary: boolean,
|
removeFromDictionary: boolean,
|
||||||
annotationsChanged: EventEmitter<AnnotationWrapper>
|
annotationsChanged: EventEmitter<AnnotationWrapper>
|
||||||
) {
|
) {
|
||||||
this._dialogService.openRemoveFromDictionaryDialog($event, annotations, removeFromDictionary, result => {
|
const data = { annotationsToRemove: annotations, removeFromDictionary };
|
||||||
|
this._dialogService.openDialog('removeAnnotations', $event, data, result => {
|
||||||
annotations.forEach(annotation => {
|
annotations.forEach(annotation => {
|
||||||
this._processObsAndEmit(
|
this._processObsAndEmit(
|
||||||
this._manualAnnotationService.removeOrSuggestRemoveAnnotation(annotation, removeFromDictionary, result.comment),
|
this._manualAnnotationService.removeOrSuggestRemoveAnnotation(annotation, removeFromDictionary, result.comment),
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dial
|
|||||||
import { AddDossierDialogComponent } from '../dialogs/add-dossier-dialog/add-dossier-dialog.component';
|
import { AddDossierDialogComponent } from '../dialogs/add-dossier-dialog/add-dossier-dialog.component';
|
||||||
import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component';
|
import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-dialog/remove-annotations-dialog.component';
|
||||||
import { ForceRedactionDialogComponent } from '../dialogs/force-redaction-dialog/force-redaction-dialog.component';
|
import { ForceRedactionDialogComponent } from '../dialogs/force-redaction-dialog/force-redaction-dialog.component';
|
||||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
|
||||||
import { ConfirmationDialogComponent } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { DocumentInfoDialogComponent } from '../dialogs/document-info-dialog/document-info-dialog.component';
|
import { DocumentInfoDialogComponent } from '../dialogs/document-info-dialog/document-info-dialog.component';
|
||||||
import { AppStateService } from '@state/app-state.service';
|
import { AppStateService } from '@state/app-state.service';
|
||||||
@ -35,7 +34,9 @@ type DialogType =
|
|||||||
| 'assignFile'
|
| 'assignFile'
|
||||||
| 'recategorizeImage'
|
| 'recategorizeImage'
|
||||||
| 'changeLegalBasis'
|
| 'changeLegalBasis'
|
||||||
| 'dossierDictionary';
|
| 'dossierDictionary'
|
||||||
|
| 'removeAnnotations'
|
||||||
|
| 'forceRedaction';
|
||||||
|
|
||||||
type DossiersDialogConfig = {
|
type DossiersDialogConfig = {
|
||||||
[key in DialogType]: {
|
[key in DialogType]: {
|
||||||
@ -74,6 +75,12 @@ export class DossiersDialogService extends DialogService<DialogType> {
|
|||||||
dossierDictionary: {
|
dossierDictionary: {
|
||||||
component: DossierDictionaryDialogComponent,
|
component: DossierDictionaryDialogComponent,
|
||||||
dialogConfig: { width: '90vw', height: '90vh' }
|
dialogConfig: { width: '90vw', height: '90vh' }
|
||||||
|
},
|
||||||
|
removeAnnotations: {
|
||||||
|
component: RemoveAnnotationsDialogComponent
|
||||||
|
},
|
||||||
|
forceRedaction: {
|
||||||
|
component: ForceRedactionDialogComponent
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -101,36 +108,4 @@ export class DossiersDialogService extends DialogService<DialogType> {
|
|||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
openForceRedactionDialog($event: MouseEvent, cb?: Function): MatDialogRef<ForceRedactionDialogComponent> {
|
|
||||||
$event?.stopPropagation();
|
|
||||||
const ref = this._dialog.open(ForceRedactionDialogComponent, {
|
|
||||||
...dialogConfig
|
|
||||||
});
|
|
||||||
ref.afterClosed().subscribe(async result => {
|
|
||||||
if (result && cb) {
|
|
||||||
cb(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
openRemoveFromDictionaryDialog(
|
|
||||||
$event: MouseEvent,
|
|
||||||
annotations: AnnotationWrapper[],
|
|
||||||
removeFromDictionary: boolean,
|
|
||||||
cb?: Function
|
|
||||||
): MatDialogRef<RemoveAnnotationsDialogComponent> {
|
|
||||||
$event?.stopPropagation();
|
|
||||||
const ref = this._dialog.open(RemoveAnnotationsDialogComponent, {
|
|
||||||
...dialogConfig,
|
|
||||||
data: { annotationsToRemove: annotations, removeFromDictionary: removeFromDictionary }
|
|
||||||
});
|
|
||||||
ref.afterClosed().subscribe(async result => {
|
|
||||||
if (result) {
|
|
||||||
if (cb) cb(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user