diff --git a/apps/red-ui/src/app/services/files/redaction-log.service.ts b/apps/red-ui/src/app/services/files/redaction-log.service.ts index 8e9133564..cc95215ae 100644 --- a/apps/red-ui/src/app/services/files/redaction-log.service.ts +++ b/apps/red-ui/src/app/services/files/redaction-log.service.ts @@ -1,13 +1,15 @@ -import { Injectable } from '@angular/core'; -import { GenericService, QueryParam } from '@iqser/common-ui'; +import { inject, Injectable } from '@angular/core'; +import { GenericService, isIqserDevMode, QueryParam, Toaster } from '@iqser/common-ui'; import { IRedactionLog, ISectionGrid } from '@red/domain'; -import { catchError } from 'rxjs/operators'; import { firstValueFrom, of } from 'rxjs'; +import { catchError } from 'rxjs/operators'; @Injectable({ providedIn: 'root', }) export class RedactionLogService extends GenericService { + readonly #isIqserDevMode = isIqserDevMode(); + readonly #toaster = inject(Toaster); protected readonly _defaultModelPath = ''; async getRedactionLog(dossierId: string, fileId: string, withManualRedactions?: boolean) { @@ -18,6 +20,18 @@ export class RedactionLogService extends GenericService { const redactionLog$ = this._getOne([dossierId, fileId], 'redactionLog', queryParams); const redactionLog = await firstValueFrom(redactionLog$.pipe(catchError(() => of({} as IRedactionLog)))); + redactionLog.redactionLogEntry = redactionLog.redactionLogEntry.filter(entry => { + const hasPositions = entry.positions && entry.positions.length; + if (!hasPositions && this.#isIqserDevMode) { + this.#toaster.info(`Entry ${entry.id} was skipped because has no positions`, { + timeOut: 10000, + easing: 'ease-in-out', + easeTime: 500, + useRaw: true, + }); + } + return hasPositions; + }); redactionLog.redactionLogEntry.sort((a, b) => a.positions[0].page - b.positions[0].page); return redactionLog; } diff --git a/libs/common-ui b/libs/common-ui index 3776e8ece..1610a4c3a 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 3776e8ecefba36b39c47567f86b451f5440e75f7 +Subproject commit 1610a4c3a59ab6669cd96a02f2c68d5b0e5dcfd9