Tabs for every type in Dataprovider landing page ready (organizations tab added)

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44796 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2016-12-02 17:09:13 +00:00
parent e0be0f421c
commit 79940e6fb5
13 changed files with 292 additions and 83 deletions

View File

@ -38,8 +38,7 @@
[resultsBy] = "dataProviderInfo.resultsBy" [resultsBy] = "dataProviderInfo.resultsBy"
[tabs]="dataProviderInfo.tabs" [tabs]="dataProviderInfo.tabs"
[statistics]="dataProviderInfo.statistics" [statistics]="dataProviderInfo.statistics"
[projects]="dataProviderInfo.projects" [organizations]="dataProviderInfo.organizations">
[datasources]="dataProviderInfo.datasources">
</tabs> </tabs>
</div> </div>

View File

@ -1,28 +1,39 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import { SearchDataprovidersComponent } from '../../searchPages/simple/searchDataproviders.component';
import {SearchResultComponent} from '../../searchPages/searchUtils/searchResult.component';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({ @Component({
selector: 'datasourcesTab', selector: 'datasourcesTab',
template: ` template: `
<div *ngIf="datasources == undefined" class = "alert alert-info " > <div *ngIf="searchDataprovidersComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no datasources There are no datasources
</div> </div>
<div *ngIf="datasources != undefined"> <div *ngIf="searchDataprovidersComponent.searchUtils.totalResults > 0">
<p> <p>
The results below are discovered through our pilot algorithms. The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a> <a href="mailto:">Let us know how we are doing!</a>
</p> </p>
<div class = "text-right" *ngIf = "searchDataprovidersComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchDataproviders" >View all {{searchDataprovidersComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
</div> </div>
` `
}) })
export class DatasourcesTabComponent { export class DatasourcesTabComponent {
@Input() datasources; @Input() paramsForSearchLink: string = "";
@Input() searchDataprovidersComponent : SearchDataprovidersComponent;
private linkToSearchDataproviders = "";
constructor () {} constructor () {}
ngOnInit() {} ngOnInit() {
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders()+this.paramsForSearchLink;
}
ngOnDestroy() {} ngOnDestroy() {}
} }

View File

@ -0,0 +1,39 @@
import {Component, Input} from '@angular/core';
@Component({
selector: 'organizationsTab',
template: `
<div *ngIf="organizations.length == 0" class = "alert alert-info " >
There are no organizations
</div>
<div *ngIf="organizations.length > 0">
<p>
The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a>
</p>
<div *ngFor="let item of organizations">
<p *ngIf=" item != undefined && item['url'] != undefined">
<a href="{{item['url']}}" target="_blank">
{{item['name']}}
</a>
</p>
<p *ngIf="item['url'] == undefined">
{{item['name']}}
</p>
</div>
</div>
`
})
export class OrganizationsTabComponent {
@Input() organizations: {"name": string, "url": string}[];
constructor () {}
ngOnInit() {}
ngOnDestroy() {}
}

View File

@ -1,28 +1,40 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import { SearchProjectsComponent } from '../../searchPages/simple/searchProjects.component';
import {SearchResultComponent} from '../../searchPages/searchUtils/searchResult.component';
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
@Component({ @Component({
selector: 'projectsTab', selector: 'projectsTab',
template: ` template: `
<div *ngIf="projects == undefined" class = "alert alert-info " > <div *ngIf="searchProjectsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
There are no projects There are no projects
</div> </div>
<div *ngIf="projects != undefined"> <div *ngIf="searchProjectsComponent.searchUtils.totalResults > 0">
<p> <p>
The results below are discovered through our pilot algorithms. The results below are discovered through our pilot algorithms.
<a href="mailto:">Let us know how we are doing!</a> <a href="mailto:">Let us know how we are doing!</a>
</p> </p>
<div class = "text-right" *ngIf = "searchProjectsComponent.searchUtils.totalResults > 10" ><a [href] = "linkToSearchProjects" >View all {{searchProjectsComponent.searchUtils.totalResults}} results</a></div>
<search-result [(results)]="searchProjectsComponent.results" [(status)]= "searchProjectsComponent.status"></search-result>
</div> </div>
` `
}) })
export class ProjectsTabComponent { export class ProjectsTabComponent {
@Input() projects; @Input() paramsForSearchLink: string = "";
@Input() searchProjectsComponent : SearchProjectsComponent;
private linkToSearchProjects = "";
constructor () {} constructor () {}
ngOnInit() {} ngOnInit() {
this.linkToSearchProjects = OpenaireProperties.getLinkToSearchProjects()+this.paramsForSearchLink;
}
ngOnDestroy() {} ngOnDestroy() {}
} }

View File

@ -5,14 +5,17 @@ import { SearchPublicationsComponent } from '../../searchPages/simple/searchPubl
import { SearchPublicationsService } from '../../services/searchPublications.service'; import { SearchPublicationsService } from '../../services/searchPublications.service';
import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component'; import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component';
import { SearchDatasetsService } from '../../services/searchDatasets.service'; import { SearchDatasetsService } from '../../services/searchDatasets.service';
import { SearchProjectsComponent } from '../../searchPages/simple/searchProjects.component';
import { SearchProjectsService } from '../../services/searchProjects.service';
import { SearchDataprovidersComponent } from '../../searchPages/simple/searchDataproviders.component';
import { SearchDataprovidersService } from '../../services/searchDataproviders.service';
@Component({ @Component({
selector: 'tabs', selector: 'tabs',
template: ` template: `
<ul *ngIf="tabs != undefined" class="nav nav-tabs"> <ul *ngIf="tabs != undefined" class="nav nav-tabs">
<li *ngIf="tabs.length>0" class="active"> <li *ngIf="tabs.length>0" class="active">
<a *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'" <a data-toggle="tab" href="#{{tabs[0].content}}">
data-toggle="tab" href="#{{tabs[0].content}}">
{{tabs[0].name}} {{tabs[0].name}}
<span class="badge" *ngIf="tabs[0].content=='publicationsTab'"> <span class="badge" *ngIf="tabs[0].content=='publicationsTab'">
{{searchPublicationsComponent.searchUtils.totalResults}} {{searchPublicationsComponent.searchUtils.totalResults}}
@ -20,27 +23,43 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
<span class="badge" *ngIf="tabs[0].content=='datasetsTab'"> <span class="badge" *ngIf="tabs[0].content=='datasetsTab'">
{{searchDatasetsComponent.searchUtils.totalResults}} {{searchDatasetsComponent.searchUtils.totalResults}}
</span> </span>
<span class="badge" *ngIf="tabs[0].content=='projectsTab'">
{{searchProjectsComponent.searchUtils.totalResults}}
</span>
<span class="badge" *ngIf="tabs[0].content=='datasourcesTab'">
{{searchDataprovidersComponent.searchUtils.totalResults}}
</span>
<span class="badge" *ngIf="tabs[0].content=='organizationsTab'">
{{organizations.length}}
</span>
</a> </a>
</li> </li>
<li *ngFor="let tab of tabs; let i=index" role="presentation"> <li *ngFor="let tab of tabs; let i=index" role="presentation">
<a *ngIf="(tab.content=='publicationsTab' || tab.content=='datasetsTab') && i>0" <a *ngIf="i>0"
(click)="search(tab.content)" data-toggle="tab" href="#{{tab.content}}"> (click)="search(tab.content, 1, 10)" data-toggle="tab" href="#{{tab.content}}">
{{tab.name}} {{tab.name}}
<span class="badge" *ngIf="tab.content=='publicationsTab'"> <span class="badge" *ngIf="tab.content=='publicationsTab'">
{{searchPublicationsComponent.searchUtils.totalResults}} {{searchPublicationsComponent.searchUtils.totalResults}}
</span> </span>
<span class="badge" *ngIf="tab.content=='datasetsTab'"> <span class="badge" *ngIf="tab.content=='datasetsTab'">
{{searchDatasetsComponent.searchUtils.totalResults}} {{searchDatasetsComponent.searchUtils.totalResults}}
</span> </span>
<span class="badge" *ngIf="tab.content=='projectsTab'">
{{searchProjectsComponent.searchUtils.totalResults}}
</span>
<span class="badge" *ngIf="tab.content=='datasourcesTab'">
{{searchDataprovidersComponent.searchUtils.totalResults}}
</span>
<span class="badge" *ngIf="tab.content=='organizationsTab'">
{{organizations.length}}
</span>
</a> </a>
</li> </li>
</ul> </ul>
<div *ngIf="tabs != undefined" class="tab-content"> <div *ngIf="tabs != undefined" class="tab-content">
<div *ngIf="tabs.length>0" id="{{tabs[0].content}}" class="tab-pane fade in active panel-body"> <div *ngIf="tabs.length>0" id="{{tabs[0].content}}" class="tab-pane fade in active panel-body">
<div *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'">
<publicationsTab *ngIf="tabs[0].content=='publicationsTab'" <publicationsTab *ngIf="tabs[0].content=='publicationsTab'"
[paramsForSearchLink]="paramsForSearchLink" [paramsForSearchLink]="paramsForSearchLink"
[searchPublicationsComponent]="searchPublicationsComponent"> [searchPublicationsComponent]="searchPublicationsComponent">
@ -50,20 +69,22 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
[searchDatasetsComponent]="searchDatasetsComponent"> [searchDatasetsComponent]="searchDatasetsComponent">
</datasetsTab> </datasetsTab>
<statisticsTab *ngIf="tabs[0].content=='statisticsTab'" <statisticsTab *ngIf="tabs[0].content=='statisticsTab'"
[statistics]="statistics"> [statistics]="statistics">
</statisticsTab> </statisticsTab>
<projectsTab *ngIf="tabs[0].content=='projectsTab'" <projectsTab *ngIf="tabs[0].content=='projectsTab'"
[projects]="projects"> [paramsForSearchLink]="paramsForSearchLink"
[searchProjectsComponent]="searchProjectsComponent">
</projectsTab> </projectsTab>
<datasourcesTab *ngIf="tabs[0].content=='datasourcesTab'" <datasourcesTab *ngIf="tabs[0].content=='datasourcesTab'"
[datasources]="datasources"> [paramsForSearchLink]="paramsForSearchLink"
[searchDataprovidersComponent]="searchDataprovidersComponent">
</datasourcesTab> </datasourcesTab>
<organizationsTab *ngIf="tabs[0].content=='organizationsTab'">
[organizations]="organizations"
</organizationsTab>
</div> </div>
<div>
<div *ngFor="let tab of tabs; let i=index" id="{{tab.content}}" class="tab-pane fade panel-body"> <div *ngFor="let tab of tabs; let i=index" id="{{tab.content}}" class="tab-pane fade panel-body">
<div *ngIf="tab.content=='publicationsTab' || tab.content=='datasetsTab'">
<publicationsTab *ngIf="i>0 && tab.content=='publicationsTab'" <publicationsTab *ngIf="i>0 && tab.content=='publicationsTab'"
[paramsForSearchLink]="paramsForSearchLink" [paramsForSearchLink]="paramsForSearchLink"
[searchPublicationsComponent] = "searchPublicationsComponent"> [searchPublicationsComponent] = "searchPublicationsComponent">
@ -73,9 +94,17 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
[searchDatasetsComponent]="searchDatasetsComponent"> [searchDatasetsComponent]="searchDatasetsComponent">
</datasetsTab> </datasetsTab>
<statisticsTab *ngIf="i>0 && tab.content=='statisticsTab'"></statisticsTab> <statisticsTab *ngIf="i>0 && tab.content=='statisticsTab'"></statisticsTab>
<projectsTab *ngIf="i>0 && tab.content=='projectsTab'"></projectsTab> <projectsTab *ngIf="i>0 && tab.content=='projectsTab'"
<datasourcesTab *ngIf="i>0 && tab.content=='datasourcesTab'"></datasourcesTab> [paramsForSearchLink]="paramsForSearchLink"
</div> [searchProjectsComponent]="searchProjectsComponent">
</projectsTab>
<datasourcesTab *ngIf="i>0 && tab.content=='datasourcesTab'"
[paramsForSearchLink]="paramsForSearchLink"
[searchDataprovidersComponent]="searchDataprovidersComponent">
</datasourcesTab>
<organizationsTab *ngIf="i>0 && tab.content=='organizationsTab'"
[organizations]="organizations">
</organizationsTab>
</div> </div>
</div> </div>
` `
@ -89,30 +118,37 @@ export class TabsComponent {
//@Input() publications; //@Input() publications;
//@Input() datasets; //@Input() datasets;
@Input() statistics; @Input() statistics;
@Input() projects; //@Input() projects;
@Input() datasources; //@Input() datasources;
@Input() organizations: {"name": string, "url": string}[];
private paramsForSearchLink: string = ""; private paramsForSearchLink: string = "";
private reloadPublications: boolean = true; private reloadPublications: boolean = true;
private reloadDatasets: boolean = true; private reloadDatasets: boolean = true;
private reloadProjects: boolean = true;
subPublications: any; private reloadDataproviders: boolean = true;
subDatasets: any;
private searchPublicationsComponent : SearchPublicationsComponent; private searchPublicationsComponent : SearchPublicationsComponent;
private searchDatasetsComponent: SearchDatasetsComponent; private searchDatasetsComponent: SearchDatasetsComponent;
private searchProjectsComponent: SearchProjectsComponent;
private searchDataprovidersComponent: SearchDataprovidersComponent;
constructor (private route: ActivatedRoute, constructor (private route: ActivatedRoute,
private _searchPublicationsService: SearchPublicationsService, private _searchPublicationsService: SearchPublicationsService,
private _searchDatasetsService: SearchDatasetsService) { private _searchDatasetsService: SearchDatasetsService,
private _searchProjectsService: SearchProjectsService,
private _searchDataprovidersService: SearchDataprovidersService) {
this.searchPublicationsComponent = new SearchPublicationsComponent(this.route, this._searchPublicationsService); this.searchPublicationsComponent = new SearchPublicationsComponent(this.route, this._searchPublicationsService);
this.searchDatasetsComponent = new SearchDatasetsComponent(this.route, this._searchDatasetsService); this.searchDatasetsComponent = new SearchDatasetsComponent(this.route, this._searchDatasetsService);
this.searchProjectsComponent = new SearchProjectsComponent(this.route, this._searchProjectsService);
this.searchDataprovidersComponent = new SearchDataprovidersComponent(this.route, this._searchDataprovidersService);
} }
ngOnInit() { ngOnInit() {
if(this.tabs != undefined && this.tabs.length > 0) { if(this.tabs != undefined && this.tabs.length > 0) {
this.search(this.tabs[0].content); this.search(this.tabs[0].content, 1, 10);
this.count(1, 0);
} }
if(this.resultsBy == "collectedFrom") { if(this.resultsBy == "collectedFrom") {
@ -122,38 +158,76 @@ export class TabsComponent {
} }
} }
ngOnDestroy() { private count(page: number, size: number) {
if(this.subPublications != undefined) { console.info("number of tabs: "+this.tabs.length);
this.subPublications.unsubscribe();
} for(let i=1; i<this.tabs.length; i++) {
if(this.subDatasets != undefined) { let content: string = this.tabs[i].content;
this.subDatasets.unsubscribe(); if(content=='publicationsTab') {
this.countPublications(page, size);
} else if(content=='datasetsTab') {
this.countDatasets(page, size);
} else if(content=='projectsTab') {
this.countProjects(page, size);
} else if(content=='datasourcesTab') {
this.countDataproviders(page, size);
}
} }
} }
private search(content: string) { private search(content: string, page: number, size: number) {
if(content=='publicationsTab') { if(content=='publicationsTab') {
this.subPublications = this.route.queryParams.subscribe(params => { this.searchPublications(page, size);
this.searchPublications();
});
} else if(content=='datasetsTab') { } else if(content=='datasetsTab') {
this.subDatasets = this.route.queryParams.subscribe(params => { this.searchDatasets(page, size);
this.searchDatasets(); } else if(content=='projectsTab') {
}); this.searchProjects(page, size);
} else if(content=='datasourcesTab') {
this.searchDataproviders(page, size);
} }
} }
private searchPublications() { private searchPublications(page: number, size: number) {
if(this.reloadPublications) { if(this.reloadPublications) {
this.searchPublicationsComponent.getResultsForDataproviders(this.id, this.resultsBy, 1, 10); this.searchPublicationsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
} }
this.reloadPublications = false; this.reloadPublications = false;
} }
private searchDatasets() { private countPublications(page: number, size: number) {
this.searchPublicationsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
}
private searchDatasets(page: number, size: number) {
if(this.reloadDatasets) { if(this.reloadDatasets) {
this.searchDatasetsComponent.getResultsForDataproviders(this.id, this.resultsBy, 1, 10); this.searchDatasetsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
} }
this.reloadDatasets = false; this.reloadDatasets = false;
} }
private countDatasets(page: number, size: number) {
this.searchDatasetsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
}
private searchProjects(page: number, size: number) {
if(this.reloadProjects) {
this.searchProjectsComponent.getResultsForDataproviders(this.id, page, size);
}
this.reloadProjects = false;
}
private countProjects(page: number, size: number) {
this.searchProjectsComponent.getResultsForDataproviders(this.id, page, size);
}
private searchDataproviders(page: number, size: number) {
if(this.reloadDataproviders) {
this.searchDataprovidersComponent.getResultsForDataproviders(this.id, page, size);
}
this.reloadDataproviders = false;
}
private countDataproviders(page: number, size: number) {
this.searchDataprovidersComponent.getResultsForDataproviders(this.id, page, size);
}
} }

View File

@ -21,6 +21,7 @@ import {DatasetsTabComponent} from './dataProvider/datasetsTab.component';
import {StatisticsTabComponent} from './dataProvider/statisticsTab.component'; import {StatisticsTabComponent} from './dataProvider/statisticsTab.component';
import {ProjectsTabComponent} from './dataProvider/projectsTab.component'; import {ProjectsTabComponent} from './dataProvider/projectsTab.component';
import {DatasourcesTabComponent} from './dataProvider/datasourcesTab.component'; import {DatasourcesTabComponent} from './dataProvider/datasourcesTab.component';
import {OrganizationsTabComponent} from './dataProvider/organizationsTab.component';
import {TabsComponent} from './dataProvider/tabs.component'; import {TabsComponent} from './dataProvider/tabs.component';
@ -45,7 +46,7 @@ import { LandingRoutingModule } from './landing-routing.module';
], ],
declarations: [ declarations: [
TabPagingComponent, TabTableComponent, ShowTitleComponent, ShowAuthorsComponent, ShowAuthorsComponent, ShowIdentifiersComponent, ShowIdentifiersComponent,ShowSubjectsComponent, TabPagingComponent, TabTableComponent, ShowTitleComponent, ShowAuthorsComponent, ShowAuthorsComponent, ShowIdentifiersComponent, ShowIdentifiersComponent,ShowSubjectsComponent,
PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, TabsComponent, PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent, TabsComponent,
DataProviderComponent, PersonComponent, ProjectComponent, PublicationComponent, OrganizationComponent, DatasetComponent, DataProviderComponent, PersonComponent, ProjectComponent, PublicationComponent, OrganizationComponent, DatasetComponent,
], ],
providers:[ providers:[

View File

@ -14,8 +14,8 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
<li *ngFor="let result of results"> <li *ngFor="let result of results">
<h4> <h4>
<a href="{{result['title'].url}}"> <a href="{{result['title'].url}}">
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"> <p *ngIf="result['title'].name != undefined && result['title'].name != ''"
{{result['title'].name}} [innerHTML]="result['title'].name">
</p> </p>
<p *ngIf="result['title'].name == undefined || result['title'].name == ''"> <p *ngIf="result['title'].name == undefined || result['title'].name == ''">
{{result['title'].url}} {{result['title'].url}}

View File

@ -181,6 +181,32 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
} }
} }
public getResultsForDataproviders(id:string, page: number, size: number){
this._searchDataprovidersService.getDataProvidersforEntityRegistry(id, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Dataproviders for Entity Registry: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(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 getResults(keyword:string,refine:boolean, page: number, size: number){ public getResults(keyword:string,refine:boolean, page: number, size: number){
var parameters = ""; var parameters = "";
if(keyword.length > 0){ if(keyword.length > 0){

View File

@ -114,6 +114,32 @@ export class SearchProjectsComponent {
); );
} }
public getResultsForDataproviders(id:string, page: number, size: number){
this._searchProjectsService.getProjectsforDataProvider(id, page, size).subscribe(
data => {
this.searchUtils.totalResults = data[0];
console.info("search Projects for Dataproviders: [Id:"+id+" ] [total results:"+this.searchUtils.totalResults+"]");
this.results = data[1];
var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = errorCodes.DONE;
if(this.searchUtils.totalResults == 0 ){
this.searchUtils.status = errorCodes.NONE;
}
},
err => {
console.error(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;
}
);
}
private queryChanged($event) { private queryChanged($event) {
this.urlParams = undefined; this.urlParams = undefined;

View File

@ -56,10 +56,18 @@ export class DataProviderService {
if(data[1] != null) { if(data[1] != null) {
this.dataProviderInfo.type = data[1].classname; this.dataProviderInfo.type = data[1].classname;
if(data[1].classid == "entityregistry" || data[1].classid == "entityregistry::projects" || data[1].classid == "entityregistry::repositories") {
this.dataProviderInfo.registry = true;
console.info("true");
} else {
this.dataProviderInfo.registry = false;
console.info("false");
}
console.info(this.dataProviderInfo.type);
if(this.dataProviderInfo.tabs == undefined) { if(this.dataProviderInfo.tabs == undefined) {
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>(); this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
} }
if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) { if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Publications", "content": "publicationsTab"}); this.dataProviderInfo.tabs.push({"name": "Publications", "content": "publicationsTab"});
} }
@ -75,6 +83,7 @@ export class DataProviderService {
if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) { if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Datasources", "content": "datasourcesTab"}); this.dataProviderInfo.tabs.push({"name": "Datasources", "content": "datasourcesTab"});
} }
this.dataProviderInfo.tabs.push({"name": "Organizations", "content": "organizationsTab"});
if(this.dataProviderInfo.resultTypes.collectedFrom.has(data[1].classid)) { if(this.dataProviderInfo.resultTypes.collectedFrom.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "collectedFrom"; this.dataProviderInfo.resultsBy = "collectedFrom";
@ -83,21 +92,23 @@ export class DataProviderService {
} }
} }
if(data[2] != null) { if(!this.dataProviderInfo.registry) {
this.dataProviderInfo.compatibility = data[2].classname; if(data[2] != null) {
} this.dataProviderInfo.compatibility = data[2].classname;
if(data[3] != null) {
let oaiPmhURL: string;
if(Array.isArray(data[3])) {
oaiPmhURL = data[3][0];
}
else {
oaiPmhURL = data[3];
} }
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') { if(data[3] != null) {
this.dataProviderInfo.oaiPmhURL = oaiPmhURL; let oaiPmhURL: string;
if(Array.isArray(data[3])) {
oaiPmhURL = data[3][0];
}
else {
oaiPmhURL = data[3];
}
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
}
} }
} }
@ -111,8 +122,9 @@ export class DataProviderService {
mydata = length > 1 ? data[4][i] : data[4]; mydata = length > 1 ? data[4][i] : data[4];
if(mydata.hasOwnProperty("to")) { if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class == "provides" && mydata['to'].type == "organization") { if(mydata['to'].class == "provides" && mydata['to'].type == "organization") {
if(this.dataProviderInfo.organizations == undefined) { //if(this.dataProviderInfo.organizations == undefined) {
this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>(); if(this.dataProviderInfo.organizations.length == 0) {
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
this.dataProviderInfo.countries = new Array<string>(); this.dataProviderInfo.countries = new Array<string>();
countriesSet = new Set<string>(); countriesSet = new Set<string>();
} }

View File

@ -201,9 +201,11 @@ export class DatasetService {
} }
} }
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) { if(this.datasetInfo.authors != undefined) {
return (item != undefined); this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
}); return (item != undefined);
});
}
} }
if(data[3] != null) { if(data[3] != null) {

View File

@ -86,7 +86,7 @@ export class SearchPublicationsService {
searchPublicationsForDataproviders(params: string, page: number, size: number):any { searchPublicationsForDataproviders(params: string, page: number, size: number):any {
let link = OpenaireProperties.getSearchAPIURLLast(); let link = OpenaireProperties.getSearchAPIURLLast();
let url = link+params+ "&format=json"; let url = link+params+ "&page="+(page-1)+"&size="+size + "&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));
@ -217,10 +217,12 @@ export class SearchPublicationsService {
} else { } else {
result.description = resData.description[0]; result.description = resData.description[0];
} }
if(result.description.length > this.sizeOfDescription) { if(result.description.length > this.sizeOfDescription) {
result.description = result.description.substring(0, this.sizeOfDescription)+"..."; result.description = result.description.substring(0, this.sizeOfDescription) + "...";
} }
result.embargoEndDate = resData.embargoenddate; result.embargoEndDate = resData.embargoenddate;
results.push(result); results.push(result);

View File

@ -1,6 +1,7 @@
export class DataProviderInfo { export class DataProviderInfo {
title: { "name": string, "url": string }; title: { "name": string, "url": string };
type: string; type: string;
registry: boolean;
compatibility: string; compatibility: string;
oaiPmhURL: string; oaiPmhURL: string;
countries: string[]; countries: string[];
@ -37,6 +38,10 @@ export class DataProviderInfo {
"pubsrepository::thematic", "pubsrepository::thematic",
"pubscatalogue::unknown" "pubscatalogue::unknown"
]), ]),
// "organizationsTab": new Set<string>(
// [ "entityregistry::projects",
// "entityregistry::repositories"
// ]),
"projectsTab": new Set<string>(["entityregistry::projects"]), "projectsTab": new Set<string>(["entityregistry::projects"]),
"datasourcesTab": new Set<string>(["entityregistry::repositories"]) "datasourcesTab": new Set<string>(["entityregistry::repositories"])
}; };
@ -63,10 +68,10 @@ export class DataProviderInfo {
]) ])
}; };
organizations: {"name": string, "url": string}[]; organizations: {"name": string, "url": string}[] = [];
//publications: any; //publications: any;
datasets: any; //datasets: any;
statistics: any; statistics: any;
projects: any; //projects: any;
datasources: any; datasources: any;
} }