Search pages: fix #6937- results per page change is not applied when the page or the keyword changes
This commit is contained in:
parent
01edbef93c
commit
725d2aa7e3
|
@ -23,7 +23,7 @@ import {properties} from "../../../environments/environment";
|
|||
type="content providers"
|
||||
[results]="results"
|
||||
[searchUtils]="searchUtils"
|
||||
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
|
||||
[sortedByChanged]="searchUtils.sortBy"
|
||||
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
|
||||
[csvParams]="csvParams" csvPath="datasources"
|
||||
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
|
||||
|
@ -133,11 +133,7 @@ export class SearchDataProvidersComponent {
|
|||
let page = (params['page']=== undefined)?0:+params['page'];
|
||||
this.searchUtils.page = ( page < 1 ) ? 1 : page;
|
||||
|
||||
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
||||
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||
this.searchUtils.size = 10;
|
||||
}
|
||||
|
||||
this.searchUtils.validateSize(params['size']);
|
||||
this.searchPage.fieldIds = this.fieldIds;
|
||||
this.selectedFields =[];
|
||||
if(this.type == "deposit"){
|
||||
|
|
|
@ -20,7 +20,7 @@ import {properties} from "../../../environments/environment";
|
|||
type="organizations"
|
||||
[results]="results"
|
||||
[searchUtils]="searchUtils"
|
||||
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
|
||||
[sortedByChanged]="searchUtils.sortBy"
|
||||
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
|
||||
[csvParams]="csvParams" csvPath="organizations"
|
||||
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
|
||||
|
@ -124,10 +124,7 @@ export class SearchOrganizationsComponent {
|
|||
let page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
|
||||
|
||||
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
||||
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||
this.searchUtils.size = 10;
|
||||
}
|
||||
this.searchUtils.validateSize(params['size']);
|
||||
|
||||
this.searchPage.fieldIds = this.fieldIds;
|
||||
this.selectedFields =[];
|
||||
|
|
|
@ -20,7 +20,7 @@ import {properties} from "../../../environments/environment";
|
|||
type="projects"
|
||||
[results]="results"
|
||||
[searchUtils]="searchUtils"
|
||||
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
|
||||
[sortedByChanged]="searchUtils.sortBy"
|
||||
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
|
||||
[csvParams]="csvParams" csvPath="projects"
|
||||
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
|
||||
|
@ -125,10 +125,7 @@ export class SearchProjectsComponent {
|
|||
let page = (params['page']=== undefined)?1:+params['page'];
|
||||
this.searchUtils.page = ( page <= 0 ) ? 1 : page;
|
||||
|
||||
this.searchUtils.size = (params['size']=== undefined)?10:+params['size'];
|
||||
if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||
this.searchUtils.size = 10;
|
||||
}
|
||||
this.searchUtils.validateSize(params['size']);
|
||||
|
||||
this.searchPage.fieldIds = this.fieldIds;
|
||||
this.selectedFields = [];
|
||||
|
|
|
@ -21,7 +21,7 @@ import {ContextsService} from "../claims/claim-utils/service/contexts.service";
|
|||
[type]="getEntityName(resultType, true, true)"
|
||||
[results]="results"
|
||||
[searchUtils]="searchUtils"
|
||||
[sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size"
|
||||
[sortedByChanged]="searchUtils.sortBy"
|
||||
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
|
||||
[csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)"
|
||||
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
|
||||
|
@ -159,10 +159,7 @@ export class SearchResearchResultsComponent {
|
|||
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
||||
this.searchUtils.page = (page <= 0) ? 1 : page;
|
||||
|
||||
this.searchUtils.size = (params['size'] === undefined) ? 10 : +params['size'];
|
||||
if (this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
||||
this.searchUtils.size = 10;
|
||||
}
|
||||
this.searchUtils.validateSize(params['size']);
|
||||
this.searchUtils.sortBy = (params['sortBy']) ? params['sortBy'] : '';
|
||||
if (this.searchUtils.sortBy && this.searchUtils.sortBy != "resultdateofacceptance,descending" && this.searchUtils.sortBy != "resultdateofacceptance,ascending") {
|
||||
this.searchUtils.sortBy = "";
|
||||
|
|
|
@ -58,7 +58,6 @@ export class NewSearchPageComponent {
|
|||
@Input() customFilter: SearchCustomFilter;
|
||||
@Input() sort: boolean = true;
|
||||
@Input() sortedByChanged: string = "";
|
||||
@Input() resultsPerPageChanged: number;
|
||||
@Input() searchFormClass: string = "searchForm";
|
||||
//From simple:
|
||||
@Input() rangeFilters: RangeFilter[] = [];
|
||||
|
@ -326,9 +325,7 @@ export class NewSearchPageComponent {
|
|||
|
||||
|
||||
sizeChanged($event) {
|
||||
//this.searchUtils.size = $event.value;
|
||||
this.resultsPerPageChanged = $event;
|
||||
|
||||
this.searchUtils.size = $event;
|
||||
this.goTo(1);
|
||||
}
|
||||
|
||||
|
@ -1294,11 +1291,9 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
|
|||
this.parameterValues.push("" + this.searchUtils.page);
|
||||
}
|
||||
|
||||
//if (this.searchUtils.size != this.resultsPerPage) {
|
||||
if (this.resultsPerPageChanged && this.searchUtils.size != this.resultsPerPageChanged) {
|
||||
if (this.searchUtils.size != this.searchUtils.defaultSize) {
|
||||
this.parameterNames.push("size");
|
||||
//this.parameterValues.push("" + this.searchUtils.size);
|
||||
this.parameterValues.push("" + this.resultsPerPageChanged);
|
||||
this.parameterValues.push("" + this.searchUtils.size);
|
||||
}
|
||||
|
||||
//if (this.sort && this.searchUtils.sortBy) {
|
||||
|
@ -1380,8 +1375,8 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
|
|||
// this.parameterNames.push("sortBy");
|
||||
// this.parameterValues.push(this.searchUtils.sortBy);
|
||||
// }
|
||||
// console.log(this.parameterNames)
|
||||
// console.log(this.parameterValues)
|
||||
console.log(this.parameterNames)
|
||||
console.log(this.parameterValues)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export class SearchUtilsClass{
|
||||
page:number = 1;
|
||||
size:number = 10;
|
||||
defaultSize:number = 10;
|
||||
status:number = 1;
|
||||
refineStatus:number = 1;
|
||||
keyword:string = "";
|
||||
|
@ -8,6 +9,13 @@ export class SearchUtilsClass{
|
|||
totalResults = null;
|
||||
totalResultsNoFilters:number; // for organization landing - tab with projects
|
||||
sortBy: string = "";
|
||||
|
||||
validateSize(sizeFromParams){
|
||||
this.size = (sizeFromParams=== undefined)?this.defaultSize:+sizeFromParams;
|
||||
if(this.size != 5 && this.size != 10 && this.size != 20 && this.size != 50) {
|
||||
this.size = this.defaultSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class SearchCustomFilter{
|
||||
|
|
Loading…
Reference in New Issue