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:
parent
e0be0f421c
commit
79940e6fb5
|
@ -38,8 +38,7 @@
|
|||
[resultsBy] = "dataProviderInfo.resultsBy"
|
||||
[tabs]="dataProviderInfo.tabs"
|
||||
[statistics]="dataProviderInfo.statistics"
|
||||
[projects]="dataProviderInfo.projects"
|
||||
[datasources]="dataProviderInfo.datasources">
|
||||
[organizations]="dataProviderInfo.organizations">
|
||||
</tabs>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,28 +1,39 @@
|
|||
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({
|
||||
selector: 'datasourcesTab',
|
||||
template: `
|
||||
<div *ngIf="datasources == undefined" class = "alert alert-info " >
|
||||
<div *ngIf="searchDataprovidersComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
|
||||
There are no datasources
|
||||
</div>
|
||||
|
||||
<div *ngIf="datasources != undefined">
|
||||
<div *ngIf="searchDataprovidersComponent.searchUtils.totalResults > 0">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</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>
|
||||
`
|
||||
})
|
||||
|
||||
export class DatasourcesTabComponent {
|
||||
|
||||
@Input() datasources;
|
||||
@Input() paramsForSearchLink: string = "";
|
||||
@Input() searchDataprovidersComponent : SearchDataprovidersComponent;
|
||||
private linkToSearchDataproviders = "";
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders()+this.paramsForSearchLink;
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
||||
|
|
|
@ -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() {}
|
||||
}
|
|
@ -1,28 +1,40 @@
|
|||
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({
|
||||
selector: 'projectsTab',
|
||||
template: `
|
||||
<div *ngIf="projects == undefined" class = "alert alert-info " >
|
||||
<div *ngIf="searchProjectsComponent.searchUtils.totalResults == 0" class = "alert alert-info " >
|
||||
There are no projects
|
||||
</div>
|
||||
|
||||
<div *ngIf="projects != undefined">
|
||||
<div *ngIf="searchProjectsComponent.searchUtils.totalResults > 0">
|
||||
<p>
|
||||
The results below are discovered through our pilot algorithms.
|
||||
<a href="mailto:">Let us know how we are doing!</a>
|
||||
</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>
|
||||
`
|
||||
})
|
||||
|
||||
export class ProjectsTabComponent {
|
||||
|
||||
@Input() projects;
|
||||
@Input() paramsForSearchLink: string = "";
|
||||
@Input() searchProjectsComponent : SearchProjectsComponent;
|
||||
private linkToSearchProjects = "";
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
this.linkToSearchProjects = OpenaireProperties.getLinkToSearchProjects()+this.paramsForSearchLink;
|
||||
}
|
||||
|
||||
ngOnDestroy() {}
|
||||
}
|
||||
|
|
|
@ -5,14 +5,17 @@ import { SearchPublicationsComponent } from '../../searchPages/simple/searchPubl
|
|||
import { SearchPublicationsService } from '../../services/searchPublications.service';
|
||||
import { SearchDatasetsComponent } from '../../searchPages/simple/searchDatasets.component';
|
||||
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({
|
||||
selector: 'tabs',
|
||||
template: `
|
||||
<ul *ngIf="tabs != undefined" class="nav nav-tabs">
|
||||
<li *ngIf="tabs.length>0" class="active">
|
||||
<a *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'"
|
||||
data-toggle="tab" href="#{{tabs[0].content}}">
|
||||
<a data-toggle="tab" href="#{{tabs[0].content}}">
|
||||
{{tabs[0].name}}
|
||||
<span class="badge" *ngIf="tabs[0].content=='publicationsTab'">
|
||||
{{searchPublicationsComponent.searchUtils.totalResults}}
|
||||
|
@ -20,27 +23,43 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
|
|||
<span class="badge" *ngIf="tabs[0].content=='datasetsTab'">
|
||||
{{searchDatasetsComponent.searchUtils.totalResults}}
|
||||
</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>
|
||||
</li>
|
||||
|
||||
<li *ngFor="let tab of tabs; let i=index" role="presentation">
|
||||
<a *ngIf="(tab.content=='publicationsTab' || tab.content=='datasetsTab') && i>0"
|
||||
(click)="search(tab.content)" data-toggle="tab" href="#{{tab.content}}">
|
||||
{{tab.name}}
|
||||
<span class="badge" *ngIf="tab.content=='publicationsTab'">
|
||||
{{searchPublicationsComponent.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="badge" *ngIf="tab.content=='datasetsTab'">
|
||||
{{searchDatasetsComponent.searchUtils.totalResults}}
|
||||
</span>
|
||||
<a *ngIf="i>0"
|
||||
(click)="search(tab.content, 1, 10)" data-toggle="tab" href="#{{tab.content}}">
|
||||
{{tab.name}}
|
||||
<span class="badge" *ngIf="tab.content=='publicationsTab'">
|
||||
{{searchPublicationsComponent.searchUtils.totalResults}}
|
||||
</span>
|
||||
<span class="badge" *ngIf="tab.content=='datasetsTab'">
|
||||
{{searchDatasetsComponent.searchUtils.totalResults}}
|
||||
</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>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<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[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'">
|
||||
|
||||
<publicationsTab *ngIf="tabs[0].content=='publicationsTab'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[searchPublicationsComponent]="searchPublicationsComponent">
|
||||
|
@ -50,20 +69,22 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
|
|||
[searchDatasetsComponent]="searchDatasetsComponent">
|
||||
</datasetsTab>
|
||||
<statisticsTab *ngIf="tabs[0].content=='statisticsTab'"
|
||||
[statistics]="statistics">
|
||||
[statistics]="statistics">
|
||||
</statisticsTab>
|
||||
<projectsTab *ngIf="tabs[0].content=='projectsTab'"
|
||||
[projects]="projects">
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[searchProjectsComponent]="searchProjectsComponent">
|
||||
</projectsTab>
|
||||
<datasourcesTab *ngIf="tabs[0].content=='datasourcesTab'"
|
||||
[datasources]="datasources">
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[searchDataprovidersComponent]="searchDataprovidersComponent">
|
||||
</datasourcesTab>
|
||||
<organizationsTab *ngIf="tabs[0].content=='organizationsTab'">
|
||||
[organizations]="organizations"
|
||||
</organizationsTab>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<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'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[searchPublicationsComponent] = "searchPublicationsComponent">
|
||||
|
@ -73,9 +94,17 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
|
|||
[searchDatasetsComponent]="searchDatasetsComponent">
|
||||
</datasetsTab>
|
||||
<statisticsTab *ngIf="i>0 && tab.content=='statisticsTab'"></statisticsTab>
|
||||
<projectsTab *ngIf="i>0 && tab.content=='projectsTab'"></projectsTab>
|
||||
<datasourcesTab *ngIf="i>0 && tab.content=='datasourcesTab'"></datasourcesTab>
|
||||
</div>
|
||||
<projectsTab *ngIf="i>0 && tab.content=='projectsTab'"
|
||||
[paramsForSearchLink]="paramsForSearchLink"
|
||||
[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>
|
||||
`
|
||||
|
@ -89,30 +118,37 @@ export class TabsComponent {
|
|||
//@Input() publications;
|
||||
//@Input() datasets;
|
||||
@Input() statistics;
|
||||
@Input() projects;
|
||||
@Input() datasources;
|
||||
//@Input() projects;
|
||||
//@Input() datasources;
|
||||
@Input() organizations: {"name": string, "url": string}[];
|
||||
|
||||
private paramsForSearchLink: string = "";
|
||||
|
||||
private reloadPublications: boolean = true;
|
||||
private reloadDatasets: boolean = true;
|
||||
|
||||
subPublications: any;
|
||||
subDatasets: any;
|
||||
private reloadProjects: boolean = true;
|
||||
private reloadDataproviders: boolean = true;
|
||||
|
||||
private searchPublicationsComponent : SearchPublicationsComponent;
|
||||
private searchDatasetsComponent: SearchDatasetsComponent;
|
||||
private searchProjectsComponent: SearchProjectsComponent;
|
||||
private searchDataprovidersComponent: SearchDataprovidersComponent;
|
||||
|
||||
constructor (private route: ActivatedRoute,
|
||||
private _searchPublicationsService: SearchPublicationsService,
|
||||
private _searchDatasetsService: SearchDatasetsService) {
|
||||
private _searchDatasetsService: SearchDatasetsService,
|
||||
private _searchProjectsService: SearchProjectsService,
|
||||
private _searchDataprovidersService: SearchDataprovidersService) {
|
||||
this.searchPublicationsComponent = new SearchPublicationsComponent(this.route, this._searchPublicationsService);
|
||||
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() {
|
||||
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") {
|
||||
|
@ -122,38 +158,76 @@ export class TabsComponent {
|
|||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if(this.subPublications != undefined) {
|
||||
this.subPublications.unsubscribe();
|
||||
}
|
||||
if(this.subDatasets != undefined) {
|
||||
this.subDatasets.unsubscribe();
|
||||
private count(page: number, size: number) {
|
||||
console.info("number of tabs: "+this.tabs.length);
|
||||
|
||||
for(let i=1; i<this.tabs.length; i++) {
|
||||
let content: string = this.tabs[i].content;
|
||||
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') {
|
||||
this.subPublications = this.route.queryParams.subscribe(params => {
|
||||
this.searchPublications();
|
||||
});
|
||||
this.searchPublications(page, size);
|
||||
} else if(content=='datasetsTab') {
|
||||
this.subDatasets = this.route.queryParams.subscribe(params => {
|
||||
this.searchDatasets();
|
||||
});
|
||||
this.searchDatasets(page, size);
|
||||
} 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) {
|
||||
this.searchPublicationsComponent.getResultsForDataproviders(this.id, this.resultsBy, 1, 10);
|
||||
this.searchPublicationsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
|
||||
}
|
||||
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) {
|
||||
this.searchDatasetsComponent.getResultsForDataproviders(this.id, this.resultsBy, 1, 10);
|
||||
this.searchDatasetsComponent.getResultsForDataproviders(this.id, this.resultsBy, page, size);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import {DatasetsTabComponent} from './dataProvider/datasetsTab.component';
|
|||
import {StatisticsTabComponent} from './dataProvider/statisticsTab.component';
|
||||
import {ProjectsTabComponent} from './dataProvider/projectsTab.component';
|
||||
import {DatasourcesTabComponent} from './dataProvider/datasourcesTab.component';
|
||||
import {OrganizationsTabComponent} from './dataProvider/organizationsTab.component';
|
||||
import {TabsComponent} from './dataProvider/tabs.component';
|
||||
|
||||
|
||||
|
@ -45,7 +46,7 @@ import { LandingRoutingModule } from './landing-routing.module';
|
|||
],
|
||||
declarations: [
|
||||
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,
|
||||
],
|
||||
providers:[
|
||||
|
|
|
@ -14,8 +14,8 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
|||
<li *ngFor="let result of results">
|
||||
<h4>
|
||||
<a href="{{result['title'].url}}">
|
||||
<p *ngIf="result['title'].name != undefined && result['title'].name != ''">
|
||||
{{result['title'].name}}
|
||||
<p *ngIf="result['title'].name != undefined && result['title'].name != ''"
|
||||
[innerHTML]="result['title'].name">
|
||||
</p>
|
||||
<p *ngIf="result['title'].name == undefined || result['title'].name == ''">
|
||||
{{result['title'].url}}
|
||||
|
|
|
@ -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){
|
||||
var parameters = "";
|
||||
if(keyword.length > 0){
|
||||
|
|
|
@ -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) {
|
||||
this.urlParams = undefined;
|
||||
|
|
|
@ -56,10 +56,18 @@ export class DataProviderService {
|
|||
if(data[1] != null) {
|
||||
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) {
|
||||
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
|
||||
}
|
||||
|
||||
if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
|
||||
this.dataProviderInfo.tabs.push({"name": "Publications", "content": "publicationsTab"});
|
||||
}
|
||||
|
@ -75,6 +83,7 @@ export class DataProviderService {
|
|||
if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
|
||||
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)) {
|
||||
this.dataProviderInfo.resultsBy = "collectedFrom";
|
||||
|
@ -83,21 +92,23 @@ export class DataProviderService {
|
|||
}
|
||||
}
|
||||
|
||||
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(!this.dataProviderInfo.registry) {
|
||||
if(data[2] != null) {
|
||||
this.dataProviderInfo.compatibility = data[2].classname;
|
||||
}
|
||||
|
||||
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
|
||||
this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
|
||||
if(data[3] != null) {
|
||||
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];
|
||||
if(mydata.hasOwnProperty("to")) {
|
||||
if(mydata['to'].class == "provides" && mydata['to'].type == "organization") {
|
||||
if(this.dataProviderInfo.organizations == undefined) {
|
||||
this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
|
||||
//if(this.dataProviderInfo.organizations == undefined) {
|
||||
if(this.dataProviderInfo.organizations.length == 0) {
|
||||
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
|
||||
this.dataProviderInfo.countries = new Array<string>();
|
||||
countriesSet = new Set<string>();
|
||||
}
|
||||
|
|
|
@ -201,9 +201,11 @@ export class DatasetService {
|
|||
}
|
||||
}
|
||||
|
||||
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
if(this.datasetInfo.authors != undefined) {
|
||||
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
|
|
|
@ -86,7 +86,7 @@ export class SearchPublicationsService {
|
|||
|
||||
searchPublicationsForDataproviders(params: string, page: number, size: number):any {
|
||||
let link = OpenaireProperties.getSearchAPIURLLast();
|
||||
let url = link+params+ "&format=json";
|
||||
let url = link+params+ "&page="+(page-1)+"&size="+size + "&format=json";
|
||||
let key = url;
|
||||
if (this._cache.has(key)) {
|
||||
return Observable.of(this._cache.get(key));
|
||||
|
@ -217,10 +217,12 @@ export class SearchPublicationsService {
|
|||
} else {
|
||||
result.description = resData.description[0];
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
results.push(result);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export class DataProviderInfo {
|
||||
title: { "name": string, "url": string };
|
||||
type: string;
|
||||
registry: boolean;
|
||||
compatibility: string;
|
||||
oaiPmhURL: string;
|
||||
countries: string[];
|
||||
|
@ -37,6 +38,10 @@ export class DataProviderInfo {
|
|||
"pubsrepository::thematic",
|
||||
"pubscatalogue::unknown"
|
||||
]),
|
||||
// "organizationsTab": new Set<string>(
|
||||
// [ "entityregistry::projects",
|
||||
// "entityregistry::repositories"
|
||||
// ]),
|
||||
"projectsTab": new Set<string>(["entityregistry::projects"]),
|
||||
"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;
|
||||
datasets: any;
|
||||
//datasets: any;
|
||||
statistics: any;
|
||||
projects: any;
|
||||
//projects: any;
|
||||
datasources: any;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue