From cdb337592a990f2cfe7963161976da1cccd0930b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 30 Sep 2019 10:55:59 +0000 Subject: [PATCH] [Trunk | Library]: Bug fix: search.component.ts: In '/search/find' route' make request for results or for refine fields depending on whether there is a keyword. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57200 d315682c-612b-4755-9ff5-7f18f6832af3 --- searchPages/find/search.component.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/searchPages/find/search.component.ts b/searchPages/find/search.component.ts index 14a6dfa7..596ccb71 100644 --- a/searchPages/find/search.component.ts +++ b/searchPages/find/search.component.ts @@ -261,7 +261,8 @@ export class SearchComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedPublications;//"/search/advanced/publications"; if (this.reloadPublications && this.fetchPublications.searchUtils.status != this.errorCodes.NONE /*&& - this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/) { + this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadPublications = false; this.fetchPublications.getResultsByKeyword("publication", this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword; @@ -273,7 +274,8 @@ export class SearchComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedDatasets;//"/search/advanced/datasets"; if (this.reloadDatasets && this.fetchDatasets.searchUtils.status != this.errorCodes.NONE /*&& - this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/) { + this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadDatasets = false; this.fetchDatasets.getResultsByKeyword("dataset", this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchDatasets = this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword; @@ -287,7 +289,8 @@ export class SearchComponent { if (this.reloadSoftware && this.fetchSoftware.searchUtils.status != this.errorCodes.NONE/* && ( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || - this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/) { + this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadSoftware = false; this.fetchSoftware.getResultsByKeyword("software", this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword; @@ -299,7 +302,8 @@ export class SearchComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedOrps;//"/search/advanced/other"; if (this.reloadOrps && this.fetchOrps.searchUtils.status != this.errorCodes.NONE /*&& - this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/) { + this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadOrps = false; this.fetchOrps.getResultsByKeyword("other", this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchOrps = this.properties.searchLinkToOrps; @@ -311,7 +315,8 @@ export class SearchComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects;//"/search/advanced/projects"; if (this.reloadProjects && this.fetchProjects.searchUtils.status != this.errorCodes.NONE /*&& - this.fetchProjects.searchUtils.status != this.errorCodes.ERROR*/) { + this.fetchProjects.searchUtils.status != this.errorCodes.ERROR*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadProjects = false; this.fetchProjects.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchProjects = this.properties.searchLinkToProjects;// + "?keyword=" + this.keyword; @@ -323,7 +328,8 @@ export class SearchComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;//"/search/advanced/dataproviders"; if (this.reloadDataproviders && this.fetchDataproviders.searchUtils.status != this.errorCodes.NONE /*&& - this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR*/) { + this.fetchDataproviders.searchUtils.status != this.errorCodes.ERROR*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadDataproviders = false; this.fetchDataproviders.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchDataproviders = this.properties.searchLinkToDataProviders;// + "?keyword=" + this.keyword; @@ -335,7 +341,8 @@ export class SearchComponent { this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations"; if (this.reloadOrganizations && this.fetchOrganizations.searchUtils.status != this.errorCodes.NONE /*&& - this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR*/) { + this.fetchOrganizations.searchUtils.status != this.errorCodes.ERROR*/ + && (this.keyword != null && this.keyword.length > 0)) { this.reloadOrganizations = false; this.fetchOrganizations.getResultsByKeyword(this.keyword, 1, 10, this.properties, this.customFilter); this.linkToSearchOrganizations = this.properties.searchLinkToOrganizations;// + "?keyword=" + this.keyword;