From 9afdb70b5269238a8f072333f88a85f1eb57f2db Mon Sep 17 00:00:00 2001
From: "konstantina.galouni"
Date: Fri, 10 Mar 2017 16:13:00 +0000
Subject: [PATCH] Bug fixed: Lazy routing disabled in datasources tab of
dataprovider landing page (parameter lazy=false in searchResults page) |
Organization landing page: added publications report (csv) | Organization
landing page: query updated (more restricted, using /resources instead of
/organizations) | comment onChanges function in tabs component of
dataprovider landing page
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46223 d315682c-612b-4755-9ff5-7f18f6832af3
---
.../dataProvider/tabs.component.ts | 65 +++++--
.../organization/organization.component.html | 36 ++--
.../organization/organization.component.ts | 177 +++++++++++-------
.../organization/organization.module.ts | 4 +-
.../project/project.component.html | 18 +-
.../landingPages/project/project.component.ts | 1 -
.../publication/publication.component.html | 22 ++-
.../searchUtils/searchResult.component.ts | 8 +-
.../src/app/services/organization.service.ts | 107 ++++++-----
portal-2/src/app/services/reports.service.ts | 8 +-
.../services/searchPublications.service.ts | 3 +-
.../fetchPublications.class.ts | 1 -
12 files changed, 275 insertions(+), 175 deletions(-)
diff --git a/portal-2/src/app/landingPages/dataProvider/tabs.component.ts b/portal-2/src/app/landingPages/dataProvider/tabs.component.ts
index 7180e9e8..421e840c 100644
--- a/portal-2/src/app/landingPages/dataProvider/tabs.component.ts
+++ b/portal-2/src/app/landingPages/dataProvider/tabs.component.ts
@@ -296,26 +296,7 @@ private nativeElement : Node;
}
ngOnInit() {
-
- }
-
- ngOnChanges() {
- console.info("on changes dataprovider tabs");
if(this.tabs != undefined && this.tabs.length > 0) {
- /*if(typeof document !== undefined) {
- let element = document.getElementById(this.tabs[0].content);
- if(element != null) {
- element.className = "uk-active";
- element.setAttribute("aria-expanded", "true");
- }
-
- let element2 = document.getElementById("firstTab-content");
- if(element2 != null) {
- element2.className = "uk-active";
- element2.setAttribute("aria-hidden", "false");
- }
- }*/
-
this.reloadPublications = true;
this.reloadDatasets = true;
this.reloadProjects = true;
@@ -335,6 +316,7 @@ private nativeElement : Node;
this.pubsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.id+'", "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": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.id+'", "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": ["Datasets"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.id+'", "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": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
+
}
if(this.resultsBy == "collectedFrom") {
@@ -344,6 +326,51 @@ private nativeElement : Node;
}
}
+ // ngOnChanges() {
+ // console.info("on changes dataprovider tabs");
+ // if(this.tabs != undefined && this.tabs.length > 0) {
+ // /*if(typeof document !== undefined) {
+ // let element = document.getElementById(this.tabs[0].content);
+ // if(element != null) {
+ // element.className = "uk-active";
+ // element.setAttribute("aria-expanded", "true");
+ // }
+ //
+ // let element2 = document.getElementById("firstTab-content");
+ // if(element2 != null) {
+ // element2.className = "uk-active";
+ // element2.setAttribute("aria-hidden", "false");
+ // }
+ // }*/
+ //
+ // this.reloadPublications = true;
+ // this.reloadDatasets = true;
+ // this.reloadProjects = true;
+ // this.reloadDataproviders = true;
+ // this.reloadRelatedDatasources = true;
+ // this.statsClicked = false;
+ //
+ // this.search(this.tabs[0].content, 1, 10);
+ // this.count(1, 0);
+ //
+ // this.metricsClicked = false;
+ // this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcOpenAIRETimeline", "dtsrcName":"'+this.id+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"dtsrcRepoTimeline", "dtsrcName":"'+this.id+'", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
+ // this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"dtsrcDownloadsTimeline","dtsrcName":"'+this.id+'","table":"","fields":[{"fld":"sum","agg":"sum","type":"chart","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
+ //
+ // this.docsTimelineUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcYear","dtsrcName":"'+this.id+'","table": "result", "fields": [{"fld": "number", "agg": "count", "type": "line", "yaxis":1, "c":true}], "xaxis":{"name": "year", "agg": "avg"}, "group": "", "color": "", "type": "chart", "size":30, "sort": "xaxis", "xStyle":{"r": "-", "s": "-", "l": "-", "ft": "-", "wt": "-"}, "yaxisheaders": [""], "fieldsheaders": ["Documents"], "in": [{"f":0, "text": "Yearly"}], "filters": [{"name":"year","max":"2016","min":"1997"},{"name": "result_datasources-datasource-name", "values":[""], "to": "-1"}],"having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": "Year"}&w=600&h=250';
+ // this.docsTypesUrl = 'https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubs","dtsrcName":"'+this.id+'", "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": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
+ // this.pubsFunderUrl =' https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcPubsFund","dtsrcName":"'+this.id+'", "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": ["Documents"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
+ // this.dataProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjData","dtsrcName":"'+this.id+'", "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": ["Datasets"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
+ // this.pubsProjectsUrl ='https://beta.openaire.eu/stats/chart.php?com=query&persistent=false&data={"query":"dtsrcProjPubs","dtsrcName":"'+this.id+'", "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": ["Publications"], "in": [], "filters": [{"name": "result_datasources-datasource-name", "values": [""], "to": "-1"}], "having": [], "incfilters": [], "inchaving": [], "title": "", "subtitle": "", "xaxistitle": ""}&w=600&h=250';
+ // }
+ //
+ // if(this.resultsBy == "collectedFrom") {
+ // this.paramsForSearchLink = "?collectedFrom="+this.id+"&co=and";
+ // } else if (this.resultsBy == "hostedBy") {
+ // this.paramsForSearchLink = "?hostedBy="+this.id+"&ho=and";
+ // }
+ // }
+
private count(page: number, size: number) {
console.info("number of tabs: "+this.tabs.length);
diff --git a/portal-2/src/app/landingPages/organization/organization.component.html b/portal-2/src/app/landingPages/organization/organization.component.html
index f0f3ec47..81db63bd 100644
--- a/portal-2/src/app/landingPages/organization/organization.component.html
+++ b/portal-2/src/app/landingPages/organization/organization.component.html
@@ -156,24 +156,26 @@
-
-
- -
-
-
-
- Projects report(CSV) for {{key}}
-
-
-
-
+
+
+
+
+
+ Projects report(CSV) for {{key}}
+
+
+
+
+
+
+ Publications report(CSV) for {{key}}
+
+
+
+
diff --git a/portal-2/src/app/landingPages/organization/organization.component.ts b/portal-2/src/app/landingPages/organization/organization.component.ts
index 64857e57..264f3acb 100644
--- a/portal-2/src/app/landingPages/organization/organization.component.ts
+++ b/portal-2/src/app/landingPages/organization/organization.component.ts
@@ -4,9 +4,10 @@ import {ActivatedRoute} from '@angular/router';
import {OrganizationService} from '../../services/organization.service';
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
import {ReportsService} from '../../services/reports.service';
-import { FetchDataproviders } from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
+import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
+import {SearchPublicationsService} from '../../services/searchPublications.service';
-import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
+import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@@ -39,9 +40,10 @@ export class OrganizationComponent {
private linkToSearchDataproviders = "";
constructor (private _organizationService: OrganizationService,
- private route: ActivatedRoute,
- private _searchDataprovidersService: SearchDataprovidersService,
- private _reportsService: ReportsService) {
+ private route: ActivatedRoute,
+ private _searchDataprovidersService: SearchDataprovidersService,
+ private _reportsService: ReportsService,
+ private _searchPublicationsService: SearchPublicationsService) {
console.info('organization constructor');
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
@@ -93,8 +95,11 @@ export class OrganizationComponent {
this.warningMessage = '';
this.errorMessage=""
- this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
- data => {
+ this._organizationService.getOrganizationInfo(this.organizationId).subscribe(
+ data => {
+ if(data == null) {
+ this.errorMessage = 'No organization found';
+ } else {
this.organizationInfo = data;
let projectsNum = 0;
@@ -106,70 +111,112 @@ export class OrganizationComponent {
}.bind(this));
}
this.projectsNum = projectsNum;
- },
- err => {
- console.log(err)
-
- this.errorMessage = 'No organization found';
}
- );
- }
+ },
+ err => {
+ console.log(err)
+
+ this.errorMessage = 'No organization found';
+ }
+ );
+ }
/*
- private getMetrics() {
- console.info("getOrganizationMetrics: component");
- this._organizationService.getMetrics(this.organizationId).subscribe(
- data => {
- this.metrics = data;
- },
- err => {
- console.log(err);
- }
- );
- }
+ private getMetrics() {
+ console.info("getOrganizationMetrics: component");
+ this._organizationService.getMetrics(this.organizationId).subscribe(
+ data => {
+ this.metrics = data;
+ },
+ err => {
+ console.log(err);
+ }
+ );
+ }
*/
- private handleClick(funder: string) {
- if(this.emptyFundersSet) {
- this.fundersSet.clear();
- this.emptyFundersSet = false;
- }
-
- if(this.fundersSet.has(funder)) {
- this.fundersSet.delete(funder);
-
- if(this.fundersSet.size == 0) {
- this.organizationInfo.projects.forEach(function (value, key, map) {
- this.fundersSet.add(key);
- }.bind(this));
- this.emptyFundersSet = true;
- }
- console.info(funder+" funder deleted");
- } else {
- this.fundersSet.add(funder);
- console.info(funder+" funder added");
- }
+ private handleClick(funder: string) {
+ if(this.emptyFundersSet) {
+ this.fundersSet.clear();
+ this.emptyFundersSet = false;
}
- //private getProjectsData(key: string): any {
- //return this.projectsData;
- //}
+ if(this.fundersSet.has(funder)) {
+ this.fundersSet.delete(funder);
- private searchDataproviders() {
- this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10);
- this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders() + "?organization=" + this.organizationId + "&or=and";;
- }
-
- private searchDataprovidersInit() {
- if(this.subDataproviders == undefined && this.fetchDataproviders.searchUtils.totalResults > 0) {
- this.subDataproviders = this.route.queryParams.subscribe(params => {
- this.searchDataproviders();
- });
+ if(this.fundersSet.size == 0) {
+ this.organizationInfo.projects.forEach(function (value, key, map) {
+ this.fundersSet.add(key);
+ }.bind(this));
+ this.emptyFundersSet = true;
}
+ console.info(funder+" funder deleted");
+ } else {
+ this.fundersSet.add(funder);
+ console.info(funder+" funder added");
}
- downloadfile(url:string){
- console.log("Downloading file: "+ url);
- this._reportsService.downloadCSVFile(url)
- .subscribe(data => window.open(window.URL.createObjectURL(data)),
- error => console.log("Error downloading the file."),
- () => console.log('Completed file download.'));
- }
+ }
+
+ //private getProjectsData(key: string): any {
+ //return this.projectsData;
+ //}
+
+ private searchDataproviders() {
+ this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, 1, 10);
+ this.linkToSearchDataproviders = OpenaireProperties.getLinkToAdvancedSearchDataProviders() + "?organization=" + this.organizationId + "&or=and";;
+ }
+
+ private searchDataprovidersInit() {
+ if(this.subDataproviders == undefined && this.fetchDataproviders.searchUtils.totalResults > 0) {
+ this.subDataproviders = this.route.queryParams.subscribe(params => {
+ this.searchDataproviders();
+ });
+ }
+ }
+
+ downloadfile(url:string){
+ console.log("Downloading file: "+ url);
+ this._reportsService.downloadCSVFile(url)
+ .subscribe(data => window.open(window.URL.createObjectURL(data)),
+ error => console.log("Error downloading the file."),
+ () => console.log('Completed file download.'));
+ }
+
+ downloadPublicationsFile(funder: string){
+ console.log("Downloading publications file");
+ let response: string[] = [];
+ let totalResponse: string = "";
+ let counter: number = this.organizationInfo.projects.get(funder).length;
+
+ for(let project of this.organizationInfo.projects.get(funder)) {
+ this._searchPublicationsService.numOfEntityPublications(project.id, "projects/").subscribe(
+ data =>
+ {
+ let index: number = this.organizationInfo.projects.get(funder).indexOf(project);
+
+ let url: string;
+ if(index == 0) {
+ url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv&size="+data;
+ } else {
+ url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv-notitle&size="+data;
+ }
+
+ this._reportsService.getCSVResponse(url).subscribe(
+ data =>
+ {
+ counter--;
+
+ response[index] = data;
+
+ if(counter == 0) {
+ for(let i=0; i console.log("Error downloading the file."),
+ () => console.log('Completed file download.'));
+ },
+ error => console.log("Error getting number of publications for project."));
+ }//);
+ }
}
diff --git a/portal-2/src/app/landingPages/organization/organization.module.ts b/portal-2/src/app/landingPages/organization/organization.module.ts
index 9db5ab65..f9cec9cc 100644
--- a/portal-2/src/app/landingPages/organization/organization.module.ts
+++ b/portal-2/src/app/landingPages/organization/organization.module.ts
@@ -11,6 +11,7 @@ import { LandingModule } from '../landing.module';
import {SearchResultsModule } from '../../searchPages/searchUtils/searchResults.module';
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
import {ReportsServiceModule} from '../../services/reportsService.module';
+import {PublicationsServiceModule} from '../../services/publicationsService.module';
@NgModule({
imports: [
@@ -20,7 +21,8 @@ import {ReportsServiceModule} from '../../services/reportsService.module';
SearchResultsModule,
DataProvidersServiceModule,
ReportsServiceModule,
- OrganizationServiceModule
+ OrganizationServiceModule,
+ PublicationsServiceModule
],
declarations: [
OrganizationComponent
diff --git a/portal-2/src/app/landingPages/project/project.component.html b/portal-2/src/app/landingPages/project/project.component.html
index 68e93fe9..69d17307 100644
--- a/portal-2/src/app/landingPages/project/project.component.html
+++ b/portal-2/src/app/landingPages/project/project.component.html
@@ -193,8 +193,9 @@
Dynamically incorporate research data in your site (HTML)
-
@@ -214,18 +215,19 @@
- {{projectInfo.funder}} progress report (CSV)
+
+ {{projectInfo.funder}} progress report (CSV)
-
- Link to research results
-
+
+ Link to research results
+
-
- Deposit Publications
-
+
+ Deposit Publications
+
diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts
index 5126e241..7aea3724 100644
--- a/portal-2/src/app/landingPages/project/project.component.ts
+++ b/portal-2/src/app/landingPages/project/project.component.ts
@@ -121,7 +121,6 @@ export class ProjectComponent{
datasets_clipboard = new Clipboard('.datasets_clipboard_btn');
}
- console.info(this.fetchPublications.searchUtils.totalResults + " just before csv");
this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size=";
}
diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html
index 5ebba3e5..23253d8d 100644
--- a/portal-2/src/app/landingPages/publication/publication.component.html
+++ b/portal-2/src/app/landingPages/publication/publication.component.html
@@ -194,11 +194,13 @@
-
-
- {{keyIn}}
-
+ |
+
+
+ {{keyIn}}
+
+
|
{{key}}
@@ -220,10 +222,12 @@
|
-
-
- {{item.name}}
-
+ |
+
+
+ {{item.name}}
+
+
|
diff --git a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts
index 1f8ef8bc..b24546bf 100644
--- a/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts
+++ b/portal-2/src/app/searchPages/searchUtils/searchResult.component.ts
@@ -16,7 +16,8 @@ import {RouterHelper} from '../../utils/routerHelper.class';
-
+
+
@@ -143,7 +145,7 @@ export class SearchResultComponent {
@Input() type: string;
@Input() urlParam: string;
@Input() showLoading: boolean = false;
- @Input() lazy: boolean = true;
+ @Input() lazy: string = "true";
public errorCodes:ErrorCodes = new ErrorCodes();
public routerHelper:RouterHelper = new RouterHelper();
diff --git a/portal-2/src/app/services/organization.service.ts b/portal-2/src/app/services/organization.service.ts
index 56d63998..8a507f9a 100644
--- a/portal-2/src/app/services/organization.service.ts
+++ b/portal-2/src/app/services/organization.service.ts
@@ -17,8 +17,9 @@ export class OrganizationService {
getOrganizationInfo (id: string):any {
console.info("getOrganizationInfo in service");
-
- let url = OpenaireProperties. getSearchAPIURLLast()+'organizations/'+id+"?format=json";
+ //let url = OpenaireProperties. getSearchAPIURLLast()+'organizations/'+id+"?format=json";
+ let url = OpenaireProperties.getSearchAPIURLLast()+'resources?format=json&query=( (oaftype exact organization) and (reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=*)) and ( objIdentifier ='+id+')';
+ //let url = "http://beta.services.openaire.eu:8480/search/rest/v2/api/resources?format=json&query=(%20(oaftype%20exact%20organization)%20and%20(reldatasourcecompatibilityid=driver%20or%20reldatasourcecompatibilityid=driver-openaire2.0%20or%20reldatasourcecompatibilityid=openaire2.0%20or%20reldatasourcecompatibilityid=openaire3.0%20or%20reldatasourcecompatibilityid=openaire2.0_data%20or%20reldatasourcecompatibilityid=hostedBy%20or%20relprojectid=*))%20and%20(%20objIdentifier%20=dedup_wf_001%3A%3Af1e63493def7cedfa5b497cdbea26faa)";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parseOrganizationInfo(res));
@@ -26,8 +27,9 @@ export class OrganizationService {
return this.http.get(url)
.map(res => res.json())
- .map(res => res['result']['metadata']['oaf:entity']['oaf:organization'])
- .map(res => [res, res['rels']['rel']])
+ .map(res => res['results'][0])
+ //.map(res => res[0]['result']['metadata']['oaf:entity']['oaf:organization'])
+ //.map(res => [res, res['rels']['rel']])
.do(res => {
this._cache.set(key, res);
})
@@ -63,38 +65,45 @@ export class OrganizationService {
console.info("parseOrganizationInfo");
this.organizationInfo = new OrganizationInfo();
- let mydata;
+ let organization;
+ let relations;
- if(data[0] != null) {
- mydata = data[0];
+ if(data != null) {
+ organization = data['result']['metadata']['oaf:entity']['oaf:organization'];
+ relations = data['result']['metadata']['oaf:entity']['oaf:organization']['rels']['rel'];
+ } else {
+ return null;
+ }
- if(mydata.hasOwnProperty("websiteurl")) {
- this.organizationInfo.title = {"name": mydata.legalshortname, "url": mydata.websiteurl};
+ if(organization != null) {
+
+ if(organization.hasOwnProperty("websiteurl")) {
+ this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
- this.organizationInfo.title = {"name": mydata.legalshortname, "url": ''};
+ this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
}
- this.organizationInfo.name = mydata.legalname;
+ this.organizationInfo.name = organization.legalname;
if(this.organizationInfo.title.name == '') {
this.organizationInfo.title.name = this.organizationInfo.name;
}
- if(mydata.hasOwnProperty("country")) {
- this.organizationInfo.country = mydata['country'].classname;
+ if(organization.hasOwnProperty("country")) {
+ this.organizationInfo.country = organization['country'].classname;
}
}
- if(data[1] != null) {
+ if(relations != null) {
let counter;
- let length = data[1].length!=undefined ? data[1].length : 1;
+ let length = relations.length!=undefined ? relations.length : 1;
for(let i=0; i();
}
- if(!this.organizationInfo.projects.has(mydata['funding']['funder'].name)) {
- this.organizationInfo.projects.set(mydata['funding']['funder'].name,
+ if(!this.organizationInfo.projects.has(relation['funding']['funder'].name)) {
+ this.organizationInfo.projects.set(relation['funding']['funder'].name,
new Array<{ "name": string, "id": string, "code": string,
"acronym": string, "funder": string, "funderId": string,
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }>());
}
- counter = this.organizationInfo.projects.get(mydata['funding']['funder'].name).length;
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter] =
+ counter = this.organizationInfo.projects.get(relation['funding']['funder'].name).length;
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter] =
{ "name": "", "id": "", "code": "",
"acronym": "", "funder": "", "funderId": "",
"fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
"sc39": "", "startDate": "", "endDate": "" };
//let url = "";
- if(mydata['to'].content != null && mydata['to'].content != "") {
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['id'] = mydata['to'].content;
- //url = OpenaireProperties.getsearchLinkToProject()+mydata['to'].content;
+ if(relation['to'].content != null && relation['to'].content != "") {
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['id'] = relation['to'].content;
+ //url = OpenaireProperties.getsearchLinkToProject()+relation['to'].content;
}
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['name'] = mydata.title;
- //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['url'] = url;
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['code'] = mydata.code;
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['acronym'] = mydata.acronym;
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['name'] = relation.title;
+ //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['url'] = url;
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['code'] = relation.code;
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['acronym'] = relation.acronym;
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funder'] = mydata['funding']['funder'].shortname;
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['funderId'] = mydata['funding']['funder'].id;
- if(mydata['funding'].hasOwnProperty("funding_level_0")) {
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingStream'] = mydata['funding']['funding_level_0'].name;
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funder'] = relation['funding']['funder'].shortname;
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funderId'] = relation['funding']['funder'].id;
+ if(relation['funding'].hasOwnProperty("funding_level_0")) {
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingStream'] = relation['funding']['funding_level_0'].name;
}
- if(mydata['funding'].hasOwnProperty("funding_level_1")) {
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingLevel1'] = mydata['funding']['funding_level_1'].name;
+ if(relation['funding'].hasOwnProperty("funding_level_1")) {
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel1'] = relation['funding']['funding_level_1'].name;
}
- if(mydata['funding'].hasOwnProperty("funding_level_2")) {
- this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['fundingLevel2'] = mydata['funding']['funding_level_2'].name;
+ if(relation['funding'].hasOwnProperty("funding_level_2")) {
+ this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel2'] = relation['funding']['funding_level_2'].name;
}
- //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['sc39'] =
- //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['startDate'] =
- //this.organizationInfo.projects.get(mydata['funding']['funder'].name)[counter]['endDate'] =
+ //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['sc39'] =
+ //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['startDate'] =
+ //this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['endDate'] =
}
}
- } /*else if(mydata['to'].class == "isProvidedBy") {
+ } /*else if(relation['to'].class == "isProvidedBy") {
if(this.organizationInfo.dataProviders == undefined) {
this.organizationInfo.dataProviders = new Array<{ "name": string, "url": string, "type": string, "websiteUrl": string , "organizations": {"name": string, "url": string}[]}>();
}
@@ -153,15 +162,15 @@ export class OrganizationService {
this.organizationInfo.dataProviders[counter] = { "name": "", "url": "", "type": "", "websiteUrl": "", "organizations": [] }
let url="";
- if(mydata['to'].content != null && mydata['to'].content != "") {
- url = OpenaireProperties.getsearchLinkToDataProvider()+mydata['to'].content;
+ if(relation['to'].content != null && relation['to'].content != "") {
+ url = OpenaireProperties.getsearchLinkToDataProvider()+relation['to'].content;
}
- this.organizationInfo.dataProviders[counter]['name'] = mydata.officialname;
+ this.organizationInfo.dataProviders[counter]['name'] = relation.officialname;
this.organizationInfo.dataProviders[counter]['url'] = url;
- if(mydata.hasOwnProperty("datasourcetype")) {
- this.organizationInfo.dataProviders[counter]['type'] = mydata['datasourcetype'].classname;
+ if(relation.hasOwnProperty("datasourcetype")) {
+ this.organizationInfo.dataProviders[counter]['type'] = relation['datasourcetype'].classname;
}
- this.organizationInfo.dataProviders[counter]['websiteUrl'] = mydata.websiteurl;
+ this.organizationInfo.dataProviders[counter]['websiteUrl'] = relation.websiteurl;
}*/
}
}
diff --git a/portal-2/src/app/services/reports.service.ts b/portal-2/src/app/services/reports.service.ts
index 7d02f39b..55f5bb61 100644
--- a/portal-2/src/app/services/reports.service.ts
+++ b/portal-2/src/app/services/reports.service.ts
@@ -19,10 +19,16 @@ export class ReportsService {
return this.http.get(url)
.map(res => new Blob([res['_body']], { type: 'text/csv' }));
}
+ getCSVResponse(url: string){
+ var headers = new Headers();
+ headers.append('responseType', 'arraybuffer');
+ return this.http.get(url)
+ .map(res => res['_body']);
+ }
downloadHTMLFile(url: string, info: string){
var headers = new Headers();
headers.append('responseType', 'arraybuffer');
- return this.http.get(url)//.do(res => console.log(res['_body']))
+ return this.http.get(url)
.map(res => this.addInfo(res, info))
.map(res => new Blob([res['_body']], { type: 'text/html' }))
.do(res => console.log(res))
diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts
index ab42b132..e3777236 100644
--- a/portal-2/src/app/services/searchPublications.service.ts
+++ b/portal-2/src/app/services/searchPublications.service.ts
@@ -426,7 +426,8 @@ export class SearchPublicationsService {
}
return this.http.get(url)
.map(res => res.json())
- .map(res => res.total).do(res => {
+ .map(res => res.total)
+ .do(res => {
this._cache.set(key, res);
});
}
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
index 9e98fcf6..069b1781 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
@@ -123,7 +123,6 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
this._searchPublicationsService.searchPublicationsForEntity(parameters, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
- console.info(this.searchUtils.totalResults + " i think we got results");
console.info("search Publications for "+entity+": [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];