Merge branch 'VM/DM-538' into 'master'
DM-538 - Components download returns wrong output Closes DM-538 See merge request redactmanager/red-ui!162
This commit is contained in:
commit
a0cbba7621
@ -11,17 +11,22 @@ import { mapEach } from '@common-ui/utils';
|
||||
export class ComponentLogService extends GenericService<void> {
|
||||
protected readonly _defaultModelPath = '';
|
||||
|
||||
getComponentLogData(dossierTemplateId: string, dossierId: string, fileId: string): Observable<ComponentLogEntry[]> {
|
||||
return this._http
|
||||
.get<IComponentLogData>(`/api/dossier-templates/${dossierTemplateId}/dossiers/${dossierId}/files/${fileId}/components`, {
|
||||
#componentLogRequest(dossierTemplateId: string, dossierId: string, fileId: string): Observable<IComponentLogData> {
|
||||
return this._http.get<IComponentLogData>(
|
||||
`/api/dossier-templates/${dossierTemplateId}/dossiers/${dossierId}/files/${fileId}/components`,
|
||||
{
|
||||
params: { includeDetails: true },
|
||||
})
|
||||
.pipe(
|
||||
map(data => data.componentDetails),
|
||||
catchError(() => of({} as ComponentDetails)),
|
||||
map(componentDetails => this.#mapComponentDetails(componentDetails)),
|
||||
mapEach(log => new ComponentLogEntry(log)),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
getComponentLogData(dossierTemplateId: string, dossierId: string, fileId: string): Observable<ComponentLogEntry[]> {
|
||||
return this.#componentLogRequest(dossierTemplateId, dossierId, fileId).pipe(
|
||||
map(data => data.componentDetails),
|
||||
catchError(() => of({} as ComponentDetails)),
|
||||
map(componentDetails => this.#mapComponentDetails(componentDetails)),
|
||||
mapEach(log => new ComponentLogEntry(log)),
|
||||
);
|
||||
}
|
||||
|
||||
override(dossierId: string, fileId: string, componentOverrides: Record<string, string>): Observable<void> {
|
||||
@ -32,8 +37,8 @@ export class ComponentLogService extends GenericService<void> {
|
||||
return this._post({ components }, `componentLog/override/revert/${dossierId}/${fileId}`);
|
||||
}
|
||||
|
||||
exportJSON(dossierTemplateId: string, dossierId: string, fileId: string, name: string): Observable<ComponentLogEntry[]> {
|
||||
return this.getComponentLogData(dossierTemplateId, dossierId, fileId).pipe(
|
||||
exportJSON(dossierTemplateId: string, dossierId: string, fileId: string, name: string): Observable<IComponentLogData> {
|
||||
return this.#componentLogRequest(dossierTemplateId, dossierId, fileId).pipe(
|
||||
tap(data => {
|
||||
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
|
||||
saveAs(blob, name + '.component_log.json');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user