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
This commit is contained in:
parent
16123df09d
commit
00e6d479e9
|
@ -117,7 +117,6 @@ export class DataProviderComponent {
|
|||
this.element.nativeElement.scrollIntoView();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
|
||||
|
||||
</search-page-table>
|
||||
`
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
|
|||
selector: 'search-download',
|
||||
template: `
|
||||
<span class="uk-margin-large-right" *ngIf="totalResults <= 10000">
|
||||
<!--a (click)="download()" href="{{downloadURLAPI}}{{type}}?format=csv&page=0&size={{totalResults}}{{csvParams}}" -->
|
||||
<span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type+'-report-'+totalResults)">
|
||||
<span aria-hidden="true" class="glyphicon glyphicon-download"></span>
|
||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="download" ratio="1"><polyline fill="none" stroke="#000" points="14,10 9.5,14.5 5,10"></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="13.91" x2="9.5" y2="3"></line></svg></span> (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;
|
||||
|
|
|
@ -106,7 +106,7 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
|
|||
|
||||
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="table" ratio="1"><rect x="1" y="3" width="18" height="1"></rect><rect x="1" y="7" width="18" height="1"></rect><rect x="1" y="11" width="18" height="1"></rect><rect x="1" y="15" width="18" height="1"></rect></svg></span>
|
||||
</span>
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" (downloadClick)="downloadClicked($event)"></search-download>
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
|
||||
|
||||
|
||||
</div>
|
||||
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
]);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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">
|
||||
</search-page>
|
||||
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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+'"';
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -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<fundingLength; z++) {
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
result['projects'][countProjects]['funderName'] = fundingData['funder'].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result['projects'] = this.parseProjects(result['projects'], relation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,6 +240,57 @@ export class SearchDatasetsService {
|
|||
return results;
|
||||
}
|
||||
|
||||
parseProjects(projects: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string }[], relation: any ) : {
|
||||
"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string }[] {
|
||||
if(projects == undefined) {
|
||||
projects = new Array<
|
||||
{ "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string
|
||||
}>();
|
||||
}
|
||||
|
||||
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<fundingLength; z++) {
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
projects[countProjects]['funderName'] = fundingData['funder'].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return projects;
|
||||
}
|
||||
|
||||
parseRefineResults(id: string, data: any): any {
|
||||
var results:any = [];
|
||||
if(data.hasOwnProperty("resulthostingdatasource")) {
|
||||
|
|
|
@ -171,7 +171,7 @@ export class SearchPublicationsService {
|
|||
})
|
||||
.map(res => [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<fundingLength; z++) {
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
result['projects'][countProjects]['funderName'] = fundingData['funder'].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result['projects'] = this.parseProjects(result['projects'], relation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,6 +270,57 @@ export class SearchPublicationsService {
|
|||
return results;
|
||||
}
|
||||
|
||||
parseProjects(projects: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string }[], relation: any ) : {
|
||||
"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string }[] {
|
||||
if(projects == undefined) {
|
||||
projects = new Array<
|
||||
{ "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"code": string
|
||||
}>();
|
||||
}
|
||||
|
||||
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<fundingLength; z++) {
|
||||
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname;
|
||||
projects[countProjects]['funderName'] = fundingData['funder'].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return projects;
|
||||
}
|
||||
/*
|
||||
parseResultsCSV(data: any): any {
|
||||
let results: any = [];
|
||||
|
||||
|
@ -399,7 +409,7 @@ export class SearchPublicationsService {
|
|||
|
||||
return results;
|
||||
}
|
||||
|
||||
*/
|
||||
parseRefineResults(id: string, data: any): any {
|
||||
var results:any = [];
|
||||
if(data.hasOwnProperty("resulthostingdatasource")) {
|
||||
|
@ -451,8 +461,9 @@ export class SearchPublicationsService {
|
|||
}
|
||||
return this.numOfPublications(url);
|
||||
}
|
||||
|
||||
/*
|
||||
private quote(word: any): string {
|
||||
return '"'+word+'"';
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {SearchDataprovidersService} from '../../services/searchDataproviders.service';
|
||||
import { ErrorCodes} from '../../utils/properties/openaireProperties';
|
||||
import {ExportCSVComponent} from '../../utils/exportCSV.class';
|
||||
import {SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
|
||||
|
||||
export class FetchDataproviders {
|
||||
|
@ -238,54 +237,4 @@ public getResultsBySubjectsForDeposit(subject:string, type:string, page: number,
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public downloadClicked($event) {
|
||||
if(!this.CSVDownloaded) {
|
||||
this.CSVDownloaded = false;
|
||||
|
||||
var parameters = $event.value;
|
||||
|
||||
//this.getResultsCSV(parameters, false, 1, 1000);
|
||||
|
||||
this._searchDataprovidersService.searchDataprovidersCSV(parameters, "", 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)
|
||||
]);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue