search/find: do not query for results if count returns 0
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48517 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
8d80576fc1
commit
30e3abed04
|
@ -336,7 +336,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
public searchPublications() {
|
||||
this.activeTab = "publications";
|
||||
if(this.reloadPublications) {
|
||||
if( this.reloadPublications &&
|
||||
this.fetchPublications.searchUtils.status != this.errorCodes.NONE &&
|
||||
this.fetchPublications.searchUtils.status != this.errorCodes.ERROR) {
|
||||
this.reloadPublications = false;
|
||||
this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10);
|
||||
this.linkToSearchPublications = OpenaireProperties.getLinkToSearchPublications();// + "?keyword=" + this.keyword;
|
||||
|
@ -344,7 +346,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
public searchDatasets() {
|
||||
this.activeTab = "datasets";
|
||||
if(this.reloadDatasets) {
|
||||
if(this.reloadDatasets &&
|
||||
this.fetchDatasets.searchUtils.status != this.errorCodes.NONE &&
|
||||
this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR) {
|
||||
this.reloadDatasets = false;
|
||||
this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10);
|
||||
this.linkToSearchDatasets = OpenaireProperties.getLinkToSearchDatasets();// + "?keyword=" + this.keyword;
|
||||
|
@ -352,7 +356,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
public searchProjects() {
|
||||
this.activeTab = "projects";
|
||||
if(this.reloadProjects) {
|
||||
if(this.reloadProjects &&
|
||||
this.fetchProjects.searchUtils.status != this.errorCodes.NONE &&
|
||||
this.fetchProjects.searchUtils.status != this.errorCodes.ERROR) {
|
||||
this.reloadProjects = false;
|
||||
this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10);
|
||||
this.linkToSearchProjects = OpenaireProperties.getLinkToSearchProjects();// + "?keyword=" + this.keyword;
|
||||
|
@ -360,7 +366,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
public searchDataProviders() {
|
||||
this.activeTab = "dataproviders";
|
||||
if(this.reloadDataproviders) {
|
||||
if( this.reloadDataproviders &&
|
||||
this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE &&
|
||||
this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR) {
|
||||
this.reloadDataproviders = false;
|
||||
this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10);
|
||||
this.linkToSearchDataproviders = OpenaireProperties.getLinkToSearchDataProviders();// + "?keyword=" + this.keyword;
|
||||
|
@ -368,7 +376,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
public searchOrganizations() {
|
||||
this.activeTab = "organizations";
|
||||
if(this.reloadOrganizations) {
|
||||
if( this.reloadOrganizations &&
|
||||
this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE &&
|
||||
this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR) {
|
||||
this.reloadOrganizations = false;
|
||||
this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10);
|
||||
this.linkToSearchOrganizations = OpenaireProperties.getLinkToSearchOrganizations();// + "?keyword=" + this.keyword;
|
||||
|
@ -404,11 +414,15 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
private count() {
|
||||
if(this.activeTab != "publications"){
|
||||
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.fetchPublications.results = [];
|
||||
this.subPub = this._searchPublicationsService.numOfSearchPublications(this.keyword).subscribe(
|
||||
data => {
|
||||
console.log("Count results: "+data);
|
||||
this.fetchPublications.searchUtils.totalResults = data;
|
||||
this.fetchPublications.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.fetchPublications.searchUtils.totalResults == 0) {
|
||||
this.fetchPublications.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
@ -418,10 +432,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
if(this.activeTab != "datasets"){
|
||||
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.fetchDatasets.results = [];
|
||||
this.subData = this._searchDatasetsService.numOfSearchDatasets(this.keyword).subscribe(
|
||||
data => {
|
||||
this.fetchDatasets.searchUtils.totalResults = data;
|
||||
this.fetchDatasets.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.fetchDatasets.searchUtils.totalResults == 0) {
|
||||
this.fetchDatasets.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
@ -431,10 +449,14 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
}
|
||||
if(this.activeTab != "projects"){
|
||||
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.fetchProjects.results = [];
|
||||
this.subProjects = this._searchProjectsService.numOfSearchProjects(this.keyword).subscribe(
|
||||
data => {
|
||||
this.fetchProjects.searchUtils.totalResults = data;
|
||||
this.fetchProjects.searchUtils.status = this.errorCodes.DONE;
|
||||
if(this.fetchProjects.searchUtils.totalResults == 0) {
|
||||
this.fetchProjects.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
@ -443,15 +465,19 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
|
|||
);
|
||||
}
|
||||
if(this.activeTab != "dataproviders"){
|
||||
this.fetchDataproviders.results = [];
|
||||
this.fetchDataproviders.getNumForSearch(this.keyword);
|
||||
}
|
||||
if(this.activeTab != "organizations"){
|
||||
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
||||
this.fetchOrganizations.results = [];
|
||||
this.subOrg = this._searchOrganizationsService.numOfSearchOrganizations(this.keyword).subscribe(
|
||||
data => {
|
||||
this.fetchOrganizations.searchUtils.totalResults = data;
|
||||
this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE;
|
||||
|
||||
if(this.fetchOrganizations.searchUtils.totalResults == 0) {
|
||||
this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
|
|
@ -100,6 +100,10 @@ export class FetchDataproviders {
|
|||
data => {
|
||||
this.searchUtils.totalResults = data;
|
||||
this.searchUtils.status = errorCodes.DONE;
|
||||
|
||||
if(this.searchUtils.totalResults == 0) {
|
||||
this.searchUtils.status = errorCodes.NONE;
|
||||
}
|
||||
},
|
||||
err => {
|
||||
console.log(err);
|
||||
|
|
Loading…
Reference in New Issue