1
|
import {Injectable} from '@angular/core';
|
2
|
import {HttpClient} from "@angular/common/http";
|
3
|
|
4
|
@Injectable()
|
5
|
export class HtmlProjectReportService {
|
6
|
|
7
|
constructor(private http: HttpClient ) {}
|
8
|
|
9
|
getHTML(id: string, size: number, type:string, csvAPIURL: string ):any {
|
10
|
|
11
|
let resultTypeId: string;
|
12
|
let requestType: string;
|
13
|
if(type == "publication") {
|
14
|
resultTypeId = 'publication';
|
15
|
requestType = 'publications';
|
16
|
} else if(type == "dataset") {
|
17
|
resultTypeId = 'dataset';
|
18
|
requestType = 'datasets';
|
19
|
} else if(type == "software") {
|
20
|
resultTypeId = 'software';
|
21
|
requestType = 'software'
|
22
|
} else if(type == 'other') {
|
23
|
resultTypeId = 'other';
|
24
|
requestType = 'other';
|
25
|
}
|
26
|
|
27
|
let url = csvAPIURL;
|
28
|
url += '?format=html&type='+requestType+'&fq=(' +
|
29
|
//'((oaftype exact result) and (resulttypeid exact "'+resultTypeId+'")) and
|
30
|
'(relprojectid exact "'+id+'"))';
|
31
|
|
32
|
let key = url;
|
33
|
|
34
|
return this.http.get(url,{responseType: 'text'});
|
35
|
}
|
36
|
}
|