diff --git a/frontend/src/app/components/report-header/report-header.component.html b/frontend/src/app/components/report-header/report-header.component.html index 58723ec34..148fcd645 100644 --- a/frontend/src/app/components/report-header/report-header.component.html +++ b/frontend/src/app/components/report-header/report-header.component.html @@ -33,7 +33,7 @@
All Sources
diff --git a/frontend/src/app/components/report-header/report-header.component.ts b/frontend/src/app/components/report-header/report-header.component.ts index b77053c0b..86db49a75 100644 --- a/frontend/src/app/components/report-header/report-header.component.ts +++ b/frontend/src/app/components/report-header/report-header.component.ts @@ -41,5 +41,9 @@ export class ReportHeaderComponent implements OnInit { } }) } + getIPSExport(event: Event){ + event.preventDefault() + return this.fastenApi.getIPSExport() + } } diff --git a/frontend/src/app/services/fasten-api.service.ts b/frontend/src/app/services/fasten-api.service.ts index acf5bccbe..8b6d2944e 100644 --- a/frontend/src/app/services/fasten-api.service.ts +++ b/frontend/src/app/services/fasten-api.service.ts @@ -368,4 +368,54 @@ export class FastenApiService { ); } + getIPSExport(exportType?: string) { + // // PDF + // + // // function openPdf($event) { + // // Prevent default behavior when clicking a link + // $event.preventDefault(); + // + // // Get filename from href + // var filename = $event.target.href; + // + // $http.get('/api/secure/summary/ips?format=html', {responseType: 'arraybuffer'}) + // .success(function (data) { + // var file = new Blob([data], {type: 'application/pdf'}); + // var fileURL = URL.createObjectURL(file); + // + // // Open new windows and show PDF + // window.open(fileURL); + // }); + // + // $vent. + // // } + + let httpHeaders = new HttpHeaders(); + //.set('Content-Type' + httpHeaders.set('Accept', 'text/html'); + + + let queryParams = { + "format": exportType || "html" + } + console.log("requesting", `${GetEndpointAbsolutePath(globalThis.location, environment.fasten_api_endpoint_base)}/secure/summary/ips`) + return this._httpClient.get(`${GetEndpointAbsolutePath(globalThis.location, environment.fasten_api_endpoint_base)}/secure/summary/ips`, { + params: queryParams, + headers: httpHeaders, + // observe: 'response', + // @ts-ignore + responseType: 'arraybuffer' + }) + .subscribe((data) => { + + var file = new Blob([data]); + var fileURL = URL.createObjectURL(file); + + // Open new windows and show PDF or HTML file + window.open(fileURL, "_blank"); + + }); + + } + }