From 7b9d5ac405979e17b0bd18b45c5ecf6bfab3e75e Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 29 Mar 2022 15:24:24 +0300 Subject: [PATCH] minor changes --- .../notifications/notifications.component.ts | 11 +---------- .../file-preview-screen.component.ts | 16 ++++++++-------- .../services/entity-services/files.service.ts | 2 +- .../image-recategorization.request.ts | 6 +++--- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/apps/red-ui/src/app/components/notifications/notifications.component.ts b/apps/red-ui/src/app/components/notifications/notifications.component.ts index d6ac0841b..e86ba6b10 100644 --- a/apps/red-ui/src/app/components/notifications/notifications.component.ts +++ b/apps/red-ui/src/app/components/notifications/notifications.component.ts @@ -1,8 +1,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { TranslateService } from '@ngx-translate/core'; import { DatePipe } from '@shared/pipes/date.pipe'; -import { UserService } from '@services/user.service'; -import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; import { NotificationsService } from '@services/notifications.service'; import { Notification } from '@red/domain'; import { distinctUntilChanged, map } from 'rxjs/operators'; @@ -24,13 +21,7 @@ export class NotificationsComponent { readonly hasUnreadNotifications$: Observable; readonly groupedNotifications$: Observable; - constructor( - private readonly _translateService: TranslateService, - private readonly _userService: UserService, - private readonly _notificationsService: NotificationsService, - private readonly _activeDossiersService: ActiveDossiersService, - private readonly _datePipe: DatePipe, - ) { + constructor(private readonly _notificationsService: NotificationsService, private readonly _datePipe: DatePipe) { this.groupedNotifications$ = this._notificationsService.all$.pipe(map(notifications => this._groupNotifications(notifications))); this.hasUnreadNotifications$ = this._hasUnreadNotifications$; } diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 77885751e..ddc08f024 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -142,7 +142,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } async updateViewMode(): Promise { - this._logger.debug(`[PDF] Update ${this._viewModeService.viewMode} view mode`); + this._logger.info(`[PDF] Update ${this._viewModeService.viewMode} view mode`); const annotations = this.pdf.getAnnotations(a => a.getCustomData('redact-manager')); const redactions = annotations.filter(a => a.getCustomData('redaction')); @@ -249,7 +249,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni ), }); - this._logger.debug(`[FILTERS] Rebuild time: ${new Date().getTime() - startTime} ms`); + this._logger.info(`[FILTERS] Rebuild time: ${new Date().getTime() - startTime} ms`); } async handleAnnotationSelected(annotationIds: string[]) { @@ -290,7 +290,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni null, { manualRedactionEntryWrapper, dossierId: this.dossierId }, async ({ manualRedactionEntry }: ManualRedactionEntryWrapper) => { - const addAnnotation$ = this._manualRedactionService.addAnnotation(manualRedactionEntry, this.dossierId, this.fileId); + const addAnnotation$ = this._manualRedactionService.addAnnotation([manualRedactionEntry], this.dossierId, this.fileId); await firstValueFrom(addAnnotation$.pipe(catchError(() => of(undefined)))); await this._fileDataService.loadAnnotations(); }, @@ -417,7 +417,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni pairwise(), tap(annotations => this.deleteAnnotations(...annotations)), switchMap(annotations => this.drawChangedAnnotations(...annotations)), - tap(() => this._logger.debug(`[ANNOTATIONS] Processing time: ${new Date().getTime() - start}`)), + tap(() => this._logger.info(`[ANNOTATIONS] Processing time: ${new Date().getTime() - start}`)), tap(() => this.updateViewMode()), ); } @@ -429,7 +429,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return; } - this._logger.debug('[ANNOTATIONS] To delete: ', annotationsToDelete); + this._logger.info('[ANNOTATIONS] To delete: ', annotationsToDelete); this.pdf.deleteAnnotations(annotationsToDelete.map(annotation => annotation.id)); } @@ -448,7 +448,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return firstValueFrom(of({})); } - this._logger.debug('[ANNOTATIONS] To draw: ', annotationsToDraw); + this._logger.info('[ANNOTATIONS] To draw: ', annotationsToDraw); const annotationsToDrawIds = annotationsToDraw.map(a => a.annotationId); this.pdf.deleteAnnotations(annotationsToDrawIds); return this._cleanupAndRedrawAnnotations(annotationsToDraw); @@ -476,7 +476,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni const changed = JSON.stringify(oldAnnotation) !== JSON.stringify(newAnnotation); if (changed && this.userPreferenceService.areDevFeaturesEnabled) { import('@iqser/common-ui').then(commonUi => { - this._logger.debug('[ANNOTATIONS] Changed annotation: ', { + this._logger.info('[ANNOTATIONS] Changed annotation: ', { value: oldAnnotation.value, before: commonUi.deepDiffObj(newAnnotation, oldAnnotation), after: commonUi.deepDiffObj(oldAnnotation, newAnnotation), @@ -626,7 +626,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } await this._annotationDrawService.drawAnnotations(newAnnotations); - this._logger.debug(`[ANNOTATIONS] Redraw time: ${new Date().getTime() - startTime} ms for ${newAnnotations.length} annotations`); + this._logger.info(`[ANNOTATIONS] Redraw time: ${new Date().getTime() - startTime} ms for ${newAnnotations.length} annotations`); } private _handleDeltaAnnotationFilters(currentFilters: NestedFilter[], newAnnotations: AnnotationWrapper[]) { diff --git a/apps/red-ui/src/app/services/entity-services/files.service.ts b/apps/red-ui/src/app/services/entity-services/files.service.ts index f3c1da6b0..f04b5caf9 100644 --- a/apps/red-ui/src/app/services/entity-services/files.service.ts +++ b/apps/red-ui/src/app/services/entity-services/files.service.ts @@ -36,7 +36,7 @@ export class FilesService extends EntitiesService { map(_file => new File(_file, this._userService.getNameForId(_file.assignee), file.routerPath)), switchMap(_file => this._dossierStatsService.getFor([dossierId]).pipe(mapTo(_file))), map(_file => this._filesMapService.replace([_file])), - tap(() => this._logger.debug('[FILE] Loaded')), + tap(() => this._logger.info('[FILE] Loaded')), ); } diff --git a/libs/red-domain/src/lib/redaction-log/image-recategorization.request.ts b/libs/red-domain/src/lib/redaction-log/image-recategorization.request.ts index 1870b00f5..f6601b675 100644 --- a/libs/red-domain/src/lib/redaction-log/image-recategorization.request.ts +++ b/libs/red-domain/src/lib/redaction-log/image-recategorization.request.ts @@ -1,5 +1,5 @@ export interface IImageRecategorizationRequest { - annotationId?: string; - comment?: string; - type?: string; + readonly annotationId?: string; + readonly comment?: string; + readonly type?: string; }