Deposit Results Page: messages fixed | compatibility, countries info added in Search Dataproviders Page | Dataproviders landing page: no tabs for unknown types | CSV (problem with double quotes) added in Compatible Dataproviders, Entity Registries, Search Publications pages
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44732 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
7fc478f933
commit
b328a6028d
|
@ -40,8 +40,8 @@ import {OrganizationService} from '../services/organization.service';
|
||||||
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
|
<search-result [(results)]="searchDataprovidersComponent.results" [(status)]= "searchDataprovidersComponent.status"></search-result>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="(searchDataprovidersComponent.status == errorCodes.NONE && status == errorCodes.DONE)
|
<div *ngIf="(searchDataprovidersComponent.searchUtils.totalResults == 0 && status == errorCodes.DONE)
|
||||||
|| status == errorCodes.NONE" class = "alert alert-warning">
|
|| status == errorCodes.NONE || status == errorCodes.ERROR" class = "alert alert-warning">
|
||||||
<div *ngIf="organization != undefined">
|
<div *ngIf="organization != undefined">
|
||||||
No data providers found
|
No data providers found
|
||||||
<span *ngIf="organization != undefined">
|
<span *ngIf="organization != undefined">
|
||||||
|
@ -53,9 +53,12 @@ import {OrganizationService} from '../services/organization.service';
|
||||||
</span>
|
</span>
|
||||||
.
|
.
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="organization == undefined">
|
<div *ngIf="organization == undefined && organizationId != ''">
|
||||||
No organization with ID: {{organizationId}} found.
|
No organization with ID: {{organizationId}} found.
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="organizationId == ''">
|
||||||
|
No ID for organization.
|
||||||
|
</div>
|
||||||
|
|
||||||
You can still deposit your publications and/or research data in
|
You can still deposit your publications and/or research data in
|
||||||
<a href="{{zenodo}}">OpenAIRE's Zenodo catch-all repository </a>
|
<a href="{{zenodo}}">OpenAIRE's Zenodo catch-all repository </a>
|
||||||
|
@ -67,7 +70,7 @@ import {OrganizationService} from '../services/organization.service';
|
||||||
|
|
||||||
export class DepositResultComponent {
|
export class DepositResultComponent {
|
||||||
private organization: {"name": string, "url": string};
|
private organization: {"name": string, "url": string};
|
||||||
private organizationId: string;
|
private organizationId: string = "";
|
||||||
|
|
||||||
private status: number;
|
private status: number;
|
||||||
private errorCodes:ErrorCodes = new ErrorCodes();
|
private errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
@ -105,6 +108,13 @@ export class DepositResultComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngDoCheck() {
|
||||||
|
if(this.organizationId == "" || this.organizationId == undefined) {
|
||||||
|
this.organizationId = "";
|
||||||
|
this.status = this.errorCodes.ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.sub.unsubscribe();
|
this.sub.unsubscribe();
|
||||||
if(this.subDataproviders != undefined) {
|
if(this.subDataproviders != undefined) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tabs',
|
selector: 'tabs',
|
||||||
template: `
|
template: `
|
||||||
<ul 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 *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'"
|
||||||
data-toggle="tab" href="#{{tabs[0].content}}">
|
data-toggle="tab" href="#{{tabs[0].content}}">
|
||||||
|
@ -37,7 +37,7 @@ import { SearchDatasetsService } from '../../services/searchDatasets.service';
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div 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'">
|
<div *ngIf="tabs[0].content=='publicationsTab' || tabs[0].content=='datasetsTab'">
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ export class TabsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if(this.tabs != []) {
|
if(this.tabs != undefined && this.tabs.length > 0) {
|
||||||
this.search(this.tabs[0].content);
|
this.search(this.tabs[0].content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
import {ExportCSVComponent} from '../../utils/exportCSV.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-dataproviders',
|
selector: 'search-dataproviders',
|
||||||
|
@ -16,7 +17,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Compatible Dataproviders" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)"
|
||||||
|
(downloadClick)="downloadClicked($event)">
|
||||||
</search-page>
|
</search-page>
|
||||||
<!--table-view [(datasources)] = results></table-view-->
|
<!--table-view [(datasources)] = results></table-view-->
|
||||||
|
|
||||||
|
@ -38,6 +40,12 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
private _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}];
|
private _prefixQueryFields: {field:string,opName:string,opValue:string,values:string[]}[] =[{field:"compatibility",opName:"cm",opValue:"not", values:["UNKNOWN","hostedBy","notCompatible"]},{field:"type",opName:"tp",opValue:"not",values: ["other"]}];
|
||||||
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
||||||
private _prefixQuery: string = "";
|
private _prefixQuery: string = "";
|
||||||
|
|
||||||
|
private CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||||
|
"export":[]
|
||||||
|
};
|
||||||
|
private CSVDownloaded = false;
|
||||||
|
|
||||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||||
|
@ -140,4 +148,33 @@ export class SearchCompatibleDataprovidersComponent {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private downloadClicked($event) {
|
||||||
|
if(!this.CSVDownloaded) {
|
||||||
|
this.CSVDownloaded = false;
|
||||||
|
|
||||||
|
var parameters = $event.value;
|
||||||
|
|
||||||
|
//this.getResultsCSV(parameters, false, 1, 1000);
|
||||||
|
|
||||||
|
this._searchDataprovidersService.searchCompatibleDataprovidersCSV(parameters,this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe(
|
||||||
|
data => {
|
||||||
|
this.CSV.export = data;
|
||||||
|
ExportCSVComponent.downloadCSV(this.CSV, "compatibleDataproviders.csv");
|
||||||
|
|
||||||
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
import {ExportCSVComponent} from '../../utils/exportCSV.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-entity-registries',
|
selector: 'search-entity-registries',
|
||||||
|
@ -17,7 +17,8 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
|
<search-page pageTitle="Entity Registries" type="datasource" [(filters)] = "filters"
|
||||||
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
[(results)] = "results" [(searchUtils)] = "searchUtils"
|
||||||
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" >
|
[baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)"
|
||||||
|
(downloadClick)="downloadClicked($event)">
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -38,6 +39,12 @@ export class SearchEntityRegistriesComponent {
|
||||||
{field:"type",opName:"tp",opValue:"and",values: ["other"]}];
|
{field:"type",opName:"tp",opValue:"and",values: ["other"]}];
|
||||||
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
// ["entityregistry","entityregistry::projects","entityregistry::repositories"]}];
|
||||||
private _prefixQuery: string = "";
|
private _prefixQuery: string = "";
|
||||||
|
|
||||||
|
private CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ],
|
||||||
|
"export":[]
|
||||||
|
};
|
||||||
|
private CSVDownloaded = false;
|
||||||
|
|
||||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService ) {
|
||||||
|
@ -136,4 +143,34 @@ export class SearchEntityRegistriesComponent {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private downloadClicked($event) {
|
||||||
|
if(!this.CSVDownloaded) {
|
||||||
|
this.CSVDownloaded = false;
|
||||||
|
|
||||||
|
var parameters = $event.value;
|
||||||
|
|
||||||
|
//this.getResultsCSV(parameters, false, 1, 1000);
|
||||||
|
|
||||||
|
this._searchDataprovidersService.searchEntityRegistriesCSV(parameters, this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe(
|
||||||
|
data => {
|
||||||
|
this.CSV.export = data;
|
||||||
|
ExportCSVComponent.downloadCSV(this.CSV, "etityRegistries.csv");
|
||||||
|
|
||||||
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span *ngIf="result.startYear && result.endYear"> ({{result.startYear}} - {{result.endYear}})</span>
|
<span *ngIf="result.startYear && result.endYear"> ({{result.startYear}} - {{result.endYear}})</span>
|
||||||
<div *ngIf="result['organizations'] != undefined">
|
<div *ngIf="result['organizations'] != undefined && result['organizations'].length > 0">
|
||||||
<span> Organizations: </span>
|
<span> Organizations: </span>
|
||||||
<span *ngFor="let organization of result['organizations'] let i=index">
|
<span *ngFor="let organization of result['organizations'] let i=index">
|
||||||
<a *ngIf="organization.url != undefined" href="{{organization.url}}">
|
<a *ngIf="organization.url != undefined" href="{{organization.url}}">
|
||||||
|
@ -110,7 +110,7 @@ import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||||
Compatibility: {{result.compatibility}}
|
Compatibility: {{result.compatibility}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="result['countries'] != undefined">
|
<div *ngIf="result['countries'] != undefined && result['countries'].length > 0">
|
||||||
Countries: {{result.countries}}
|
Countries: {{result.countries}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro
|
||||||
import {SearchFields} from '../../utils/properties/searchFields';
|
import {SearchFields} from '../../utils/properties/searchFields';
|
||||||
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
import {SearchPageComponent } from '../searchUtils/searchPage.component';
|
||||||
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
||||||
|
import {ExportCSVComponent} from '../../utils/exportCSV.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-publications',
|
selector: 'search-publications',
|
||||||
|
@ -17,7 +18,8 @@ import {SearchUtilsClass} from '../searchUtils/searchUtils.class';
|
||||||
|
|
||||||
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters"
|
<search-page pageTitle="Search Publications" type="publication" [(filters)] = "filters"
|
||||||
[(results)] = "results"
|
[(results)] = "results"
|
||||||
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl (queryChange)="queryChanged($event)" >
|
[(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl
|
||||||
|
(queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)">
|
||||||
</search-page>
|
</search-page>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
@ -39,6 +41,13 @@ export class SearchPublicationsComponent {
|
||||||
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
@ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
||||||
private _location:Location;
|
private _location:Location;
|
||||||
|
|
||||||
|
private CSV: any = { "columnNames": ["Title", "Authors", "Publication Year", "DOI",
|
||||||
|
/*"Download From", "Publication type", "Journal",*/
|
||||||
|
"Funder", "Project Name (GA Number)", "Access"],
|
||||||
|
"export":[]
|
||||||
|
};
|
||||||
|
private CSVDownloaded = false;
|
||||||
|
|
||||||
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
|
constructor (private route: ActivatedRoute, private _searchPublicationsService: SearchPublicationsService ) {
|
||||||
var errorCodes:ErrorCodes = new ErrorCodes();
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
this.searchUtils.status =errorCodes.LOADING;
|
this.searchUtils.status =errorCodes.LOADING;
|
||||||
|
@ -211,5 +220,34 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
|
||||||
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private downloadClicked($event) {
|
||||||
|
if(!this.CSVDownloaded) {
|
||||||
|
this.CSVDownloaded = false;
|
||||||
|
|
||||||
|
var parameters = $event.value;
|
||||||
|
|
||||||
|
//this.getResultsCSV(parameters, false, 1, 1000);
|
||||||
|
|
||||||
|
this._searchPublicationsService.searchPublicationsCSV(parameters, this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe(
|
||||||
|
data => {
|
||||||
|
this.CSV.export = data;
|
||||||
|
ExportCSVComponent.downloadCSV(this.CSV, "publications.csv");
|
||||||
|
|
||||||
|
var errorCodes:ErrorCodes = new ErrorCodes();
|
||||||
|
this.searchUtils.status = errorCodes.DONE;
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,52 @@ export class SearchDataprovidersService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchEntityRegistriesCSV (params: string,refineParams:string, page: number, size: number):any {
|
||||||
|
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
|
url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
|
||||||
|
if(params!= null && params != '' ) {
|
||||||
|
url += params;
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+page+"&size="+size;
|
||||||
|
let key = url;
|
||||||
|
if (this._cache.has(key)) {
|
||||||
|
return Observable.of(this._cache.get(key));
|
||||||
|
}
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
//.do(res => console.info(res))
|
||||||
|
.map(res => this.parseResultsCSV(res['results']))
|
||||||
|
.do(res => {
|
||||||
|
this._cache.set(key, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchCompatibleDataprovidersCSV (params: string,refineParams:string, page: number, size: number):any {
|
||||||
|
let url = OpenaireProperties.getSearchResourcesAPIURL();
|
||||||
|
url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = hostedBy) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
|
||||||
|
if(params!= null && params != '' ) {
|
||||||
|
url += params;
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+page+"&size="+size;
|
||||||
|
let key = url;
|
||||||
|
if (this._cache.has(key)) {
|
||||||
|
return Observable.of(this._cache.get(key));
|
||||||
|
}
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
//.do(res => console.info(res))
|
||||||
|
.map(res => this.parseResultsCSV(res['results']))
|
||||||
|
.do(res => {
|
||||||
|
this._cache.set(key, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
parseResults(data: any): SearchResult[] {
|
parseResults(data: any): SearchResult[] {
|
||||||
let results: SearchResult[] = [];
|
let results: SearchResult[] = [];
|
||||||
|
|
||||||
|
@ -190,9 +236,7 @@ export class SearchDataprovidersService {
|
||||||
result['title'].url = OpenaireProperties.getsearchLinkToDataProvider();
|
result['title'].url = OpenaireProperties.getsearchLinkToDataProvider();
|
||||||
result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||||
|
|
||||||
if(resData['datasourcetype'].hasOwnProperty("classname")) {
|
result['type'] = this.getDataproviderType(resData);
|
||||||
result['type'] = resData['datasourcetype'].classname;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(resData.hasOwnProperty('accessinfopackage')) {
|
if(resData.hasOwnProperty('accessinfopackage')) {
|
||||||
let OAIPMHURL: string;
|
let OAIPMHURL: string;
|
||||||
|
@ -209,46 +253,11 @@ export class SearchDataprovidersService {
|
||||||
|
|
||||||
result['websiteURL'] = resData.websiteurl;
|
result['websiteURL'] = resData.websiteurl;
|
||||||
|
|
||||||
if(resData['rels'].hasOwnProperty("rel")) {
|
let res:[string[], {"name":string, "url":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true);
|
||||||
let countriesSet: Set<string> = new Set<string>();
|
result['organizations'] = res[1];
|
||||||
|
result['countries'] = res[0];
|
||||||
|
|
||||||
let counter = 0;
|
result['compatibility'] = this.getDataproviderCompatibility(resData)
|
||||||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
|
||||||
|
|
||||||
for(let i=0; i<relLength; i++) {
|
|
||||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
|
|
||||||
|
|
||||||
if(relation.hasOwnProperty("to")) {
|
|
||||||
if(relation['to'].class == "provides" && relation['to'].type == "organization") {
|
|
||||||
if(result['organizations'] == undefined) {
|
|
||||||
result['organizations'] = new Array<{"name": string, "url": string}>();
|
|
||||||
}
|
|
||||||
|
|
||||||
result['organizations'][counter] = {"name": "", "url": ""};
|
|
||||||
result['organizations'][counter]['name'] = relation.legalname;
|
|
||||||
result['organizations'][counter]['url'] = OpenaireProperties.getsearchLinkToOrganization()+relation['to'].content;
|
|
||||||
|
|
||||||
if(relation.hasOwnProperty('country') &&
|
|
||||||
relation.country.hasOwnProperty('classname')) {
|
|
||||||
if(result['countries'] == undefined) {
|
|
||||||
result['countries'] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!countriesSet.has(relation.country.classname)) {
|
|
||||||
countriesSet.add(relation.country.classname);
|
|
||||||
result['countries'].push(relation.country.classname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(resData.hasOwnProperty('openairecompatibility')) {
|
|
||||||
result['compatibility'] = resData['openairecompatibility'].classname;
|
|
||||||
}
|
|
||||||
|
|
||||||
results.push(result);
|
results.push(result);
|
||||||
|
|
||||||
|
@ -257,36 +266,44 @@ export class SearchDataprovidersService {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDataproviderType(resData: any): string {
|
||||||
|
if(resData['datasourcetype'].hasOwnProperty("classname")) {
|
||||||
|
return resData['datasourcetype'].classname;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parseResultsCSV(data: any): any {
|
getDataproviderCompatibility(resData: any): string {
|
||||||
let results: any = [];
|
if(resData.hasOwnProperty('openairecompatibility')) {
|
||||||
|
return resData['openairecompatibility'].classname;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let length = Array.isArray(data) ? data.length : 1;
|
getDataproviderCountriesOrganizations(resData: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "url": string}[]] {
|
||||||
|
let countries: string[] = [];
|
||||||
|
let organizations: {"name": string, "url": string}[] = [];
|
||||||
|
|
||||||
for(let i=0; i<length; i++) {
|
if(resData['rels'].hasOwnProperty("rel")) {
|
||||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
|
let countriesSet: Set<string> = new Set<string>();
|
||||||
|
|
||||||
var result: any = [];
|
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||||
|
|
||||||
result.push(this.quote(resData.officialname));
|
for(let i=0; i<relLength; i++) {
|
||||||
|
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
|
||||||
|
|
||||||
if(resData['datasourcetype'].hasOwnProperty("classname")) {
|
if(relation.hasOwnProperty("to")) {
|
||||||
result.push(this.quote(resData['datasourcetype'].classname));
|
if(relation['to'].class == "provides" && relation['to'].type == "organization") {
|
||||||
} else {
|
if(getOrganizations) {
|
||||||
result.push('');
|
let item: {"name":string, "url":string} = {"name": "", "url": ""};
|
||||||
}
|
item['name'] = relation.legalname;
|
||||||
|
item['url'] = OpenaireProperties.getsearchLinkToOrganization()+relation['to'].content;
|
||||||
|
organizations.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
if(resData['rels'].hasOwnProperty("rel")) {
|
if(getCountries) {
|
||||||
let countries = [];
|
|
||||||
let countriesSet: Set<string> = new Set<string>();
|
|
||||||
|
|
||||||
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
|
||||||
|
|
||||||
for(let i=0; i<relLength; i++) {
|
|
||||||
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
|
|
||||||
|
|
||||||
if(relation.hasOwnProperty("to")) {
|
|
||||||
if(relation['to'].class == "provides" && relation['to'].type == "organization") {
|
|
||||||
if(relation.hasOwnProperty('country') &&
|
if(relation.hasOwnProperty('country') &&
|
||||||
relation.country.hasOwnProperty('classname')) {
|
relation.country.hasOwnProperty('classname')) {
|
||||||
if(!countriesSet.has(relation.country.classname)) {
|
if(!countriesSet.has(relation.country.classname)) {
|
||||||
|
@ -297,29 +314,32 @@ export class SearchDataprovidersService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.push(this.quote(countries));
|
|
||||||
} else {
|
|
||||||
result.push('');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(resData.hasOwnProperty('openairecompatibility')) {
|
|
||||||
result.push(this.quote(resData['openairecompatibility'].classname));
|
|
||||||
} else {
|
|
||||||
result.push('');
|
|
||||||
}
|
|
||||||
|
|
||||||
results.push(result);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
return [countries, organizations];
|
||||||
|
}
|
||||||
|
|
||||||
|
parseResultsCSV(data: any): any {
|
||||||
|
let results: any = [];
|
||||||
|
let length = Array.isArray(data) ? data.length : 1;
|
||||||
|
|
||||||
|
for(let i=0; i<length; i++) {
|
||||||
|
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
|
||||||
|
|
||||||
|
var result: any = [];
|
||||||
|
|
||||||
|
result.push(this.quote(resData.officialname));
|
||||||
|
result.push(this.quote(this.getDataproviderType(resData)));
|
||||||
|
result.push(this.quote(this.getDataproviderCountriesOrganizations(resData, true, false)[0]));
|
||||||
|
result.push(this.quote(this.getDataproviderCompatibility(resData)));
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
numOfDataproviders(params: string):any {
|
numOfDataproviders(params: string):any {
|
||||||
console.info("getOfDataproviders : Dataproviders Service + params="+params);
|
console.info("getOfDataproviders : Dataproviders Service + params="+params);
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURL()
|
|
||||||
//"http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/"
|
|
||||||
let url = OpenaireProperties.getSearchAPIURL()+params;
|
let url = OpenaireProperties.getSearchAPIURL()+params;
|
||||||
let key = url;
|
let key = url;
|
||||||
if (this._cache.has(key)) {
|
if (this._cache.has(key)) {
|
||||||
|
|
|
@ -99,12 +99,39 @@ export class SearchPublicationsService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchPublicationsCSV (params: string, refineParams:string, page: number, size: number):any {
|
||||||
|
|
||||||
|
let link = OpenaireProperties.getSearchAPIURL()+"publications";
|
||||||
|
|
||||||
|
let url = link+"?";
|
||||||
|
if(params!= null && params != '' ) {
|
||||||
|
url += params;
|
||||||
|
}
|
||||||
|
if(refineParams!= null && refineParams != '' ) {
|
||||||
|
url += refineParams;
|
||||||
|
}
|
||||||
|
url += "&page="+page+"&size="+size;
|
||||||
|
|
||||||
|
let key = url;
|
||||||
|
if (this._cache.has(key)) {
|
||||||
|
return Observable.of(this._cache.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.http.get(url)
|
||||||
|
.map(res => <any> res.json())
|
||||||
|
//.do(res => console.info(res))
|
||||||
|
.map(res => this.parseResultsCSV(res['results']))
|
||||||
|
.do(res => {
|
||||||
|
this._cache.set(key, res);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
parseResults(data: any): SearchResult[] {
|
parseResults(data: any): SearchResult[] {
|
||||||
let results: SearchResult[] = [];
|
let results: SearchResult[] = [];
|
||||||
|
|
||||||
let length = Array.isArray(data) ? data.length : 1;
|
let length = Array.isArray(data) ? data.length : 1;
|
||||||
console.info(Array.isArray(data));
|
|
||||||
for(let i=0; i<length; i++) {
|
for(let i=0; i<length; i++) {
|
||||||
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||||
|
|
||||||
|
@ -202,6 +229,95 @@ console.info(Array.isArray(data));
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseResultsCSV(data: any): any {
|
||||||
|
let results: any = [];
|
||||||
|
|
||||||
|
|
||||||
|
let length = Array.isArray(data) ? data.length : 1;
|
||||||
|
|
||||||
|
for(let i=0; i<length; i++) {
|
||||||
|
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
|
||||||
|
|
||||||
|
var result: any = [];
|
||||||
|
|
||||||
|
if(Array.isArray(resData['title'])) {
|
||||||
|
result.push(this.quote(resData['title'][0].content));
|
||||||
|
} else {
|
||||||
|
result.push(this.quote(resData['title'].content));
|
||||||
|
}
|
||||||
|
|
||||||
|
var authors: string[] = [];
|
||||||
|
var projects: string[] = [];
|
||||||
|
var funder: string = "";
|
||||||
|
if(resData['rels'].hasOwnProperty("rel")) {
|
||||||
|
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
|
||||||
|
|
||||||
|
for(let j=0; j<relLength; j++) {
|
||||||
|
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
|
||||||
|
|
||||||
|
if(relation.hasOwnProperty("to")) {
|
||||||
|
if(relation['to'].class == "hasAuthor") {
|
||||||
|
authors.push(relation.fullname);
|
||||||
|
} else if(relation['to'].class == "isProducedBy") {
|
||||||
|
if(relation.code != "") {
|
||||||
|
projects.push(relation.title+" ("+relation.code+")");
|
||||||
|
} else {
|
||||||
|
projects.push(relation.title);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(relation.hasOwnProperty("funding")) {
|
||||||
|
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
|
||||||
|
|
||||||
|
for(let z=0; z<fundingLength; z++) {
|
||||||
|
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||||
|
|
||||||
|
if(fundingData.hasOwnProperty("funder")) {
|
||||||
|
funder = fundingData['funder'].shortname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.push(this.quote(authors));
|
||||||
|
var year: string = "";
|
||||||
|
if(resData.hasOwnProperty("dateofacceptance")) {
|
||||||
|
year = resData.dateofacceptance;
|
||||||
|
}
|
||||||
|
result.push(year);
|
||||||
|
var id:string = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||||
|
result.push(this.quote(id));
|
||||||
|
result.push(funder);
|
||||||
|
result.push(this.quote(projects));
|
||||||
|
} else {
|
||||||
|
result.push(this.quote(''));
|
||||||
|
var year: string = "";
|
||||||
|
if(resData.hasOwnProperty("dateofacceptance")) {
|
||||||
|
year = resData.dateofacceptance;
|
||||||
|
}
|
||||||
|
result.push(year);
|
||||||
|
var id:string = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
|
||||||
|
result.push(this.quote(id));
|
||||||
|
result.push(funder);
|
||||||
|
result.push("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//result.push(resData.embargoenddate);
|
||||||
|
|
||||||
|
if(resData['bestlicense'].hasOwnProperty("classid")) {
|
||||||
|
result.push(this.quote(resData['bestlicense'].classid));
|
||||||
|
} else {
|
||||||
|
result.push("");
|
||||||
|
}
|
||||||
|
|
||||||
|
results.push(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
numOfEntityPublications(id: string, entity: string):any {
|
numOfEntityPublications(id: string, entity: string):any {
|
||||||
|
|
||||||
//OpenaireProperties.getSearchAPIURL()
|
//OpenaireProperties.getSearchAPIURL()
|
||||||
|
@ -233,4 +349,8 @@ console.info(Array.isArray(data));
|
||||||
this._cache.set(key, res);
|
this._cache.set(key, res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private quote(word: any): string {
|
||||||
|
return '"'+word+'"';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue