Merge branch 'RED-8711-filter-out-no-positions-entries' into 'master'
RED-8711 - Filter out entity log entries that have no positions and show a... Closes RED-8711 See merge request redactmanager/red-ui!361
This commit is contained in:
commit
e16b8a0729
@ -15,6 +15,7 @@ import {
|
||||
ViewMode,
|
||||
ViewModes,
|
||||
} from '@red/domain';
|
||||
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
|
||||
import { DictionaryService } from '@services/entity-services/dictionary.service';
|
||||
import { EarmarksService } from '@services/files/earmarks.service';
|
||||
import { EntityLogService } from '@services/files/entity-log.service';
|
||||
@ -29,7 +30,6 @@ import { firstValueFrom, Observable } from 'rxjs';
|
||||
import { FilePreviewStateService } from './file-preview-state.service';
|
||||
import { MultiSelectService } from './multi-select.service';
|
||||
import { ViewModeService } from './view-mode.service';
|
||||
import { DefaultColorsService } from '@services/entity-services/default-colors.service';
|
||||
|
||||
const DELTA_VIEW_TIME = 10 * 60 * 1000; // 10 minutes;
|
||||
|
||||
@ -190,10 +190,6 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.state === EntryStates.REMOVED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const canBeMappedToASuperType = !!SuperTypeMapper[entry.entryType][entry.state](entry);
|
||||
if (!canBeMappedToASuperType) {
|
||||
if (this.#isIqserDevMode) {
|
||||
@ -201,13 +197,8 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
|
||||
`[ENTITY_LOG] Entity ${entry.value} (${entry.entryType}, ${entry.state}) cannot be mapped to a super type!`,
|
||||
entry,
|
||||
);
|
||||
this.#toaster.info(`Skipping entity ${entry.value} (${entry.entryType}, ${entry.state}). Check console for details.`, {
|
||||
timeOut: 10000,
|
||||
easing: 'ease-in-out',
|
||||
easeTime: 500,
|
||||
useRaw: true,
|
||||
});
|
||||
}
|
||||
this.#toaster.devInfo(`Skipping entity ${entry.value} (${entry.entryType}, ${entry.state}). Check console for details.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { GenericService } from '@iqser/common-ui';
|
||||
import { IEntityLog, ISectionGrid } from '@red/domain';
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { GenericService, isIqserDevMode, Toaster } from '@iqser/common-ui';
|
||||
import { EntryStates, IEntityLog, IEntityLogEntry, ISectionGrid } from '@red/domain';
|
||||
import { firstValueFrom, of } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@ -9,11 +9,13 @@ import { catchError } from 'rxjs/operators';
|
||||
})
|
||||
export class EntityLogService extends GenericService<unknown> {
|
||||
protected readonly _defaultModelPath = '';
|
||||
readonly #toaster = inject(Toaster);
|
||||
|
||||
async getEntityLog(dossierId: string, fileId: string) {
|
||||
const queryParams = [{ key: 'includeUnprocessed', value: true }];
|
||||
const entityLog$ = this._getOne<IEntityLog>([dossierId, fileId], 'entityLog', queryParams);
|
||||
const entityLog = await firstValueFrom(entityLog$.pipe(catchError(() => of({} as IEntityLog))));
|
||||
entityLog.entityLogEntry = this.#filterInvalidEntries(entityLog.entityLogEntry);
|
||||
entityLog.entityLogEntry.sort((a, b) => a.positions[0].pageNumber - b.positions[0].pageNumber);
|
||||
return entityLog;
|
||||
}
|
||||
@ -21,4 +23,15 @@ export class EntityLogService extends GenericService<unknown> {
|
||||
getSectionGrid(dossierId: string, fileId: string) {
|
||||
return this._getOne<ISectionGrid>([dossierId, fileId], 'sectionGrid');
|
||||
}
|
||||
|
||||
#filterInvalidEntries(entityLogEntry: IEntityLogEntry[]) {
|
||||
return entityLogEntry.filter(entry => {
|
||||
const hasPositions = !!entry.positions?.length;
|
||||
const isRemoved = entry.state === EntryStates.REMOVED;
|
||||
if (!hasPositions) {
|
||||
this.#toaster.devInfo(`Entry ${entry.id} was skipped because it has no position`);
|
||||
}
|
||||
return hasPositions && !isRemoved;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
7
apps/red-ui/src/assets/styles/themes/redact.css
Normal file
7
apps/red-ui/src/assets/styles/themes/redact.css
Normal file
@ -0,0 +1,7 @@
|
||||
body.light {
|
||||
/*Override the default light theme here*/
|
||||
}
|
||||
|
||||
body.dark {
|
||||
/*Override the default dark theme here*/
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user