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