Merge branch 'RED-8684' into 'master'

RED-8684: fixed missing type warning bug.

See merge request redactmanager/red-ui!342
This commit is contained in:
Dan Percic 2024-03-14 13:56:32 +01:00
commit 5923084bb5
2 changed files with 10 additions and 27 deletions

View File

@ -213,7 +213,7 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
let dictionary = dictionaries.find(dict => dict.type === entry.type);
if (!dictionary && checkDictionary) {
const dictionaryRequest = this._dictionaryService.loadDictionaryDataForDossierTemplate(
const dictionaryRequest = this._dictionaryService.loadTemporaryDictionaryData(
this._state.dossierTemplateId,
this._state.isReadonly(),
);

View File

@ -56,7 +56,9 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
if (readOnly) {
queryParams.push({ key: 'includeDeleted', value: true });
}
return this._getOne<{ types: IDictionary[] }>(['type', dossierTemplateId], this._defaultModelPath, queryParams);
return this._getOne<{ types: IDictionary[] }>(['type', dossierTemplateId], this._defaultModelPath, queryParams).pipe(
map(typesResponse => typesResponse.types.map(type => new Dictionary(type))),
);
}
/**
@ -243,35 +245,16 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
return forkJoin(observables);
}
loadDictionaryDataForDossierTemplate(dossierTemplateId: string, readOnlyFile = false): Observable<Dictionary[]> {
return this.getAllDictionaries(dossierTemplateId, readOnlyFile).pipe(
map(typesResponse => typesResponse.types.map(type => new Dictionary(type))),
map(dictionaries => {
let manualTypeExists = false;
for (const dictionary of dictionaries) {
if (dictionary.type === SuperTypes.ManualRedaction) {
manualTypeExists = true;
break;
}
}
if (!manualTypeExists) {
dictionaries.push(
new Dictionary(
{
hexColor: FALLBACK_COLOR,
type: SuperTypes.ManualRedaction,
},
true,
),
);
}
return dictionaries;
}),
loadDictionaryDataForDossierTemplate(dossierTemplateId: string): Observable<Dictionary[]> {
return this.getAllDictionaries(dossierTemplateId).pipe(
tap(dictionaries => this._dictionariesMapService.set(dossierTemplateId, dictionaries)),
);
}
loadTemporaryDictionaryData(dossierTemplateId: string, readOnlyFile = true): Observable<Dictionary[]> {
return this.getAllDictionaries(dossierTemplateId, readOnlyFile);
}
loadDictionaryEntriesByType(types: string[], dossierTemplateId: string, dossierId: string): Observable<Dictionary[]> {
const queryParams = [{ key: 'dossierId', value: dossierId }];
const requests = [];