In project landing page read also grantId and funder parameter and query based on them

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51318 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-03-16 15:56:35 +00:00
parent 09017aee04
commit af9c537025
3 changed files with 112 additions and 57 deletions

View File

@ -115,7 +115,35 @@ properties:EnvProperties;
this.updateDescription("project, funding, open access, publications, research data, software"); this.updateDescription("project, funding, open access, publications, research data, software");
this.projectId = params['projectId']; this.projectId = params['projectId'];
var grantId = params['grantId'];
var funder = params['funder'];
if(this.projectId){ if(this.projectId){
this.getProjectInfo(this.projectId);
this.actionsAfterLoadId();
}else if(grantId && funder){
this.getProjectInfoByGrantId(grantId,funder);
}else{
this.showLoading = false;
this.warningMessage="No valid project id";
}
this.downloadURLAPI = this.properties.csvAPIURL;
this.createClipboard();
this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))";
this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))";
this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact "+this.projectId+"))";
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
});
}
actionsAfterLoadId(){
this.publications_dynamic = this.publications_dynamic =
"<script type=\"text/javascript\">" "<script type=\"text/javascript\">"
+ "\n<!--" + "\n<!--"
@ -150,25 +178,7 @@ properties:EnvProperties;
this.searchPublications(); this.searchPublications();
this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties); this.fetchDatasets.getNumForEntity("project", this.projectId, this.properties);
this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties); this.fetchSoftware.getNumForEntity("project", this.projectId, this.properties);
}else{
this.showLoading = false;
this.warningMessage="No valid project id";
} }
this.downloadURLAPI = this.properties.csvAPIURL;
this.createClipboard();
this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))";
this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))";
this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact "+this.projectId+"))";
if (typeof document !== 'undefined') {
this.element.nativeElement.scrollIntoView();
}
});
}
ngOnDestroy() { ngOnDestroy() {
this.sub.unsubscribe(); this.sub.unsubscribe();
if(this.piwiksub){ if(this.piwiksub){
@ -239,11 +249,44 @@ properties:EnvProperties;
this.warningMessage = ''; this.warningMessage = '';
this.errorMessage="" this.errorMessage=""
this.showLoading = true; this.showLoading = true;
var funder = "EC";
var grantId ="654142";
this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe( this.infoSub = this._projectService.getProjectInfo(id, this.properties).subscribe(
data => { data => {
this.projectInfo = data; this.projectInfo = data;
this.actionsAfterGettingProjectInfo();
},
err => {
console.log(err);
this.errorMessage = 'No project found';
this.showLoading = false;
}
);
}
private getProjectInfoByGrantId (grantId:string, funder:string) {
this.warningMessage = '';
this.errorMessage=""
this.showLoading = true;
this._projectService.getProjectInfoByGrantId(grantId,funder,this.properties).subscribe(
data =>{
this.projectInfo = data;
this.actionsAfterGettingProjectInfo();
this.projectId = this.projectInfo.id;
this.actionsAfterLoadId();
},
err => {
console.log(err);
this.errorMessage = 'No project found';
this.showLoading = false;
}
);
}
actionsAfterGettingProjectInfo(){
this.projectName = this.projectInfo.acronym; this.projectName = this.projectInfo.acronym;
if(this.projectName == undefined || this.projectName == '') { if(this.projectName == undefined || this.projectName == '') {
this.projectName = this.projectInfo.title; this.projectName = this.projectInfo.title;
@ -265,16 +308,8 @@ properties:EnvProperties;
this.chartAccessModeUrl='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250'; this.chartAccessModeUrl='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projOA","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "pie", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.chartDatasourcesUrl= 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250'; this.chartDatasourcesUrl= 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"projPubsRepos","projTitle":"'+this.projectId+'", "table": "result", "fields": [{"fld": "number", "agg": "count", "type": "bar", "yaxis":1, "c":false}], "xaxis":{"name": "result_classifications-type", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Research Results"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [" "], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.showLoading = false;
},
err => {
console.log(err);
this.errorMessage = 'No project found';
this.showLoading = false; this.showLoading = false;
} }
);
}
public downloadfile(url:string){ public downloadfile(url:string){
this.openLoading(); this.openLoading();
this.setMessageLoading("Downloading CSV file"); this.setMessageLoading("Downloading CSV file");

View File

@ -34,7 +34,24 @@ export class ProjectService {
.map(res => this.parseProjectInfo(res, properties)); .map(res => this.parseProjectInfo(res, properties));
} }
getProjectInfoByGrantId (grant: string, funder:string, properties:EnvProperties):any {
let url =properties.searchAPIURLLAst+ 'resources?query=(oaftype exact project)'+
'and (projectcode_nt exact "'+grant+'" ) and (fundershortname exact '+'"'+funder+ '"'+')'+"&format=json&size=1";
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.map(res => <any> res.json())
.map(res => res['results'][0])
.map(res => [res['result']['metadata']['oaf:entity']['oaf:project'],res['result']['header']['dri:objIdentifier']])
.map(res => [res[0],
res[0]['fundingtree'],
res[0]['rels']['rel'],res[1]])
.map(res => this.parseProjectInfo(res, properties));
}
/* /*
get project strtDate and endDate get project strtDate and endDate
*/ */
@ -81,7 +98,9 @@ export class ProjectService {
parseProjectInfo (data: any, properties:EnvProperties):any { parseProjectInfo (data: any, properties:EnvProperties):any {
this.projectInfo = new ProjectInfo(); this.projectInfo = new ProjectInfo();
if(data[3] != null) {
this.projectInfo.id =data[3];
}
if(data[0] != null) { if(data[0] != null) {
this.projectInfo.acronym = data[0].acronym; this.projectInfo.acronym = data[0].acronym;
if(Array.isArray(data[0]['title'])) { if(Array.isArray(data[0]['title'])) {

View File

@ -1,4 +1,5 @@
export class ProjectInfo { export class ProjectInfo {
id:string;
acronym: string; acronym: string;
title: string; title: string;
callIdentifier: string; callIdentifier: string;