DM-538 - Components download should return result with includeDetails set to false

This commit is contained in:
Valentin Mihai 2023-10-26 12:10:11 +03:00
parent 2bb7461e5b
commit be1541a67b

View File

@ -11,11 +11,16 @@ import { mapEach } from '@common-ui/utils';
export class ComponentLogService extends GenericService<void> { export class ComponentLogService extends GenericService<void> {
protected readonly _defaultModelPath = ''; protected readonly _defaultModelPath = '';
#componentLogRequest(dossierTemplateId: string, dossierId: string, fileId: string): Observable<IComponentLogData> { #componentLogRequest(
dossierTemplateId: string,
dossierId: string,
fileId: string,
includeDetails = true,
): Observable<IComponentLogData> {
return this._http.get<IComponentLogData>( return this._http.get<IComponentLogData>(
`/api/dossier-templates/${dossierTemplateId}/dossiers/${dossierId}/files/${fileId}/components`, `/api/dossier-templates/${dossierTemplateId}/dossiers/${dossierId}/files/${fileId}/components`,
{ {
params: { includeDetails: true }, params: { includeDetails },
}, },
); );
} }
@ -38,7 +43,7 @@ export class ComponentLogService extends GenericService<void> {
} }
exportJSON(dossierTemplateId: string, dossierId: string, fileId: string, name: string): Observable<IComponentLogData> { exportJSON(dossierTemplateId: string, dossierId: string, fileId: string, name: string): Observable<IComponentLogData> {
return this.#componentLogRequest(dossierTemplateId, dossierId, fileId).pipe( return this.#componentLogRequest(dossierTemplateId, dossierId, fileId, false).pipe(
tap(data => { tap(data => {
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' }); const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
saveAs(blob, name + '.component_log.json'); saveAs(blob, name + '.component_log.json');