Paging in search and advanced search pages limited to 20 (defined in OpenaireProperties file) | Csv and Html requests (currently on local machine rudie) changed - no size, no page parameters in requests | Limit for csv (defined in OpenaireProperties file) changed to 2000
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@50185 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
4acc78f007
commit
8d8b85ad6b
|
@ -156,8 +156,13 @@ export class HtmlProjectReportComponent{
|
|||
if (typeof window !== 'undefined') {
|
||||
this.subHTML = this.htmlService.getHTML(this.projectId, this.totalResults, this.resultsType).subscribe(
|
||||
data => {
|
||||
let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>'+data+'</body></html>';
|
||||
this.htmlResult = data;
|
||||
//let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>'+data+'</body></html>';
|
||||
let body: string = intro+'<body><h1>'+this.header1+'</h1><h2>'+this.header2+'</h2>';
|
||||
body += "<table><thead><tr> <th>Title</th><th>Authors</th><th>Publication Year</th><th>DOI</th><th>Permanent Identifier</th><th>Publication type</th><th>Journal</th><th>Project Name (GA Number)</th><th>Access Mode</th></tr></thead><tbody>"+data+"</tbody></table>";
|
||||
body += '</body></html>';
|
||||
|
||||
//this.htmlResult = data;
|
||||
this.htmlResult = "<table><thead><tr> <th>Title</th><th>Authors</th><th>Publication Year</th><th>DOI</th><th>Permanent Identifier</th><th>Publication type</th><th>Journal</th><th>Project Name (GA Number)</th><th>Access Mode</th></tr></thead><tbody>"+data+"</tbody></table>";
|
||||
|
||||
let clipboard;
|
||||
let Clipboard;
|
||||
|
|
|
@ -27,7 +27,9 @@ export class HtmlProjectReportService {
|
|||
|
||||
//let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
|
||||
let url = OpenaireProperties.getCsvAPIURL();
|
||||
url += 'resources?format=html&page=0&size='+size+'&type='+requestType+'&query=(((oaftype exact result) and (resulttypeid exact '+resultTypeId+')) and (relprojectid exact "'+id+'"))';
|
||||
//url += 'resources?format=html&page=0&size='+size+'&type='+requestType+'&query=(((oaftype exact result) and (resulttypeid exact '+resultTypeId+')) and (relprojectid exact "'+id+'"))';
|
||||
url += '?format=html&type='+requestType+'&fq=(((oaftype exact result) and (resulttypeid exact '+resultTypeId+')) and (relprojectid exact "'+id+'"))';
|
||||
|
||||
let key = url;
|
||||
|
||||
return this.http.get(url)
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<!--a href="{{downloadURLAPI}}resources?size={{organizationInfo.projects.get(key).length}}&{{csvProjectParamsHead}}{{organizationInfo.projects.get(key)[0]['funderId']}}{{csvParamsTail}}">
|
||||
Download projects report (CSV) for {{key}}
|
||||
</a-->
|
||||
<a class="clickable" (click)="downloadFile(downloadURLAPI+'resources?size='+funder.number+'&'+csvProjectParamsHead+encodeURI(funder.id)+csvParamsTail)">
|
||||
<a class="clickable" (click)="downloadFile(downloadURLAPI+'?'+csvProjectParamsHead+encodeURI(funder.id)+csvParamsTail)">
|
||||
<!--span class="clickable" (click)="downloadProjectsFile(downloadURLAPI+'organizations/'+organizationId+'/projects?fq=(funderid exact '+funder.id+')&size='+funder.number)"-->
|
||||
<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>
|
||||
<span class="uk-icon-download"> Project list for {{funder.name}} (CSV)</span>
|
||||
|
@ -175,7 +175,10 @@
|
|||
</li>
|
||||
</ng-container>
|
||||
<li>
|
||||
<a class="clickable" (click)="downloadFile(downloadURLAPI+'organizations/'+organizationId+'/publications?format=csv')">
|
||||
<!-- url = this.downloadURLAPI+"format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))"-->
|
||||
|
||||
<!-- <a class="clickable" (click)="downloadFile(downloadURLAPI+'/organizations/'+organizationId+'?type=publications&format=csv')"> -->
|
||||
<a class="clickable" (click)="downloadFile(downloadURLAPI+'?format=csv&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relorganizationid exact '+organizationId+'))')">
|
||||
<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>
|
||||
<span class="uk-icon-download"> Publications of organization (CSV) - based on the affiliation information.</span>
|
||||
</a>
|
||||
|
|
|
@ -131,7 +131,7 @@ export class OrganizationComponent {
|
|||
});
|
||||
|
||||
this.downloadURLAPI = OpenaireProperties.getCsvAPIURL();
|
||||
this.csvProjectParamsHead = 'format=csv&type=projects&page=0&query=( (oaftype exact project)and (funder exact "';
|
||||
this.csvProjectParamsHead = 'format=csv&type=projects&fq=( (oaftype exact project)and (funder exact "';
|
||||
//this.csvPublicationParamsHead = 'format=csv-special&type=publications&page=0&query=((((oaftype exact result) and (resulttypeid exact publication)) and (funderid exact ';
|
||||
}
|
||||
|
||||
|
@ -328,13 +328,16 @@ export class OrganizationComponent {
|
|||
// let index: number = this.organizationInfo.projects.get(funder).indexOf(project);
|
||||
|
||||
let url: string;
|
||||
if(index == 0 || !title) {
|
||||
url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special&size="+data;
|
||||
if(!title) {
|
||||
//url = this.downloadURLAPI+"projects/"+projects[index].id+"?type=publications&format=csv-special";//&size="+data;
|
||||
url = this.downloadURLAPI+"?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))"
|
||||
console.info(url);
|
||||
} else {
|
||||
url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special-notitle&size="+data;
|
||||
//url = this.downloadURLAPI+"projects/"+projects[index].id+"/publications?format=csv-special-notitle";//&size="+data;
|
||||
url = this.downloadURLAPI+"?format=csv-special-notitle&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact '"+projects[index].id+"'))"
|
||||
}
|
||||
|
||||
if(data == 0) { // if no publications for this project
|
||||
if(data == 0 && (counter > 1 || title)) { // if no publications for this project
|
||||
counter--;
|
||||
response[index] = "";
|
||||
if(counter == 0) {
|
||||
|
|
|
@ -323,7 +323,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParams+fetchPublications.searchUtils.totalResults)">
|
||||
<a class="clickable" (click)="downloadfile(downloadURLAPI+csvParams)">
|
||||
<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> Get {{projectInfo.funder}} report (CSV)
|
||||
</a>
|
||||
</li>
|
||||
|
@ -356,7 +356,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="clickable" (click)="downloadfile(downloadURLAPI+'resources?'+csvParamsDatasets+fetchDatasets.searchUtils.totalResults)">
|
||||
<a class="clickable" (click)="downloadfile(downloadURLAPI+csvParamsDatasets)">
|
||||
<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> Get {{projectInfo.funder}} report (CSV)
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -152,9 +152,9 @@ export class ProjectComponent{
|
|||
this.downloadURLAPI = OpenaireProperties.getCsvAPIURL();
|
||||
|
||||
this.createClipboard();
|
||||
this.csvParams = "format=csv-special&page=0&type=publications&query=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))&size=";
|
||||
this.csvParamsDatasets = "format=csv-special&page=0&type=datasets&query=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))&size=";
|
||||
this.csvParamsSoftware = "format=csv-special&page=0&type=software&query=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact "+this.projectId+"))&size=";
|
||||
this.csvParams = "?format=csv-special&type=publications&fq=(((oaftype exact result) and (resulttypeid exact publication)) and (relprojectid exact "+this.projectId+"))";
|
||||
this.csvParamsDatasets = "?format=csv-special&type=datasets&fq=(((oaftype exact result) and (resulttypeid exact dataset)) and (relprojectid exact "+this.projectId+"))";
|
||||
this.csvParamsSoftware = "?format=csv-special&type=software&fq=(((oaftype exact result) and (resulttypeid exact software)) and (relprojectid exact "+this.projectId+"))";
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
this.element.nativeElement.scrollIntoView();
|
||||
|
|
|
@ -20,7 +20,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
|||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
[(searchUtils)] = "searchUtils"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/dataproviders"
|
||||
[csvParams]="csvParams" csvPath="datasources" simpleSearchLink="/search/find/dataproviders"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
[oldTotalResults]="oldTotalResults">
|
||||
|
@ -78,22 +78,26 @@ export class AdvancedSearchDataProvidersComponent {
|
|||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
if(parameters!= null && parameters != '' ) {
|
||||
this.csvParams ="&type=datasources&query=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
}else{
|
||||
this.csvParams ="&type=datasources&query="+this.resourcesQuery;
|
||||
this.csvParams ="&fq="+this.resourcesQuery;
|
||||
}
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
console.info("Advanced Search for Content Providers: Execute search query "+parameters);
|
||||
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe(
|
||||
data => {
|
||||
console.info("Advanced Search for Content Providers: Execute search query "+parameters);
|
||||
this._searchDataProvidersService.advancedSearchDataproviders(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("Adv Search Content Providers total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
|
@ -117,32 +121,33 @@ export class AdvancedSearchDataProvidersComponent {
|
|||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
|
|
|
@ -19,7 +19,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
|||
[(searchUtils)] = "searchUtils"
|
||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/datasets"
|
||||
[csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
[oldTotalResults]="oldTotalResults">
|
||||
|
@ -82,67 +82,72 @@ export class AdvancedSearchDatasetsComponent {
|
|||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
if(parameters!= null && parameters != '' ) {
|
||||
this.csvParams ="&type=datasets&query=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
}else{
|
||||
this.csvParams ="&type=datasets&query="+this.resourcesQuery;
|
||||
this.csvParams ="&fq="+this.resourcesQuery;
|
||||
}
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
console.info("Advanced Search for Research Data: Execute search query "+parameters);
|
||||
this._searchDatasetsService.advancedSearchDatasets(parameters, page, size).subscribe(
|
||||
console.info("Advanced Search for Research Data: Execute search query "+parameters);
|
||||
this._searchDatasetsService.advancedSearchDatasets(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Research Data total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Research Data total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
|
@ -150,7 +155,7 @@ export class AdvancedSearchDatasetsComponent {
|
|||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
|
|
|
@ -19,7 +19,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
|||
[(searchUtils)] = "searchUtils"
|
||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/organizations"
|
||||
[csvParams]="csvParams" csvPath="organizations" simpleSearchLink="/search/find/organizations"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
[oldTotalResults]="oldTotalResults">
|
||||
|
@ -82,21 +82,25 @@ public resourcesQuery = "(oaftype exact organization)";
|
|||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
if(parameters!= null && parameters != '' ) {
|
||||
this.csvParams ="&type=organizations&query=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
}else{
|
||||
this.csvParams ="&type=organizations&query="+this.resourcesQuery;
|
||||
this.csvParams ="&fq="+this.resourcesQuery;
|
||||
}
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
console.info("Advanced Search for Organizations: Execute search query "+parameters);
|
||||
this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size).subscribe(
|
||||
console.info("Advanced Search for Organizations: Execute search query "+parameters);
|
||||
this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Organizations total="+this.searchUtils.totalResults);
|
||||
|
@ -142,7 +146,8 @@ public resourcesQuery = "(oaftype exact organization)";
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
|
@ -150,7 +155,7 @@ public resourcesQuery = "(oaftype exact organization)";
|
|||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
|
|
|
@ -18,7 +18,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
|||
[(searchUtils)] = "searchUtils"
|
||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/projects"
|
||||
[csvParams]="csvParams" csvPath="projects" simpleSearchLink="/search/find/projects"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
[oldTotalResults]="oldTotalResults">
|
||||
|
@ -82,68 +82,73 @@ export class AdvancedSearchProjectsComponent {
|
|||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
if(parameters!= null && parameters != '' ) {
|
||||
this.csvParams ="&type=projects&query=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
}else{
|
||||
this.csvParams ="&type=projects&query="+this.resourcesQuery;
|
||||
this.csvParams ="&fq="+this.resourcesQuery;
|
||||
}
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
console.info("Advanced Search for Publications: Execute search query "+parameters);
|
||||
this._searchProjectsService.advancedSearchProjects(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("Advanced Search for Projects total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
console.info("Advanced Search for Publications: Execute search query "+parameters);
|
||||
this._searchProjectsService.advancedSearchProjects(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("Advanced Search for Projects total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
|
@ -151,7 +156,7 @@ export class AdvancedSearchProjectsComponent {
|
|||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
this.getResults(parameters, this.searchUtils.page,this.searchUtils.size);
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
|
|
|
@ -19,7 +19,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
|||
[(searchUtils)] = "searchUtils"
|
||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/publications"
|
||||
[csvParams]="csvParams" csvPath="publications" simpleSearchLink="/search/find/publications"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
[oldTotalResults]="oldTotalResults">
|
||||
|
@ -83,68 +83,73 @@ export class AdvancedSearchPublicationsComponent {
|
|||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
if(parameters!= null && parameters != '' ) {
|
||||
this.csvParams ="&type=publications&query=("+this.resourcesQuery +" and (" + parameters + "))";
|
||||
this.csvParams ="&fq=("+this.resourcesQuery +" and (" + parameters + "))";
|
||||
}else{
|
||||
this.csvParams ="&type=publications&query="+this.resourcesQuery;
|
||||
this.csvParams ="&fq="+this.resourcesQuery;
|
||||
}
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
console.info("Advanced Search for Publications: Execute search query "+parameters);
|
||||
this._searchPublicationsService.advancedSearchPublications(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("searchPubl total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
console.info("Advanced Search for Publications: Execute search query "+parameters);
|
||||
this._searchPublicationsService.advancedSearchPublications(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("searchPubl total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = ErrorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public queryChanged($event) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import {SearchUtilsClass } from '../searchUtils/searchUtils.class';
|
|||
[(searchUtils)] = "searchUtils"
|
||||
[(fieldIds)]="fieldIds" [(fieldIdsMap)]="fieldIdsMap" [(selectedFields)]="selectedFields"
|
||||
(queryChange)="queryChanged($event)"
|
||||
[csvParams]="csvParams" csvPath="resources" simpleSearchLink="/search/find/software"
|
||||
[csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software"
|
||||
[disableForms]="disableForms"
|
||||
[loadPaging]="loadPaging"
|
||||
[oldTotalResults]="oldTotalResults">
|
||||
|
@ -82,67 +82,72 @@ export class AdvancedSearchSoftwareComponent {
|
|||
}
|
||||
sub: any;
|
||||
public getResults(parameters:string, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
if(parameters!= null && parameters != '' ) {
|
||||
this.csvParams ="&type=software&query=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
|
||||
}else{
|
||||
this.csvParams ="&type=software&query="+this.resourcesQuery;
|
||||
this.csvParams ="&fq="+this.resourcesQuery;
|
||||
}
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
console.info("Advanced Search for Software: Execute search query "+parameters);
|
||||
this._searchSoftwareService.advancedSearchSoftware(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Software total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
console.info("Advanced Search for Software: Execute search query "+parameters);
|
||||
this._searchSoftwareService.advancedSearchSoftware(parameters, page, size).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Software total="+this.searchUtils.totalResults);
|
||||
this.results = data[1];
|
||||
this.searchPage.updateBaseUrlWithParameters();
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
console.info("error");
|
||||
//TODO check erros (service not available, bad request)
|
||||
// if( ){
|
||||
// this.searchUtils.status = errorCodes.ERROR;
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
//this.searchUtils.status = errorCodes.NOT_AVAILABLE;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
private setFilters(){
|
||||
//TODO set filters from
|
||||
|
|
|
@ -27,15 +27,20 @@
|
|||
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||
</div>
|
||||
|
||||
<search-download *ngIf="searchUtils.totalResults <= 10000" class="uk-width-1-1@s uk-hidden@m" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
|
||||
<search-download *ngIf="searchUtils.totalResults <= csvLimit" class="uk-width-1-1@s uk-hidden@m" [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-top">
|
||||
<search-result [results]="results"
|
||||
[status]=searchUtils.status
|
||||
[type]="entityType"
|
||||
[showLoading]="true">
|
||||
</search-result>
|
||||
</div>
|
||||
|
||||
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > resultsPerPage*pagingLimit)">
|
||||
<p class="uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>
|
||||
</div>
|
||||
|
||||
<div class="uk-align-center uk-margin-remove-bottom">
|
||||
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "searchUtils.baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||
</div>
|
||||
|
@ -43,11 +48,11 @@
|
|||
<helper class="uk-hidden@m" position="left" styleName="uk-width-1-1@s"></helper>
|
||||
<helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
|
||||
</div>
|
||||
<div *ngIf="searchUtils.totalResults <= 10000" class="uk-visible@m helper-left-right">
|
||||
<div *ngIf="searchUtils.totalResults <= csvLimit" class="uk-visible@m helper-left-right">
|
||||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
|
||||
<helper position="right"></helper>
|
||||
</div>
|
||||
<helper *ngIf="searchUtils.totalResults > 10000" class="helper-left-right uk-visible@m" position="right"></helper>
|
||||
<helper *ngIf="searchUtils.totalResults > csvLimit" class="helper-left-right uk-visible@m" position="right"></helper>
|
||||
</div>
|
||||
|
||||
<div class="uk-width-1-1">
|
||||
|
|
|
@ -40,11 +40,19 @@ export class AdvancedSearchPageComponent {
|
|||
|
||||
public baseURLWithParameters:string = '';
|
||||
|
||||
public csvLimit: number = 0;
|
||||
public pagingLimit: number = 0;
|
||||
public resultsPerPage: number = 0;
|
||||
|
||||
@Output() queryChange = new EventEmitter();
|
||||
constructor (private location: Location, private _meta: Meta, private _piwikService:PiwikService, private router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.csvLimit = OpenaireProperties.getCsvLimit();
|
||||
this.pagingLimit = OpenaireProperties.getPagingLimit();
|
||||
this.resultsPerPage = OpenaireProperties.getResultsPerPage();
|
||||
|
||||
this.updateTitle("Advanced search "+this.pageTitle);
|
||||
this.updateDescription("Openaire, search, repositories, open access, type, content provider, funder, project, "+ this.pageTitle);
|
||||
if(typeof window !== 'undefined') {
|
||||
|
|
|
@ -9,8 +9,9 @@ import {PiwikService} from '../../utils/piwik/piwik.service';
|
|||
@Component({
|
||||
selector: 'search-download',
|
||||
template: `
|
||||
<span class="uk-margin-large-right" *ngIf="totalResults > 0 && totalResults <= 10000">
|
||||
<span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type+'-report-'+totalResults)">
|
||||
<span class="uk-margin-large-right" *ngIf="totalResults > 0 && totalResults <= csvLimit">
|
||||
<!--span class="clickable" (click)="downloadfile(downloadURLAPI+type+'?format=csv&page=0&size='+totalResults+csvParams,type+'-report-'+totalResults)"-->
|
||||
<span class="clickable" (click)="downloadfile(downloadURLAPI+'?type='+type+'&format=csv'+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)
|
||||
</span>
|
||||
|
@ -31,6 +32,8 @@ export class SearchDownloadComponent {
|
|||
sub: any;
|
||||
downloadFilePiwikSub: any;
|
||||
|
||||
public csvLimit: number = 0;
|
||||
|
||||
@ViewChild (ModalLoading) loading : ModalLoading ;
|
||||
// Alert box when something is wrong with CSV requests
|
||||
@ViewChild('AlertModalCsvError') alertCsvError;
|
||||
|
@ -38,6 +41,7 @@ export class SearchDownloadComponent {
|
|||
constructor ( private _reportsService: ReportsService, private _piwikService:PiwikService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.csvLimit = OpenaireProperties.getCsvLimit();
|
||||
this.downloadURLAPI = OpenaireProperties.getCsvAPIURL();
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||
</div>
|
||||
|
||||
<div *ngIf="tableViewLink || searchUtils.totalResults <=10000" class="uk-width-1-1@s uk-hidden@m">
|
||||
<div *ngIf="tableViewLink || searchUtils.totalResults <= csvLimit" class="uk-width-1-1@s uk-hidden@m">
|
||||
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
|
||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
|
||||
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
|
||||
|
@ -83,7 +83,7 @@
|
|||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
|
||||
</div>
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<div *ngIf="(searchUtils.page <= pagingLimit)" class="uk-margin-top">
|
||||
<search-result *ngIf="!tableView"
|
||||
[results]="results"
|
||||
[status]="searchUtils.status"
|
||||
|
@ -92,6 +92,10 @@
|
|||
</search-result>
|
||||
</div>
|
||||
|
||||
<div [class]="searchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(searchUtils.page >= pagingLimit) && (searchUtils.totalResults > resultsPerPage*pagingLimit)">
|
||||
<p class="uk-alert-warning" uk-alert>For more results please try a new, more specific query</p>
|
||||
</div>
|
||||
|
||||
<div class="uk-align-center uk-margin-remove-bottom">
|
||||
<search-paging [type]="type" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||
</div>
|
||||
|
@ -100,7 +104,7 @@
|
|||
<helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
|
||||
</div>
|
||||
|
||||
<div *ngIf="tableViewLink || searchUtils.totalResults <=10000" class="helper-left-right uk-visible@m">
|
||||
<div *ngIf="tableViewLink || searchUtils.totalResults <= csvLimit" class="helper-left-right uk-visible@m">
|
||||
<span *ngIf="tableViewLink" class="uk-margin-medium-right">
|
||||
<a routerLinkActive="router-link-active" [class]="(disableForms)?'uk-disabled uk-link-muted':''" [routerLink]=tableViewLink >
|
||||
<span class="uk-margin-small-right uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="2" y="2" width="3" height="3"></rect><rect x="8" y="2" width="3" height="3"></rect><rect x="14" y="2" width="3" height="3"></rect><rect x="2" y="8" width="3" height="3"></rect><rect x="8" y="8" width="3" height="3"></rect><rect x="14" y="8" width="3" height="3"></rect><rect x="2" y="14" width="3" height="3"></rect><rect x="8" y="14" width="3" height="3"></rect><rect x="14" y="14" width="3" height="3"></rect></svg></span>
|
||||
|
@ -111,7 +115,7 @@
|
|||
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"></search-download>
|
||||
<helper position="right"></helper>
|
||||
</div>
|
||||
<helper *ngIf="!tableViewLink && searchUtils.totalResults > 10000" class="helper-left-right uk-visible@m" position="right"></helper>
|
||||
<helper *ngIf="!tableViewLink && searchUtils.totalResults > csvLimit" class="helper-left-right uk-visible@m" position="right"></helper>
|
||||
</div>
|
||||
<!-- <div [class]="(showRefine)? 'uk-width-3-5@m uk-width-3-5@l uk-width-1-1@s uk-align-center uk-margin-remove-bottom' : 'uk-width-1-1'">
|
||||
<search-paging [loadPaging]="loadPaging" [type]="type" [oldTotalResults]="oldTotalResults" [(searchUtils)] = "searchUtils" [(results)] = "results" [(baseUrl)] = "baseUrl" [(parameterNames)] = "parameterNames" [(parameterValues)] = "parameterValues" ></search-paging>
|
||||
|
|
|
@ -56,11 +56,18 @@ export class SearchPageComponent {
|
|||
public showUnknownFilters:boolean = false; // when a filter exists in query but has no results, so no filters returned from the query
|
||||
//@ViewChild (SearchFilterModalComponent) searchFilterModal : SearchFilterModalComponent ;
|
||||
public currentFilter: Filter;
|
||||
public csvLimit: number = 0;
|
||||
public pagingLimit: number = 0;
|
||||
public resultsPerPage: number = 0;
|
||||
|
||||
constructor (private location: Location , private _meta: Meta,private element: ElementRef,private _piwikService:PiwikService, private router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.csvLimit = OpenaireProperties.getCsvLimit();
|
||||
this.pagingLimit = OpenaireProperties.getPagingLimit();
|
||||
this.resultsPerPage = OpenaireProperties.getResultsPerPage();
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
this.element.nativeElement.scrollIntoView();
|
||||
}
|
||||
|
|
|
@ -281,20 +281,20 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
|
|||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||
}
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
this.csvParams = parameters;
|
||||
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
this.subResults = this._searchDataprovidersService.searchDataproviders(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Content Providers: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
|
@ -344,7 +344,8 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private setFilters(){
|
||||
|
@ -353,7 +354,7 @@ public getResultsForDeposit(id:string, type:string, page: number, size: number)
|
|||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
}
|
||||
|
|
|
@ -195,19 +195,19 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){
|
|||
this._getResults(parameters,refine,page,size);
|
||||
}
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
this.csvParams = parameters;
|
||||
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
this.subResults = this._searchDatasetsService.searchDatasets(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
this.subResults = this._searchDatasetsService.searchDatasets(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Research Data: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
|
@ -256,7 +256,8 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -267,7 +268,7 @@ private _getResults(parameters:string,refine:boolean, page: number, size: number
|
|||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
//this.getResults(parameters, this.searchUtils.page, this.searchUtils.size, "searchPage");
|
||||
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
|
|
|
@ -100,19 +100,19 @@ export class SearchOrganizationsComponent {
|
|||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||
}
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
this.csvParams = parameters;
|
||||
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
this.subResults = this._searchOrganizationsService.searchOrganizations(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
this.subResults = this._searchOrganizationsService.searchOrganizations(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Organizations: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
|
@ -161,13 +161,14 @@ export class SearchOrganizationsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
var parameters = $event.value;
|
||||
console.info("queryChanged: Execute search query "+parameters);
|
||||
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
|
|
|
@ -102,20 +102,19 @@ export class SearchProjectsComponent {
|
|||
this._getResults(parameters,refine,page,this.searchUtils.size);
|
||||
}
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
this.csvParams = parameters;
|
||||
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
this.subResults = this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
this.subResults = this._searchProjectsService.searchProjects(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Projects: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
|
@ -165,7 +164,8 @@ export class SearchProjectsComponent {
|
|||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public getResultsForDataproviders(id:string, page: number, size: number){
|
||||
|
@ -204,7 +204,7 @@ export class SearchProjectsComponent {
|
|||
|
||||
public queryChanged($event) {
|
||||
this.loadPaging = true;
|
||||
|
||||
|
||||
this.urlParams = undefined;
|
||||
var parameters = $event.value;
|
||||
this._getResults(parameters, true, this.searchUtils.page, this.searchUtils.size);
|
||||
|
|
|
@ -204,72 +204,72 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){
|
|||
}
|
||||
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
this.csvParams = parameters;
|
||||
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
this.subResults = this._searchPublicationsService.searchPublications(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
this.results = data[1];
|
||||
if(refine){
|
||||
this.filters = data[2];
|
||||
}
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
this.subResults = this._searchPublicationsService.searchPublications(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
console.info(data);
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Publications: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
this.results = data[1];
|
||||
if(refine){
|
||||
this.filters = data[2];
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.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;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
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;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
/*
|
||||
public getAggregatorResults(id:string, page: number, size: number){
|
||||
|
|
|
@ -195,68 +195,69 @@ public getResults(keyword:string,refine:boolean, page: number, size: number){
|
|||
this._getResults(parameters,refine,page,size);
|
||||
}
|
||||
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
||||
if(page > OpenaireProperties.getPagingLimit()) {
|
||||
size=0;
|
||||
}
|
||||
if(page <= OpenaireProperties.getPagingLimit() || this.searchUtils.status == this.errorCodes.LOADING) {
|
||||
this.csvParams = parameters;
|
||||
|
||||
// if(!refine && !this.searchPage){
|
||||
// this.searchPage = new SearchPageComponent(this._location);
|
||||
// }
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
//this.searchPage.openLoading();
|
||||
this.disableForms = true;
|
||||
this.results = [];
|
||||
this.searchUtils.totalResults = 0;
|
||||
|
||||
this.subResults = this._searchSoftwareService.searchSoftware(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
this.results = data[1];
|
||||
if(refine){
|
||||
this.filters = data[2];
|
||||
}
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
this.subResults = this._searchSoftwareService.searchSoftware(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields()).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
console.info("search Software: [Parameters:"+parameters+" ] [total results:"+this.searchUtils.totalResults+"]");
|
||||
this.results = data[1];
|
||||
if(refine){
|
||||
this.filters = data[2];
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
this.searchPage.checkSelectedFilters(this.filters);
|
||||
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
||||
//var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
this.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.searchUtils.totalResults == 0 ){
|
||||
this.searchUtils.status = this.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;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
if(this.searchUtils.status == this.errorCodes.DONE) {
|
||||
// Page out of limit!!!
|
||||
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
||||
if(!(Number.isInteger(totalPages))) {
|
||||
totalPages = (parseInt(totalPages, 10) + 1);
|
||||
}
|
||||
if(totalPages < page) {
|
||||
this.searchUtils.totalResults = 0;
|
||||
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
||||
}
|
||||
}
|
||||
},
|
||||
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;
|
||||
if(err.status == '404') {
|
||||
this.searchUtils.status = this.errorCodes.NOT_FOUND;
|
||||
} else if(err.status == '500') {
|
||||
this.searchUtils.status = this.errorCodes.ERROR;
|
||||
} else {
|
||||
this.searchUtils.status = this.errorCodes.NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
//this.searchPage.closeLoading();
|
||||
this.disableForms = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import {Router} from '@angular/router';
|
|||
import {DomSanitizer} from '@angular/platform-browser';
|
||||
//Usage Example <paging [currentPage]="page" [totalResults]="resultsNum" [term]="keyword"> </paging>
|
||||
import {RouterHelper} from './routerHelper.class';
|
||||
import {OpenaireProperties} from './properties/openaireProperties';
|
||||
|
||||
@Component({
|
||||
selector: 'paging',
|
||||
|
@ -53,8 +54,19 @@ export class PagingFormatter {
|
|||
|
||||
}
|
||||
getTotalPages(){
|
||||
let total: number = 0;
|
||||
let limit: number = OpenaireProperties.getPagingLimit();
|
||||
|
||||
var i:number =parseInt(''+(this.totalResults/this.size));
|
||||
return (((this.totalResults/this.size) == i )? i :(i+1)) ;
|
||||
total = (((this.totalResults/this.size) == i )? i :(i+1)) ;
|
||||
|
||||
if((this.currentPage == limit) && (total > limit)) {
|
||||
total = limit;
|
||||
} else if((this.currentPage > limit) && (total > limit)) {
|
||||
total = this.currentPage;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
// onPage(pageNum: number){
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
export class OpenaireProperties {
|
||||
private static productionMode:boolean = false;
|
||||
private static csvLimit: number = 2000;
|
||||
private static pagingLimit: number = 20;
|
||||
private static resultsPerPage: number = 10;
|
||||
|
||||
//base url
|
||||
private static baseLink = "https://demo.openaire.eu";
|
||||
|
@ -58,7 +61,8 @@ export class OpenaireProperties {
|
|||
private static csvAPIURL_pm = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
|
||||
// private static csvAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";//publications?format=csv
|
||||
|
||||
private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
|
||||
//private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
|
||||
private static csvAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/reports";
|
||||
|
||||
private static searchCrossrefAPIURL = "https://api.crossref.org/works";
|
||||
// private static searchDataciteAPIURL = "https://search.datacite.org/api";
|
||||
|
@ -120,6 +124,18 @@ export class OpenaireProperties {
|
|||
|
||||
private static useCache:boolean = true;
|
||||
|
||||
public static getCsvLimit():number {
|
||||
return this.csvLimit;
|
||||
}
|
||||
|
||||
public static getPagingLimit():number {
|
||||
return this.pagingLimit;
|
||||
}
|
||||
|
||||
public static getResultsPerPage():number {
|
||||
return this.resultsPerPage;
|
||||
}
|
||||
|
||||
public static getBaseLink():string{
|
||||
return this.baseLink;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue