RED-8226: filtering out entities with REMOVED state.

This commit is contained in:
Nicoleta Panaghiu 2024-03-04 17:01:06 +02:00
parent bb3d880cbb
commit f6497be479

View File

@ -3,7 +3,18 @@ import { toObservable } from '@angular/core/rxjs-interop';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { EntitiesService, getConfig, Toaster } from '@iqser/common-ui';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { ChangeType, ChangeTypes, File, IEntityLog, IEntityLogEntry, SuperTypeMapper, ViewedPage, ViewMode, ViewModes } from '@red/domain';
import {
ChangeType,
ChangeTypes,
EntryStates,
File,
IEntityLog,
IEntityLogEntry,
SuperTypeMapper,
ViewedPage,
ViewMode,
ViewModes,
} from '@red/domain';
import { DictionaryService } from '@services/entity-services/dictionary.service';
import { EarmarksService } from '@services/files/earmarks.service';
import { EntityLogService } from '@services/files/entity-log.service';
@ -179,21 +190,24 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
continue;
}
const canBeMappedToASuperType = !!SuperTypeMapper[entry.entryType][entry.state](entry);
if (!canBeMappedToASuperType && this.#isIqserDevMode) {
this.#logger.error(
`[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,
});
if (entry.state === EntryStates.REMOVED) {
continue;
}
const canBeMappedToASuperType = !!SuperTypeMapper[entry.entryType][entry.state](entry);
if (!canBeMappedToASuperType) {
if (this.#isIqserDevMode) {
this.#logger.warn(
`[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,
});
}
continue;
}