Organization landing page: added Publications tab (+count for Projects tab since now it is the second one) & CSV download for the Publications based on affiliations
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@47540 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
25e2f5727e
commit
ff7fc02161
|
@ -31,10 +31,21 @@
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<ul class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
|
<ul class="uk-tab" data-uk-switcher="{connect:'#tab-content'}">
|
||||||
<li class="uk-active">
|
<li class="uk-active">
|
||||||
|
<a>
|
||||||
|
Publications
|
||||||
|
<span class="uk-badge uk-badge-notification">
|
||||||
|
{{fetchPublications.searchUtils.totalResults}}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li (click)="projectsClicked=true;">
|
||||||
<a>
|
<a>
|
||||||
Projects
|
Projects
|
||||||
<span class="uk-badge uk-badge-notification">{{(searchingProjectsTabComponent)?searchingProjectsTabComponent.fetchProjects.totalResults:0}}</span>
|
<span class="uk-badge uk-badge-notification">
|
||||||
|
<!--{{(searchingProjectsTabComponent)?searchingProjectsTabComponent.fetchProjects.totalResults:0}}-->
|
||||||
|
{{fetchProjects.searchUtils.totalResults}}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li (click)="searchDataprovidersInit()">
|
<li (click)="searchDataprovidersInit()">
|
||||||
|
@ -58,57 +69,26 @@
|
||||||
|
|
||||||
<ul id="tab-content" class="uk-switcher uk-margin custom-tab-content">
|
<ul id="tab-content" class="uk-switcher uk-margin custom-tab-content">
|
||||||
<li class="uk-animation-fade">
|
<li class="uk-animation-fade">
|
||||||
<searchingProjectsTab></searchingProjectsTab>
|
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">There are no publications</div>
|
||||||
<!--div *ngIf="organizationInfo.projects == undefined" class = "uk-alert">
|
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.ERROR" class="uk-alert uk-alert-warning uk-animation-fade" role="alert">An Error Occured</div>
|
||||||
There are no projects
|
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger uk-animation-fade" role="alert">Service not available</div>
|
||||||
|
<div *ngIf="fetchPublications.searchUtils.status == errorCodes.LOADING" class="uk-alert uk-alert-primary uk-animation-fade" role="alert">Loading...</div>
|
||||||
|
|
||||||
|
<div *ngIf="fetchPublications.searchUtils.totalResults > 0">
|
||||||
|
<div class = "uk-text-right" *ngIf = "fetchPublications.searchUtils.totalResults > 10">
|
||||||
|
<a [queryParams]="routerHelper.createQueryParams(['organizationId', 'or'], [organizationId, 'and'])"
|
||||||
|
routerLinkActive="router-link-active" [routerLink]="linkToSearchPublications">
|
||||||
|
View all {{fetchPublications.searchUtils.totalResults}} results
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<tab-result [(results)]="fetchPublications.results"
|
||||||
|
[(status)]= "fetchPublications.status"
|
||||||
|
type="publication" urlParam="articleId">
|
||||||
|
</tab-result>
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
<div *ngIf="organizationInfo.projects != undefined">
|
<li class="uk-animation-fade">
|
||||||
|
<searchingProjectsTab *ngIf="projectsClicked" [fetchProjects]="fetchProjects"></searchingProjectsTab>
|
||||||
<div *ngIf="organizationInfo.projects.size == 1">
|
|
||||||
<div *ngFor="let key of organizationInfo.projects.keys()">
|
|
||||||
<strong>Projects funded by {{key}}</strong>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="organizationInfo.projects.size > 1">
|
|
||||||
<strong>Filter by Funder</strong>
|
|
||||||
|
|
||||||
<span *ngFor="let key of organizationInfo.projects.keys()" class="checkbox">
|
|
||||||
<label>
|
|
||||||
<!--input type="checkbox" (ngModelChange)="changeType(key)"-->
|
|
||||||
<!--input type="checkbox" (click)='handleClick(key)'>
|
|
||||||
{{key}}
|
|
||||||
</label>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class="uk-table uk-table-striped" *ngIf="organizationInfo.projects.size > 0">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="uk-text-center">Funder</th>
|
|
||||||
<th class="uk-text-center">Project Name</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody *ngFor="let key of organizationInfo.projects.keys()">
|
|
||||||
<tr *ngFor="let item of organizationInfo.projects.get(key)">
|
|
||||||
<td *ngIf="fundersSet.has(key)">
|
|
||||||
{{key}}
|
|
||||||
</td>
|
|
||||||
<td *ngIf="fundersSet.has(key)">
|
|
||||||
<!--a *ngIf="item['url'] != '' && item['name'] != ''" href="{{item['url']}}"-->
|
|
||||||
<!--a *ngIf="item['id'] != '' && item['name'] != ''"
|
|
||||||
[queryParams]="{projectId: item.id}" routerLinkActive="router-link-active" routerLink="/search/project">
|
|
||||||
{{item['name']}}
|
|
||||||
</a>
|
|
||||||
<p *ngIf="item['id'] == '' && item['name'] != ''">{{item['name']}}</p>
|
|
||||||
<span *ngIf="item['code'] != null && item['code'] != ''"> ({{item['code']}}) </span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div-->
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="uk-animation-fade">
|
<li class="uk-animation-fade">
|
||||||
|
@ -162,33 +142,35 @@
|
||||||
</dl>
|
</dl>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<ng-container *ngIf="searchingProjectsTabComponent && searchingProjectsTabComponent.fetchProjects.funders.length > 0">
|
<ng-container *ngIf="fetchProjects && fetchProjects.funders.length > 0">
|
||||||
<li *ngFor="let funder of searchingProjectsTabComponent.fetchProjects.funders">
|
<li *ngFor="let funder of fetchProjects.funders">
|
||||||
<!--a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
|
<!--a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
|
||||||
Download projects report (CSV) for {{key}}
|
Download projects report (CSV) for {{key}}
|
||||||
</a-->
|
</a-->
|
||||||
<span class="clickable" (click)="downloadfile(downloadURLAPI+'resources?size='+funder.number+'&'+csvProjectParamsHead+funder.id+csvParamsTail)">
|
<span class="clickable" (click)="downloadFile(downloadURLAPI+'resources?size='+funder.number+'&'+csvProjectParamsHead+funder.id+csvParamsTail)">
|
||||||
|
<!--span class="clickable" (click)="downloadProjectsFile(downloadURLAPI+'organizations/'+organizationId+'/projects?fq=(funderid exact '+funder.id+')&size='+funder.number)"-->
|
||||||
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
||||||
<span class="uk-icon-download"> Project list for {{funder.name}} (CSV)</span>
|
<span class="uk-icon-download"> Project list for {{funder.name}} (CSV)</span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li *ngFor="let funder of searchingProjectsTabComponent.fetchProjects.funders">
|
<li *ngFor="let funder of fetchProjects.funders">
|
||||||
<span class="clickable" (click)="confirmOpen(funder.name,funder.id, funder.number)">
|
<span class="clickable" (click)="confirmOpenApplyAll(funder.name,funder.id, funder.number)">
|
||||||
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
||||||
<span class="uk-icon-download"> Project Publications for {{funder.name}} (CSV)</span>
|
<span class="uk-icon-download"> Project Publications for {{funder.name}} (CSV)</span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<!--li>
|
|
||||||
<span class="clickable">
|
|
||||||
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
|
||||||
<span class="uk-icon-download"> Publications of organization (CSV) - based on the affiliation information.</span>
|
|
||||||
</span>
|
|
||||||
</li-->
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<li>
|
||||||
|
<span class="clickable" (click)="downloadFile(downloadURLAPI+'organizations/'+organizationId+'/publications?format=csv')">
|
||||||
|
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
||||||
|
<span class="uk-icon-download"> Publications of organization (CSV) - based on the affiliation information.</span>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal-loading></modal-loading>
|
<modal-loading></modal-loading>
|
||||||
<modal-alert (alertOutput)="confirmClose($event)"></modal-alert>
|
<modal-alert #AlertModalApplyAll (alertOutput)="confirmCloseApplyAll($event)"></modal-alert>
|
||||||
|
<modal-alert #AlertModalCsvError></modal-alert>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {OrganizationService} from '../../services/organization.service';
|
import {OrganizationService} from '../../services/organization.service';
|
||||||
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
|
import {OrganizationInfo} from '../../utils/entities/organizationInfo';
|
||||||
import {ReportsService} from '../../services/reports.service';
|
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 {FetchDataproviders} from '../../utils/fetchEntitiesClasses/fetchDataproviders.class';
|
||||||
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
import {SearchPublicationsService} from '../../services/searchPublications.service';
|
||||||
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
||||||
|
@ -42,19 +44,25 @@ export class OrganizationComponent {
|
||||||
subDataproviders: any;
|
subDataproviders: any;
|
||||||
subDataprovidersCount: any;
|
subDataprovidersCount: any;
|
||||||
|
|
||||||
private fetchDataproviders : FetchDataproviders;
|
public projectsClicked: boolean = false;
|
||||||
private linkToSearchDataproviders:string = "";
|
|
||||||
|
public fetchPublications: FetchPublications;
|
||||||
|
public linkToSearchPublications: string = "";
|
||||||
|
public fetchProjects: FetchProjects;
|
||||||
|
public fetchDataproviders : FetchDataproviders;
|
||||||
|
public linkToSearchDataproviders:string = "";
|
||||||
@ViewChild (SearchingProjectsTabComponent) searchingProjectsTabComponent : SearchingProjectsTabComponent ;
|
@ViewChild (SearchingProjectsTabComponent) searchingProjectsTabComponent : SearchingProjectsTabComponent ;
|
||||||
private projectFunders:string[] = [];
|
public projectFunders:string[] = [];
|
||||||
|
|
||||||
public routerHelper:RouterHelper = new RouterHelper();
|
public routerHelper:RouterHelper = new RouterHelper();
|
||||||
|
|
||||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||||
@ViewChild(AlertModal) alertApplyAll;
|
@ViewChild('AlertModalApplyAll') alertApplyAll;
|
||||||
|
@ViewChild('AlertModalCsvError') alertCsvError;
|
||||||
|
|
||||||
private funder: string;
|
public funder: string;
|
||||||
private funderId: string;
|
public funderId: string;
|
||||||
private count: number;
|
public count: number;
|
||||||
|
|
||||||
public errorCodes:ErrorCodes = new ErrorCodes();
|
public errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
|
||||||
|
@ -67,6 +75,8 @@ export class OrganizationComponent {
|
||||||
private _searchProjectsService: SearchProjectsService, private _meta: Meta,
|
private _searchProjectsService: SearchProjectsService, private _meta: Meta,
|
||||||
private _router: Router) {
|
private _router: Router) {
|
||||||
|
|
||||||
|
this.fetchPublications = new FetchPublications(this._searchPublicationsService);
|
||||||
|
this.fetchProjects = new FetchProjects(this._searchProjectsService);
|
||||||
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
||||||
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
this.updateUrl(OpenaireProperties.getBaseLink()+this._router.url);
|
||||||
}
|
}
|
||||||
|
@ -136,6 +146,11 @@ export class OrganizationComponent {
|
||||||
this.updateTitle(this.organizationInfo.title.name);
|
this.updateTitle(this.organizationInfo.title.name);
|
||||||
this.updateDescription("Organization, country, projects, search, repositories, open access"+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);
|
this.fetchDataproviders.getNumForEntity("organization", this.organizationId);
|
||||||
|
|
||||||
/*let projectsNum = 0;
|
/*let projectsNum = 0;
|
||||||
|
@ -210,7 +225,7 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadfile(url:string){
|
downloadFile(url:string){
|
||||||
console.log("Downloading file: "+ url);
|
console.log("Downloading file: "+ url);
|
||||||
|
|
||||||
this.openLoading();
|
this.openLoading();
|
||||||
|
@ -221,7 +236,11 @@ export class OrganizationComponent {
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
window.open(window.URL.createObjectURL(data));
|
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.'));
|
() => 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;
|
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--;
|
counter--;
|
||||||
response[index] = "";
|
response[index] = "";
|
||||||
if(counter == 0) {
|
if(counter == 0) {
|
||||||
|
@ -261,8 +280,6 @@ export class OrganizationComponent {
|
||||||
if(response[i] != "") {
|
if(response[i] != "") {
|
||||||
totalResponse += response[i];
|
totalResponse += response[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
console.info("1response "+i+": "+response[i]);
|
|
||||||
}
|
}
|
||||||
this.closeLoading();
|
this.closeLoading();
|
||||||
window.open(window.URL.createObjectURL(new Blob([totalResponse], { type: 'text/csv' })));
|
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' })));
|
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.')
|
() => 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;
|
// 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.cancelButton = true;
|
||||||
this.alertApplyAll.okButton = true;
|
this.alertApplyAll.okButton = true;
|
||||||
this.alertApplyAll.alertTitle = "CSV FILE";
|
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.okButtonText = "Yes";
|
||||||
this.alertApplyAll.cancelButtonText = "No";
|
this.alertApplyAll.cancelButtonText = "No";
|
||||||
this.alertApplyAll.open();
|
this.alertApplyAll.open();
|
||||||
|
@ -378,7 +404,16 @@ export class OrganizationComponent {
|
||||||
this.funderId = funderId;
|
this.funderId = funderId;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
confirmClose(data){
|
confirmCloseApplyAll(data){
|
||||||
this.downloadPublicationsFile(this.funder, this.funderId, this.count);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ export class PersonComponent {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
);*/
|
);*/
|
||||||
this.fetchDatasets.getNumResultsForEntity("people", this.personId);
|
this.fetchDatasets.getNumForEntity("people", this.personId);
|
||||||
|
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|
|
@ -119,7 +119,7 @@ export class ProjectComponent{
|
||||||
// console.log(err);
|
// console.log(err);
|
||||||
// }
|
// }
|
||||||
//);
|
//);
|
||||||
this.fetchDatasets.getNumResultsForEntity("project", this.projectId);
|
this.fetchDatasets.getNumForEntity("project", this.projectId);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
this.warningMessage="No valid project id";
|
this.warningMessage="No valid project id";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
|
||||||
import { FetchProjects } from '../utils/fetchEntitiesClasses/fetchProjects.class';
|
import { FetchProjects } from '../utils/fetchEntitiesClasses/fetchProjects.class';
|
||||||
|
@ -54,7 +54,7 @@ import {RouterHelper} from '../utils/routerHelper.class';
|
||||||
})
|
})
|
||||||
|
|
||||||
export class SearchingProjectsTabComponent {
|
export class SearchingProjectsTabComponent {
|
||||||
public fetchProjects : FetchProjects;
|
@Input() fetchProjects : FetchProjects;
|
||||||
public organizationId:string = "";
|
public organizationId:string = "";
|
||||||
public page :number = 1;
|
public page :number = 1;
|
||||||
public size :number = 10;
|
public size :number = 10;
|
||||||
|
@ -75,10 +75,12 @@ export class SearchingProjectsTabComponent {
|
||||||
this.organizationId = params['organizationId'];
|
this.organizationId = params['organizationId'];
|
||||||
|
|
||||||
if(this.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.linkToSearchProjects = OpenaireProperties.getLinkToAdvancedSearchProjects();//+"?organization="+this.organizationId+"or=and";;
|
||||||
this.search(true,"");
|
if(this.fetchProjects.searchUtils.totalResults > 0) {
|
||||||
|
this.search(false,"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,8 +450,6 @@ export class SearchDataprovidersService {
|
||||||
}
|
}
|
||||||
|
|
||||||
numOfDataproviders(params: string):any {
|
numOfDataproviders(params: string):any {
|
||||||
console.info("getOfDataproviders : Dataproviders Service + params="+params);
|
|
||||||
|
|
||||||
let url = OpenaireProperties. getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json";
|
let url = OpenaireProperties. getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json";
|
||||||
let key = url;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
if (this._cache.has(key)) {
|
||||||
|
|
|
@ -243,11 +243,11 @@ export class SearchProjectsService {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
numOfEntityProjects(id: string, entity: string):any {
|
numOfProjects(params: string):any {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURLLast()
|
//OpenaireProperties.getSearchAPIURLLast()
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
//"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;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
if (this._cache.has(key)) {
|
||||||
return Observable.of(this._cache.get(key));
|
return Observable.of(this._cache.get(key));
|
||||||
|
|
|
@ -143,6 +143,7 @@ export class SearchPublicationsService {
|
||||||
searchPublicationsForEntity (params: string, page: number, size: number):any {
|
searchPublicationsForEntity (params: string, page: number, size: number):any {
|
||||||
let link = OpenaireProperties.getSearchAPIURLLast();
|
let link = OpenaireProperties.getSearchAPIURLLast();
|
||||||
let url = link+params+"/publications"+ "?format=json";
|
let url = link+params+"/publications"+ "?format=json";
|
||||||
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
|
|
||||||
let key = url;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
if (this._cache.has(key)) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ export class FetchDatasets{
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNumResultsForEntity(entity:string, id:string){
|
public getNumForEntity(entity:string, id:string){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
|
|
||||||
|
|
|
@ -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[]){
|
public getResultsForOrganizations(organizationId:string, filterquery:string, page: number, size: number, refineFields:string[]){
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status = errorCodes.LOADING;
|
this.searchUtils.status = errorCodes.LOADING;
|
||||||
|
|
||||||
this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
|
this._searchProjectsService.getProjectsForOrganizations(organizationId,filterquery, page, size,refineFields).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results
|
this.searchUtils.totalResults = data[0]; // the results can be filtered so this number can be no total results
|
||||||
|
|
|
@ -97,6 +97,8 @@ public getResultsForEntity(entity:string, id:string, page: number, size: number)
|
||||||
parameters = "projects/"+id;
|
parameters = "projects/"+id;
|
||||||
} else if(entity == "person") {
|
} else if(entity == "person") {
|
||||||
parameters = "people/"+id;
|
parameters = "people/"+id;
|
||||||
|
} else if(entity == "organization") {
|
||||||
|
parameters = "organizations/"+id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(parameters != "") {
|
if(parameters != "") {
|
||||||
|
|
Loading…
Reference in New Issue