2017-12-19 13:53:46 +01:00
|
|
|
import {Injectable} from '@angular/core';
|
2019-06-03 15:20:36 +02:00
|
|
|
import {HttpClient} from "@angular/common/http";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class HtmlProjectReportService {
|
|
|
|
|
2019-06-03 15:20:36 +02:00
|
|
|
constructor(private http: HttpClient ) {}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
getHTML(id: string, size: number, type:string, csvAPIURL: string ):any {
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
let resultTypeId: string;
|
|
|
|
let requestType: string;
|
|
|
|
if(type == "publication") {
|
|
|
|
resultTypeId = 'publication';
|
|
|
|
requestType = 'publications';
|
|
|
|
} else if(type == "research data") {
|
|
|
|
resultTypeId = 'dataset';
|
|
|
|
requestType = 'datasets';
|
|
|
|
} else if(type == "software") {
|
|
|
|
resultTypeId = 'software';
|
|
|
|
requestType = 'software'
|
2019-12-10 15:45:13 +01:00
|
|
|
} else if(type == 'other research product') {
|
2018-07-26 18:38:59 +02:00
|
|
|
resultTypeId = 'other';
|
|
|
|
requestType = 'other';
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
|
2018-02-05 14:14:59 +01:00
|
|
|
let url = csvAPIURL;
|
2019-04-02 17:33:01 +02:00
|
|
|
url += '?format=html&type='+requestType+'&fq=(((oaftype exact result) and (resulttypeid exact "'+resultTypeId+'")) and (relprojectid exact "'+id+'"))';
|
2018-02-05 14:14:59 +01:00
|
|
|
|
2017-12-19 13:53:46 +01:00
|
|
|
let key = url;
|
|
|
|
|
2019-06-19 11:11:05 +02:00
|
|
|
return this.http.get(url,{responseType: 'text'});
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|
|
|
|
}
|