Added Download Search endpoint

This commit is contained in:
Nile Walker 2021-02-28 18:57:09 -05:00
parent d530d69724
commit d809c3f600
2 changed files with 11 additions and 0 deletions

View File

@ -182,6 +182,7 @@ export class GraphsComponent implements OnInit {
this.form.startDate = startDate.toLocaleDateString();
this.form.endDate = endDate.toLocaleDateString();
this.updateGraphData();
this.graphService.downloadSearchResults(this.form);
}
chartClicked(e: any): void {

View File

@ -21,6 +21,16 @@ export class GraphService {
) {
this.apiRoot = environment.api;
}
downloadSearchResults(form: SearchForm): Observable<Sample[]> {
let params = this.createParams(form);
return this.httpClient
.get<Sample[]>(this.apiRoot + `/dashboard/download`, { params })
.pipe(timeout(1000), catchError(err => this._handleError(err)))
.pipe(catchError(err => this._handleError(err)));
}
getRawSearchData(form: SearchForm, page: number): Observable<Sample[]> {
let params = this.createParams(form);
params = params.set('page', String(page));