Refactor dossiers dialog service: recategorize image

This commit is contained in:
Adina Țeudan 2021-08-09 20:44:40 +03:00
parent d18359aa6c
commit 40a361a689
3 changed files with 8 additions and 23 deletions

View File

@ -45,7 +45,7 @@
></iqser-circle-button>
<iqser-circle-button
(action)="annotationActionsService.recategorizeImage($event, annotations, annotationsChanged)"
(action)="annotationActionsService.recategorizeImages($event, annotations, annotationsChanged)"
*ngIf="annotationPermissions.canRecategorizeImage"
[tooltipPosition]="tooltipPosition"
[tooltip]="'annotation-actions.recategorize-image' | translate"

View File

@ -100,8 +100,8 @@ export class AnnotationActionsService {
});
}
recategorizeImage($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
this._dialogService.openRecategorizeImageDialog($event, annotations, (data: { type: string; comment: string }) => {
recategorizeImages($event: MouseEvent, annotations: AnnotationWrapper[], annotationsChanged: EventEmitter<AnnotationWrapper>) {
this._dialogService.openDialog('recategorizeImage', $event, annotations, (data: { type: string; comment: string }) => {
annotations.forEach(annotation => {
this._processObsAndEmit(
this._manualAnnotationService.recategorizeImage(annotation.annotationId, data.type, data.comment),
@ -147,7 +147,7 @@ export class AnnotationActionsService {
title: this._translateService.instant('annotation-actions.recategorize-image'),
onClick: () => {
this._ngZone.run(() => {
this.recategorizeImage(null, annotations, annotationsChanged);
this.recategorizeImages(null, annotations, annotationsChanged);
});
}
});

View File

@ -28,7 +28,7 @@ const dialogConfig = {
// TODO: Continue refactor
type DialogType = 'confirm' | 'documentInfo' | 'editDossier' | 'addDossier' | 'assignFile';
type DialogType = 'confirm' | 'documentInfo' | 'editDossier' | 'addDossier' | 'assignFile' | 'recategorizeImage';
type DossiersDialogConfig = {
[key in DialogType]: {
@ -61,6 +61,9 @@ export class DossiersDialogService extends DialogService<DialogType> {
},
assignFile: {
component: AssignReviewerApproverDialogComponent
},
recategorizeImage: {
component: RecategorizeImageDialogComponent
}
};
@ -120,24 +123,6 @@ export class DossiersDialogService extends DialogService<DialogType> {
return ref;
}
openRecategorizeImageDialog(
$event: MouseEvent,
annotations: AnnotationWrapper[],
cb?: Function
): MatDialogRef<RecategorizeImageDialogComponent> {
$event?.stopPropagation();
const ref = this._dialog.open(RecategorizeImageDialogComponent, {
...dialogConfig,
data: annotations
});
ref.afterClosed().subscribe(async result => {
if (result && cb) {
cb(result);
}
});
return ref;
}
openRemoveFromDictionaryDialog(
$event: MouseEvent,
annotations: AnnotationWrapper[],