diff --git a/portal-2/src/app/landingPages/organization/organization.component.html b/portal-2/src/app/landingPages/organization/organization.component.html
index e0d4d4df..64b5f577 100644
--- a/portal-2/src/app/landingPages/organization/organization.component.html
+++ b/portal-2/src/app/landingPages/organization/organization.component.html
@@ -31,10 +31,21 @@
- -
+
-
+
+ Publications
+
+ {{fetchPublications.searchUtils.totalResults}}
+
+
+
+ -
Projects
- {{(searchingProjectsTabComponent)?searchingProjectsTabComponent.fetchProjects.totalResults:0}}
+
+
+ {{fetchProjects.searchUtils.totalResults}}
+
-
@@ -58,57 +69,26 @@
-
-
-
-
-
+
+ -
+
-
@@ -162,33 +142,35 @@
- 0">
- -
+ 0">
+
-
-
+
+
Project list for {{funder.name}} (CSV)
- -
-
+
-
+
Project Publications for {{funder.name}} (CSV)
-
+ -
+
+
+ Publications of organization (CSV) - based on the affiliation information.
+
+
-
+
+
diff --git a/portal-2/src/app/landingPages/organization/organization.component.ts b/portal-2/src/app/landingPages/organization/organization.component.ts
index c564c0a0..37b86440 100644
--- a/portal-2/src/app/landingPages/organization/organization.component.ts
+++ b/portal-2/src/app/landingPages/organization/organization.component.ts
@@ -5,6 +5,8 @@ import {ActivatedRoute, Router} from '@angular/router';
import {OrganizationService} from '../../services/organization.service';
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
import {ReportsService} from '../../services/reports.service';
+import {FetchPublications} from '../../utils/fetchEntitiesClasses/fetchPublications.class';
+import {FetchProjects} from '../../utils/fetchEntitiesClasses/fetchProjects.class';
import {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
import {SearchPublicationsService} from '../../services/searchPublications.service';
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
@@ -42,19 +44,25 @@ export class OrganizationComponent {
subDataproviders: any;
subDataprovidersCount: any;
- private fetchDataproviders : FetchDataproviders;
- private linkToSearchDataproviders:string = "";
+ public projectsClicked: boolean = false;
+
+ public fetchPublications: FetchPublications;
+ public linkToSearchPublications: string = "";
+ public fetchProjects: FetchProjects;
+ public fetchDataproviders : FetchDataproviders;
+ public linkToSearchDataproviders:string = "";
@ViewChild (SearchingProjectsTabComponent) searchingProjectsTabComponent : SearchingProjectsTabComponent ;
- private projectFunders:string[] = [];
+ public projectFunders:string[] = [];
public routerHelper:RouterHelper = new RouterHelper();
@ViewChild (ModalLoading) loading : ModalLoading ;
- @ViewChild(AlertModal) alertApplyAll;
+ @ViewChild('AlertModalApplyAll') alertApplyAll;
+ @ViewChild('AlertModalCsvError') alertCsvError;
- private funder: string;
- private funderId: string;
- private count: number;
+ public funder: string;
+ public funderId: string;
+ public count: number;
public errorCodes:ErrorCodes = new ErrorCodes();
@@ -67,6 +75,8 @@ export class OrganizationComponent {
private _searchProjectsService: SearchProjectsService, private _meta: Meta,
private _router: Router) {
+ this.fetchPublications = new FetchPublications(this._searchPublicationsService);
+ this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
}
@@ -136,6 +146,11 @@ export class OrganizationComponent {
this.updateTitle(this.organizationInfo.title.name);
this.updateDescription("Organization, country, projects, search, repositories, open access"+this.organizationInfo.title.name);
+ this.fetchPublications.getResultsForEntity("organization", this.organizationId, 1, 10);
+ this.linkToSearchPublications = OpenaireProperties.getLinkToAdvancedSearchPublications();
+ //this.fetchProjects.getNumForEntity("organization", this.organizationId);
+ var refineFields:string [] = ["funderid"];
+ this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, 0,refineFields);
this.fetchDataproviders.getNumForEntity("organization", this.organizationId);
/*let projectsNum = 0;
@@ -210,7 +225,7 @@ export class OrganizationComponent {
}
}
- downloadfile(url:string){
+ downloadFile(url:string){
console.log("Downloading file: "+ url);
this.openLoading();
@@ -221,7 +236,11 @@ export class OrganizationComponent {
this.closeLoading();
window.open(window.URL.createObjectURL(data));
},
- error => console.log("Error downloading the file."),
+ error => {
+ console.log("Error downloading the file.");
+ this.closeLoading();
+ this.confirmOpenCsvError();
+ },
() => console.log('Completed file download.'));
}
@@ -253,7 +272,7 @@ export class OrganizationComponent {
url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special-notitle&size="+data;
}
- if(data == 0) {
+ if(data == 0) { // if no publications for this project
counter--;
response[index] = "";
if(counter == 0) {
@@ -261,8 +280,6 @@ export class OrganizationComponent {
if(response[i] != "") {
totalResponse += response[i];
}
-
- console.info("1response "+i+": "+response[i]);
}
this.closeLoading();
window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
@@ -289,7 +306,11 @@ export class OrganizationComponent {
window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
}
},
- error => console.log("Error downloading the file."),
+ error => {
+ console.log("Error downloading the file.");
+ this.closeLoading();
+ this.confirmOpenCsvError();
+ },
() => console.log('Completed file download.')
);
}
@@ -298,7 +319,12 @@ export class OrganizationComponent {
}//);
},
- error => console.log("Error getting projects project."));
+ error => {
+ console.log("Error getting projects project.");
+ this.closeLoading();
+ this.confirmOpenCsvError();
+ }
+ );
// let counter: number = this.organizationInfo.projects.get(funder).length;
//
@@ -365,11 +391,11 @@ export class OrganizationComponent {
}
}
- confirmOpen(funder: string, funderId:string, count:number){
+ confirmOpenApplyAll(funder: string, funderId:string, count:number){
this.alertApplyAll.cancelButton = true;
this.alertApplyAll.okButton = true;
this.alertApplyAll.alertTitle = "CSV FILE";
- this.alertApplyAll.message = "Do you wish to download a CSV file?\nNote that this process may take a while.";
+ this.alertApplyAll.message = "Do you wish to download a CSV file? Note that this process may take a while.";
this.alertApplyAll.okButtonText = "Yes";
this.alertApplyAll.cancelButtonText = "No";
this.alertApplyAll.open();
@@ -378,7 +404,16 @@ export class OrganizationComponent {
this.funderId = funderId;
this.count = count;
}
- confirmClose(data){
+ confirmCloseApplyAll(data){
this.downloadPublicationsFile(this.funder, this.funderId, this.count);
}
+
+ confirmOpenCsvError(){
+ this.alertCsvError.cancelButton = false;
+ this.alertCsvError.okButton = true;
+ this.alertCsvError.alertTitle = "ERROR DOWNLOADING CSV FILE";
+ this.alertCsvError.message = "There was an error in csv downloading. Please try again later.";
+ this.alertCsvError.okButtonText = "OK";
+ this.alertCsvError.open();
+ }
}
diff --git a/portal-2/src/app/landingPages/person/person.component.ts b/portal-2/src/app/landingPages/person/person.component.ts
index 30f585ce..3d06a665 100644
--- a/portal-2/src/app/landingPages/person/person.component.ts
+++ b/portal-2/src/app/landingPages/person/person.component.ts
@@ -131,7 +131,7 @@ export class PersonComponent {
console.log(err);
}
);*/
- this.fetchDatasets.getNumResultsForEntity("people", this.personId);
+ this.fetchDatasets.getNumForEntity("people", this.personId);
},
err => {
diff --git a/portal-2/src/app/landingPages/project/project.component.ts b/portal-2/src/app/landingPages/project/project.component.ts
index 8bd28d1a..b995c702 100644
--- a/portal-2/src/app/landingPages/project/project.component.ts
+++ b/portal-2/src/app/landingPages/project/project.component.ts
@@ -119,7 +119,7 @@ export class ProjectComponent{
// console.log(err);
// }
//);
- this.fetchDatasets.getNumResultsForEntity("project", this.projectId);
+ this.fetchDatasets.getNumForEntity("project", this.projectId);
}else{
this.warningMessage="No valid project id";
diff --git a/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts b/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts
index fbe1d3a9..0f80ccf8 100644
--- a/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts
+++ b/portal-2/src/app/landingPages/searchingProjectsInTab.component.ts
@@ -1,4 +1,4 @@
-import {Component} from '@angular/core';
+import {Component, Input} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import { FetchProjects } from '../utils/fetchEntitiesClasses/fetchProjects.class';
@@ -54,7 +54,7 @@ import {RouterHelper} from '../utils/routerHelper.class';
})
export class SearchingProjectsTabComponent {
- public fetchProjects : FetchProjects;
+ @Input() fetchProjects : FetchProjects;
public organizationId:string = "";
public page :number = 1;
public size :number = 10;
@@ -75,10 +75,12 @@ export class SearchingProjectsTabComponent {
this.organizationId = params['organizationId'];
if(this.organizationId) {
- this.fetchProjects = new FetchProjects(this._searchProjectsService);
+ //this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";;
- this.search(true,"");
+ if(this.fetchProjects.searchUtils.totalResults > 0) {
+ this.search(false,"");
+ }
}
});
}
diff --git a/portal-2/src/app/services/searchDataproviders.service.ts b/portal-2/src/app/services/searchDataproviders.service.ts
index c09a7549..9f225b71 100644
--- a/portal-2/src/app/services/searchDataproviders.service.ts
+++ b/portal-2/src/app/services/searchDataproviders.service.ts
@@ -450,8 +450,6 @@ export class SearchDataprovidersService {
}
numOfDataproviders(params: string):any {
- console.info("getOfDataproviders : Dataproviders Service + params="+params);
-
let url = OpenaireProperties. getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json";
let key = url;
if (this._cache.has(key)) {
diff --git a/portal-2/src/app/services/searchProjects.service.ts b/portal-2/src/app/services/searchProjects.service.ts
index 99a7230b..ff0ffc98 100644
--- a/portal-2/src/app/services/searchProjects.service.ts
+++ b/portal-2/src/app/services/searchProjects.service.ts
@@ -243,11 +243,11 @@ export class SearchProjectsService {
return results;
}
- numOfEntityProjects(id: string, entity: string):any {
+ numOfProjects(params: string):any {
//OpenaireProperties.getSearchAPIURLLast()
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
- let url = OpenaireProperties.getSearchAPIURLLast()+entity+id+"/projects/count"+ "?format=json";
+ let url = OpenaireProperties.getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key));
diff --git a/portal-2/src/app/services/searchPublications.service.ts b/portal-2/src/app/services/searchPublications.service.ts
index ac0a1c87..4a8a8eae 100644
--- a/portal-2/src/app/services/searchPublications.service.ts
+++ b/portal-2/src/app/services/searchPublications.service.ts
@@ -143,6 +143,7 @@ export class SearchPublicationsService {
searchPublicationsForEntity (params: string, page: number, size: number):any {
let link = OpenaireProperties.getSearchAPIURLLast();
let url = link+params+"/publications"+ "?format=json";
+ url += "&page="+(page-1)+"&size="+size;
let key = url;
if (this._cache.has(key)) {
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
index 55124a20..09a1a3be 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchDatasets.class.ts
@@ -74,7 +74,7 @@ export class FetchDatasets{
);
}
-public getNumResultsForEntity(entity:string, id:string){
+public getNumForEntity(entity:string, id:string){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
index ce985a01..7e419d0b 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchProjects.class.ts
@@ -90,10 +90,45 @@ export class FetchProjects{
);
}
+ public getNumForEntity(entity: string, id:string) {
+ var parameters="";
+
+ if(entity == "organization") {
+ parameters = "organizations/"+id+"/projects/count";
+ }
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.LOADING;
+
+ if(parameters != "") {
+
+ this._searchProjectsService.numOfProjects(parameters).subscribe(
+ data => {
+ this.searchUtils.totalResults = data;
+
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.DONE;
+ if(this.searchUtils.totalResults == 0 ){
+ this.searchUtils.status = errorCodes.NONE;
+ }
+ },
+ err => {
+ console.log(err);
+ //TODO check erros (service not available, bad request)
+ // if( ){
+ // this.searchUtils.status = ErrorCodes.ERROR;
+ // }
+ var errorCodes:ErrorCodes = new ErrorCodes();
+ this.searchUtils.status = errorCodes.ERROR;
+ }
+ );
+ }
+ }
+
public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.LOADING;
-
+
this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
data => {
this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results
diff --git a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
index f3b839e1..94a8f321 100644
--- a/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
+++ b/portal-2/src/app/utils/fetchEntitiesClasses/fetchPublications.class.ts
@@ -97,6 +97,8 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
parameters = "projects/"+id;
} else if(entity == "person") {
parameters = "people/"+id;
+ } else if(entity == "organization") {
+ parameters = "organizations/"+id;
}
if(parameters != "") {