working IPS export open in new window.
This commit is contained in:
parent
30149c4aef
commit
2e5b84dbeb
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="far fa-save"></i> Save Report</a>
|
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="far fa-save"></i> Save Report</a>
|
||||||
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="far fa-file-pdf"></i> Export to PDF</a>
|
<a class="nav-link" (click)="getIPSExport($event)"><i class="far fa-file-pdf"></i> Export to PDF</a>
|
||||||
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="far fa-envelope"></i>Send to Email</a>
|
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="far fa-envelope"></i>Send to Email</a>
|
||||||
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="fas fa-ellipsis-h"></i></a>
|
<a class="nav-link" routerLink="/" ngbTooltip="not yet implemented"><i class="fas fa-ellipsis-h"></i></a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -41,5 +41,9 @@ export class ReportHeaderComponent implements OnInit {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
getIPSExport(event: Event){
|
||||||
|
event.preventDefault()
|
||||||
|
return this.fastenApi.getIPSExport()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -368,4 +368,54 @@ export class FastenApiService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIPSExport(exportType?: string) {
|
||||||
|
// // <a href="https://somedomain.com/api/doc/somefile.pdf" ng-click="openPdf($event)">PDF</a>
|
||||||
|
//
|
||||||
|
// // 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<any>(`${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");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue