From 1e5964aecc399ad0a8ea79d623b7c957226622e0 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 31 Mar 2020 10:14:13 +0000 Subject: [PATCH] [Trunk | Library]: searchResearchResults.component.ts & searchProjects.component.ts: [Bug fix - caused on r58351] Initialize range filters only on when refine is true (do not flicker range filtes on page change - BUT update on range value/ query change) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58360 d315682c-612b-4755-9ff5-7f18f6832af3 --- searchPages/searchProjects.component.ts | 8 +++----- searchPages/searchResearchResults.component.ts | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index 0cb29d90..2999a3a7 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -122,7 +122,7 @@ export class SearchProjectsComponent { this.searchPage.fieldIds = this.fieldIds; this.selectedFields = []; this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, "project"); - this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad), firstLoad); + this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); firstLoad = false; }); } @@ -130,7 +130,7 @@ export class SearchProjectsComponent { this.sub.unsubscribe(); } sub: any; - public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null, firstLoad: boolean = true){ + public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){ if(page > this.pagingLimit) { size=0; } @@ -162,12 +162,10 @@ export class SearchProjectsComponent { // this.searchPage.updateBaseUrlWithParameters(); if (refine) { this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults); + this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); }else{ this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false); } - if(firstLoad) { - this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); - } //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.DONE; diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index 48be4845..735333cd 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -132,7 +132,7 @@ export class SearchResearchResultsComponent { } this.selectedFields = []; this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter); - this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad), firstLoad); + this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); firstLoad = false; })); } @@ -143,7 +143,7 @@ export class SearchResearchResultsComponent { } } - public _getResults(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null, firstLoad: boolean = true) { + public _getResults(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) { if (page > this.pagingLimit) { size = 0; } @@ -168,12 +168,10 @@ export class SearchResearchResultsComponent { this.results = data[1]; if (refine) { this.filters = this.searchPage.prepareFiltersToShow(data[2],this.searchUtils.totalResults); + this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); } else { this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false); } - if(firstLoad) { - this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); - } this.searchUtils.status = this.errorCodes.DONE; if (this.searchUtils.totalResults == 0) {