From 00e6d479e9adb1aa1238c10607f4556e900b6024 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 15 Sep 2017 10:19:14 +0000 Subject: [PATCH] Remove unnecessary functions for csv download in search services and components -- currently 'exportCSV.class.ts' file not used and will be deleted soon git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48972 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../dataProvider/dataProvider.component.ts | 1 - .../publication/publication.component.ts | 5 - .../compatibleDataProviders.component.ts | 32 ------ .../compatibleDataProvidersTable.component.ts | 31 ------ .../entityRegistries.component.ts | 33 ------ .../entityRegistriesTable.component.ts | 43 -------- .../dataProviders/journals.component.ts | 32 ------ .../dataProviders/journalsTable.component.ts | 29 ----- .../searchUtils/searchDownload.component.ts | 11 -- .../searchUtils/searchPage.component.ts | 13 +-- .../simple/searchDataproviders.component.ts | 51 +-------- .../simple/searchPublications.component.ts | 35 +----- .../services/searchDataproviders.service.ts | 17 +-- .../app/services/searchDatasets.service.ts | 102 +++++++++-------- .../services/searchPublications.service.ts | 103 ++++++++++-------- .../fetchDataproviders.class.ts | 51 --------- 16 files changed, 128 insertions(+), 461 deletions(-) diff --git a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts index 72b5fe64..e03bccf9 100644 --- a/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts +++ b/portal-2/src/app/landingPages/dataProvider/dataProvider.component.ts @@ -117,7 +117,6 @@ export class DataProviderComponent { this.element.nativeElement.scrollIntoView(); } }); - } ngOnDestroy() { diff --git a/portal-2/src/app/landingPages/publication/publication.component.ts b/portal-2/src/app/landingPages/publication/publication.component.ts index 06763c16..01b31ec5 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.ts +++ b/portal-2/src/app/landingPages/publication/publication.component.ts @@ -184,11 +184,6 @@ export class PublicationComponent { ); } - public downloadClicked($event) { - this.totalViews = $event.totalViews; - this.totalDownloads = $event.totalDownloads; - } - public metricsResults($event) { this.totalViews = $event.totalViews; this.totalDownloads = $event.totalDownloads; diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts index d4258d0e..c80d9a50 100644 --- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.component.ts @@ -9,7 +9,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; @Component({ selector: 'search-content-providers', @@ -21,7 +20,6 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class'; [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" - (downloadClick)="downloadClicked($event)" [csvParams]="csvParams" csvPath="resources" [disableForms]="disableForms" [tableViewLink]="'/search/content-providers-table'" @@ -176,34 +174,4 @@ export class SearchCompatibleDataprovidersComponent { } return filters; } - - public 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.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; - } - ); - } - } - } diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts index e58db21f..e6c85963 100644 --- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProvidersTable.component.ts @@ -9,7 +9,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; @Component({ selector: 'search-content-providers-table', @@ -23,8 +22,6 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class'; [searchViewLink]="'/search/content-providers'" searchFormClass="compatibleDatasourcesTableSearchForm" formPlaceholderText="Search for OpenAIRE Content Providers"> - - ` @@ -179,32 +176,4 @@ export class SearchCompatibleDataprovidersTableComponent { } return filters; } -/* - public downloadClicked($event) { - if(!this.CSVDownloaded) { - this.CSVDownloaded = false; - - var parameters = $event.value; - - 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.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; - } - ); - } - } -*/ } diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts index 095b06c0..ba082d12 100644 --- a/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries.component.ts @@ -9,7 +9,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; @Component({ selector: 'search-entity-registries', @@ -21,7 +20,6 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class'; [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" - (downloadClick)="downloadClicked($event)" [csvParams]="csvParams" csvPath="resources" [disableForms]="disableForms" [tableViewLink]="'/search/entity-registries-table'" @@ -167,35 +165,4 @@ export class SearchEntityRegistriesComponent { } return filters; } - - - - public 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.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; - } - ); - } - } } diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts index 5134de3e..255cab62 100644 --- a/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/entityRegistriesTable.component.ts @@ -9,7 +9,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; @Component({ selector: 'search-entity-registries-table', @@ -37,14 +36,6 @@ export class SearchEntityRegistriesTableComponent { public _location:Location; public searchFields:SearchFields = new SearchFields(); public refineFields: string[] = this.searchFields.ENTITY_REGISTRIES_FIELDS; - - /*public CSV: any = { "columnNames": [ "Title", "Type", "Coutries", "Compatibility" ], - "export":[] - }; - public CSVDownloaded = false; - public resourcesQuery = "&query=((oaftype exact datasource) and(datasourcetypeuiid = other))"; - public csvParams: string; - */ public disableForms: boolean = false; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; @@ -74,8 +65,6 @@ export class SearchEntityRegistriesTableComponent { this.subResults.unsubscribe(); } } private _getResults(parameters:string,refine:boolean, page: number){ - //this.csvParams = parameters+this.resourcesQuery+"&type=datasources"; - var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = errorCodes.LOADING; this.disableForms = true; @@ -197,36 +186,4 @@ export class SearchEntityRegistriesTableComponent { } return filters; } - - -/* - public 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.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; - } - ); - } - } -*/ } diff --git a/portal-2/src/app/searchPages/dataProviders/journals.component.ts b/portal-2/src/app/searchPages/dataProviders/journals.component.ts index 13e7cd72..b9f2dbcd 100644 --- a/portal-2/src/app/searchPages/dataProviders/journals.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/journals.component.ts @@ -9,7 +9,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; @Component({ selector: 'search-journals', @@ -21,7 +20,6 @@ import {ExportCSVComponent} from '../../utils/exportCSV.class'; [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" [showResultCount]=false (queryChange)="queryChanged($event)" - (downloadClick)="downloadClicked($event)" [csvParams]="csvParams" csvPath="resources" [disableForms]="disableForms" [tableViewLink]="'/search/journals-table'" @@ -170,34 +168,4 @@ export class SearchJournalsComponent { } return filters; } - - public 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.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; - } - ); - } - } - } diff --git a/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts b/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts index c5e0074e..15000828 100644 --- a/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts +++ b/portal-2/src/app/searchPages/dataProviders/journalsTable.component.ts @@ -9,7 +9,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageTableViewComponent } from '../searchUtils/searchPageTableView.component'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; @Component({ selector: 'search-journals-table', @@ -172,32 +171,4 @@ export class SearchJournalsTableComponent { } return filters; } -/* - public downloadClicked($event) { - if(!this.CSVDownloaded) { - this.CSVDownloaded = false; - - var parameters = $event.value; - - 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.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; - } - ); - } - } -*/ } diff --git a/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts b/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts index a1ba68d0..8814c41c 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchDownload.component.ts @@ -10,7 +10,6 @@ import {PiwikService} from '../../utils/piwik/piwik.service'; selector: 'search-download', template: ` - (CSV) @@ -26,7 +25,6 @@ export class SearchDownloadComponent { @Input() csvParams: string; @Input() type: string; @ViewChild(AlertModal) alertApplyAll; - @Output() downloadClick = new EventEmitter(); private downloadURLAPI: string; sub: any; @@ -49,15 +47,6 @@ export class SearchDownloadComponent { } } - confirmClose(data){ - - } - download() { - this.downloadClick.emit({ - value: true - }); - } - denialOfDownload() { this.alertApplyAll.isOpen = true; this.alertApplyAll.cancelButton = true; diff --git a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts index 52bd65f9..3d41b364 100644 --- a/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts +++ b/portal-2/src/app/searchPages/searchUtils/searchPage.component.ts @@ -106,7 +106,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service'; - + @@ -135,7 +135,6 @@ export class SearchPageComponent { @Input() entityType: string = ""; @Input() searchUtils:SearchUtilsClass = new SearchUtilsClass(); @Output() queryChange = new EventEmitter(); - @Output() downloadClick = new EventEmitter(); @Input() baseUrl:string = ''; @Input() showResultCount:boolean = true; @Input() showRefine:boolean = true; @@ -554,16 +553,6 @@ export class SearchPageComponent { this.goTo(1); } - downloadClicked($event) { - if($event.value == true) { - var queryParameters = this.createSearchQueryParameters(this.filters); - - this.downloadClick.emit({ - value: queryParameters - }); - } - } - /* * Get A sub-array of this.refineFields array, which contains the ids of the selected filters */ diff --git a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts index a249dddd..1b0da1cd 100644 --- a/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/portal-2/src/app/searchPages/simple/searchDataproviders.component.ts @@ -7,7 +7,6 @@ import {SearchResult} from '../../utils/entities/searchResult'; import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openaireProperties'; import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; @Component({ @@ -18,7 +17,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class'; formPlaceholderText = "Search for Content Providers" type="content providers" entityType="dataprovider" [(filters)] = "filters" [(results)] = "results" [(searchUtils)] = "searchUtils" [baseUrl] = "baseUrl" - (queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)" + (queryChange)="queryChanged($event)" [csvParams]="csvParams" csvPath="datasources" advancedSearchLink="/search/advanced/dataproviders" [disableForms]="disableForms" searchFormClass="datasourcesSearchForm"> @@ -301,52 +300,4 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number) var parameters = $event.value; this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size); } - - public downloadClicked($event) { - if(!this.CSVDownloaded) { - this.CSVDownloaded = false; - - var parameters = $event.value; - - //this.getResultsCSV(parameters, false, 1, 1000); - - this._searchDataprovidersService.searchDataprovidersCSV(parameters, this.searchPage.getRefineFieldsQuery(), 1, 1000).subscribe( - data => { - this.CSV.export = data; - ExportCSVComponent.downloadCSV(this.CSV, "content_providers.csv"); - - 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; - } - ); - /* - this.CSV.export.push( - [ - this.quote(project.name), - this.quote(project.acronym), - this.quote(project.code), - this.quote(project.funder), - this.quote(project.fundingStream), - this.quote(project.fundingLevel1), - this.quote(project.fundingLevel2), - this.quote(project.sc39), - this.quote(project.startDate), - this.quote(project.endDate) - ]); - }*/ - } - } - } diff --git a/portal-2/src/app/searchPages/simple/searchPublications.component.ts b/portal-2/src/app/searchPages/simple/searchPublications.component.ts index 6a9a0931..466c38f0 100644 --- a/portal-2/src/app/searchPages/simple/searchPublications.component.ts +++ b/portal-2/src/app/searchPages/simple/searchPublications.component.ts @@ -10,7 +10,6 @@ import {OpenaireProperties, ErrorCodes} from '../../utils/properties/openairePro import {SearchFields} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; import {SearchUtilsClass} from '../searchUtils/searchUtils.class'; -import {ExportCSVComponent} from '../../utils/exportCSV.class'; import {DOI} from '../../utils/string-utils.class'; @Component({ @@ -22,8 +21,9 @@ import {DOI} from '../../utils/string-utils.class'; type="publications" entityType="publication" [(filters)] = "filters" [(results)] = "results" [(searchUtils)] = "searchUtils" [(baseUrl)] = baseUrl - (queryChange)="queryChanged($event)" (downloadClick)="downloadClicked($event)" - [csvParams]="csvParams" csvPath="publications" advancedSearchLink="/search/advanced/publications" + (queryChange)="queryChanged($event)" + [csvParams]="csvParams" csvPath="publications" + advancedSearchLink="/search/advanced/publications" [disableForms]="disableForms" searchFormClass="publicationsSearchForm"> @@ -269,34 +269,5 @@ public getAggregatorResults(id:string, page: number, size: number){ this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size); } - public 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.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; - } - ); - - } - } } diff --git a/portal-2/src/app/services/searchDataproviders.service.ts b/portal-2/src/app/services/searchDataproviders.service.ts index 4e5d8251..ea622c6f 100644 --- a/portal-2/src/app/services/searchDataproviders.service.ts +++ b/portal-2/src/app/services/searchDataproviders.service.ts @@ -274,7 +274,7 @@ export class SearchDataprovidersService { }) .map(res => [res['meta'].total, this.parseResults(res['results'])]); } - +/* searchDataprovidersCSV (params: string, refineParams:string, page: number, size: number):any { let link = OpenaireProperties. getSearchAPIURLLast()+"datasources"; @@ -300,7 +300,8 @@ export class SearchDataprovidersService { }) .map(res => this.parseResultsCSV(res['results'])); } - +*/ +/* searchEntityRegistriesCSV (params: string,refineParams:string, page: number, size: number):any { let url = OpenaireProperties.getSearchResourcesAPIURL(); url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))" @@ -323,7 +324,8 @@ export class SearchDataprovidersService { }) .map(res => this.parseResultsCSV(res['results'])); } - +*/ +/* searchCompatibleDataprovidersCSV (params: string,refineParams:string, page: number, size: number):any { let url = OpenaireProperties.getSearchResourcesAPIURL(); url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))" @@ -346,7 +348,7 @@ export class SearchDataprovidersService { }) .map(res => this.parseResultsCSV(res['results'])); } - +*/ parseResults(data: any): SearchResult[] { @@ -467,7 +469,7 @@ export class SearchDataprovidersService { } return [countries, organizations]; } - +/* parseResultsCSV(data: any): any { let results: any = []; let length = Array.isArray(data) ? data.length : 1; @@ -485,7 +487,7 @@ export class SearchDataprovidersService { } return results; } - +*/ numOfDataproviders(url: string):any { //let url = OpenaireProperties. getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json"; let key = url; @@ -518,8 +520,9 @@ export class SearchDataprovidersService { return this.numOfDataproviders(url); } - +/* private quote(word: any): string { return '"'+word+'"'; } +*/ } diff --git a/portal-2/src/app/services/searchDatasets.service.ts b/portal-2/src/app/services/searchDatasets.service.ts index a3ef6d91..3e203c20 100644 --- a/portal-2/src/app/services/searchDatasets.service.ts +++ b/portal-2/src/app/services/searchDatasets.service.ts @@ -197,54 +197,13 @@ export class SearchDatasetsService { if(relation.hasOwnProperty("to")) { if(relation['to'].class == "hasAuthor") { - if(result['authors'] == undefined) { - result['authors'] = new Array<{"name": string, "id": string}>(); - } + if(result['authors'] == undefined) { + result['authors'] = new Array<{"name": string, "id": string}>(); + } - result['authors'].push({"name": relation.fullname, "id": /*OpenaireProperties.getsearchLinkToPerson()+*/relation['to'].content}); + result['authors'].push({"name": relation.fullname, "id": relation['to'].content}); } else if(relation['to'].class == "isProducedBy") { - if(result['projects'] == undefined) { - result['projects'] = new Array< - { "id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "code": string - }>(); - } - - let countProjects = result['projects'].length; - - result['projects'][countProjects] = { - "id": "", "acronym": "", "title": "", - "funderShortname": "", "funderName": "", - "code": "" - } - - if(relation.title != 'unidentified') { - result['projects'][countProjects]['id'] = - /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; - result['projects'][countProjects]['acronym'] = relation.acronym; - result['projects'][countProjects]['title'] = relation.title; - result['projects'][countProjects]['code'] = relation.code; - } else { - result['projects'][countProjects]['id'] = ""; - result['projects'][countProjects]['acronym'] = ""; - result['projects'][countProjects]['title'] = ""; - result['projects'][countProjects]['code'] = ""; - } - - if(relation.hasOwnProperty("funding")) { - let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; - - for(let z=0; z(); + } + + let countProjects = projects.length; + + projects[countProjects] = { + "id": "", "acronym": "", "title": "", + "funderShortname": "", "funderName": "", + "code": "" + } + + if(relation.title != 'unidentified') { + projects[countProjects]['id'] = + /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; + projects[countProjects]['acronym'] = relation.acronym; + projects[countProjects]['title'] = relation.title; + projects[countProjects]['code'] = relation.code; + } else { + projects[countProjects]['id'] = ""; + projects[countProjects]['acronym'] = ""; + projects[countProjects]['title'] = ""; + projects[countProjects]['code'] = ""; + } + + if(relation.hasOwnProperty("funding")) { + let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; + + for(let z=0; z [res['meta'].total, this.parseResults(res['results'])]); } - +/* searchPublicationsCSV (params: string, refineParams:string, page: number, size: number):any { let link = OpenaireProperties.getSearchAPIURLLast()+"publications"; @@ -198,7 +198,7 @@ export class SearchPublicationsService { }) .map(res => this.parseResultsCSV(res['results'])); } - +*/ parseResults(data: any): SearchResult[] { let results: SearchResult[] = []; @@ -243,48 +243,7 @@ export class SearchPublicationsService { result['authors'].push({"name": relation.fullname, "id": /*OpenaireProperties.getsearchLinkToPerson()+*/relation['to'].content}); } else if(relation['to'].class == "isProducedBy") { - if(result['projects'] == undefined) { - result['projects'] = new Array< - { "id": string, "acronym": string, "title": string, - "funderShortname": string, "funderName": string, - "code": string - }>(); - } - - let countProjects = result['projects'].length; - - result['projects'][countProjects] = { - "id": "", "acronym": "", "title": "", - "funderShortname": "", "funderName": "", - "code": "" - } - - if(relation.title != 'unidentified') { - result['projects'][countProjects]['id'] = - /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; - result['projects'][countProjects]['acronym'] = relation.acronym; - result['projects'][countProjects]['title'] = relation.title; - result['projects'][countProjects]['code'] = relation.code; - } else { - result['projects'][countProjects]['id'] = ""; - result['projects'][countProjects]['acronym'] = ""; - result['projects'][countProjects]['title'] = ""; - result['projects'][countProjects]['code'] = ""; - } - - if(relation.hasOwnProperty("funding")) { - let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; - - for(let z=0; z(); + } + + let countProjects = projects.length; + + projects[countProjects] = { + "id": "", "acronym": "", "title": "", + "funderShortname": "", "funderName": "", + "code": "" + } + + if(relation.title != 'unidentified') { + projects[countProjects]['id'] = + /*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content; + projects[countProjects]['acronym'] = relation.acronym; + projects[countProjects]['title'] = relation.title; + projects[countProjects]['code'] = relation.code; + } else { + projects[countProjects]['id'] = ""; + projects[countProjects]['acronym'] = ""; + projects[countProjects]['title'] = ""; + projects[countProjects]['code'] = ""; + } + + if(relation.hasOwnProperty("funding")) { + let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1; + + for(let z=0; z { - this.CSV.export = data; - ExportCSVComponent.downloadCSV(this.CSV, "content_providers.csv"); - - 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; - } - ); - /* - this.CSV.export.push( - [ - this.quote(project.name), - this.quote(project.acronym), - this.quote(project.code), - this.quote(project.funder), - this.quote(project.fundingStream), - this.quote(project.fundingLevel1), - this.quote(project.fundingLevel2), - this.quote(project.sc39), - this.quote(project.startDate), - this.quote(project.endDate) - ]); - }*/ - } - } - }