diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 2ee61670..82250cdc 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -10,6 +10,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl import {EnvProperties} from '../utils/properties/env-properties'; import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class"; +import {properties} from "../../../environments/environment"; @Component({ @@ -22,10 +23,12 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class"; type="content providers" [results]="results" [searchUtils]="searchUtils" + [sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size" [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" csvPath="datasources" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" + [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [openaireLink]=openaireLink @@ -63,6 +66,7 @@ export class SearchDataProvidersComponent { public resourcesQuery = "(oaftype exact datasource)"; public csvParams: string; public disableForms: boolean = false; + public disableRefineForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; public pagingLimit: number = 0; @@ -80,6 +84,9 @@ export class SearchDataProvidersComponent { @Input() includeOnlyResultsAndFilter: boolean = false; @Output() searchPageUpdates = new EventEmitter(); @Input() showAdvancedSearchLink:boolean; + + subs: any[] = []; + constructor (private route: ActivatedRoute, private _searchDataProvidersService: SearchDataprovidersService ) { this.results =[]; this.errorCodes = new ErrorCodes(); @@ -92,31 +99,44 @@ export class SearchDataProvidersComponent { if(this.showAdvancedSearchLink == null){ this.showAdvancedSearchLink = (this.type == "all"); } - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties= data.envSpecific; + // this.route.data + // .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= properties; if (!this.simpleSearchLink) { this.simpleSearchLink = this.properties.searchLinkToDataProviders; } this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; - this.pagingLimit = data.envSpecific.pagingLimit; - this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + this.pagingLimit = properties.pagingLimit; + this.isPiwikEnabled = properties.enablePiwikTrack; - }); + // }); let firstLoad = true; this.filters = DatasourcesHelperClass.createFilters(this.type); - this.sub = this.route.queryParams.subscribe(params => { + this.subs.push(this.route.queryParams.subscribe(params => { this.loadPaging = true; if(params['page'] && this.searchUtils.page != params['page']) { this.loadPaging = false; this.oldTotalResults = this.searchUtils.totalResults; } var refine = true; - if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) { + if ( + (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) + && (this.searchUtils.page == 1 || params['page'])) + && this.filters && !firstLoad + ) { refine = false; - } + if ( + ( + this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size']) + && (this.searchUtils.size == 10 || params['size']) + ) + && this.filters && !firstLoad) { + refine = false; + this.searchUtils.status = this.errorCodes.DONE; + } + let page = (params['page']=== undefined)?0:+params['page']; this.searchUtils.page = ( page < 1 ) ? 1 : page; @@ -133,14 +153,55 @@ export class SearchDataProvidersComponent { } // console.log(this.refineFields) this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider"); + if(refine && (this.type == "all" || this.type == "deposit")) { + this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); + } else if(refine) { // static filters + this.searchUtils.refineStatus = this.errorCodes.LOADING; + } this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); firstLoad = false; - }); + })); } ngOnDestroy() { - this.sub.unsubscribe(); + for (let sub of this.subs) { + sub.unsubscribe(); + } } - sub: any; + + public _getFilters(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){ + if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) { + this.searchUtils.refineStatus = this.errorCodes.LOADING; + this.disableRefineForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); + + let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type); + this.subs.push(this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")) + //.switchMap( + .subscribe( + data => { + if (refine) { + this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]); + } + + this.searchUtils.refineStatus = this.errorCodes.DONE; + // if (this.searchUtils.totalResults == 0) { + // this.searchUtils.status = this.errorCodes.NONE; + // } + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + }, + err => { + this.handleError("Error getting organizations: ", err); + this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status); + + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + } + )); + } + } + + public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){ if(page > this.pagingLimit ) { size=0; @@ -160,23 +221,28 @@ export class SearchDataProvidersComponent { this.searchUtils.status = this.errorCodes.LOADING; //this.searchPage.openLoading(); this.disableForms = true; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); this.results = []; this.searchUtils.totalResults = 0; //console.info("Advanced Search for Content Providers: Execute search query "+parameters); let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type); - this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe( - data => { + //this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe( + this.subs.push(this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe( + data => { this.searchUtils.totalResults = data[0]; this.results = data[1]; //console.log(this.results); - if (refine) { - this.filters = - this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters, this.searchUtils.totalResults); - }else{ + // if (refine) { + // this.filters = + // this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters, this.searchUtils.totalResults); + // }else{ + if(!refine) { this.searchPage.buildPageURLParameters(this.filters, [], false); + } else if(this.type != "all" && this.type != "deposit") { // static filters + this.filters = this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults); + this.searchUtils.refineStatus = this.errorCodes.DONE; } // this.searchPage.updateBaseUrlWithParameters(); //var errorCodes:ErrorCodes = new ErrorCodes(); @@ -186,7 +252,7 @@ export class SearchDataProvidersComponent { } //this.searchPage.closeLoading(); this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); if(this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit @@ -220,10 +286,10 @@ export class SearchDataProvidersComponent { }*/ //this.searchPage.closeLoading(); this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); } - ); + )); } } diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts index 197ac570..7a0f4877 100644 --- a/searchPages/searchOrganizations.component.ts +++ b/searchPages/searchOrganizations.component.ts @@ -8,6 +8,7 @@ import {SearchFields} from '../utils/properties/searchFields'; import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.class'; import {EnvProperties} from '../utils/properties/env-properties'; import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; +import {properties} from "../../../environments/environment"; @Component({ @@ -19,10 +20,12 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; type="organizations" [results]="results" [searchUtils]="searchUtils" + [sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size" [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" csvPath="organizations" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" + [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [openaireLink]=openaireLink @@ -52,6 +55,7 @@ export class SearchOrganizationsComponent { public selectedFields:AdvancedField[] = []; public csvParams: string; public disableForms: boolean = false; + public disableRefineForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; public pagingLimit: number = 0; @@ -70,6 +74,9 @@ export class SearchOrganizationsComponent { @Input() showAdvancedSearchLink:boolean = true; public resourcesQuery = "(oaftype exact organization)"; + + subs: any[] = []; + constructor (private route: ActivatedRoute, private _searchOrganizationsService: SearchOrganizationsService ) { this.results =[]; this.errorCodes = new ErrorCodes(); @@ -80,33 +87,48 @@ export class SearchOrganizationsComponent { } ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties= data.envSpecific; + // this.route.data + // .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= properties; if (!this.simpleSearchLink) { this.simpleSearchLink = this.properties.searchLinkToOrganizations; } this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; - this.pagingLimit = data.envSpecific.pagingLimit; - this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + this.pagingLimit = properties.pagingLimit; + this.isPiwikEnabled = properties.enablePiwikTrack; - }); + // }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; var firstLoad = true; - this.sub = this.route.queryParams.subscribe(params => { + this.subs.push(this.route.queryParams.subscribe(params => { this.loadPaging = true; if(params['page'] && this.searchUtils.page != params['page']) { this.loadPaging = false; this.oldTotalResults = this.searchUtils.totalResults; } var refine = true; - if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) { + if ( + ( + this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) + && (this.searchUtils.page == 1 || params['page']) + ) + && this.filters && !firstLoad) { refine = false; - } + + if ( + ( + this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size']) + && (this.searchUtils.size == 10 || params['size']) + ) + && this.filters && !firstLoad) { + refine = false; + this.searchUtils.status = this.errorCodes.DONE; + } + let page = (params['page']=== undefined)?1:+params['page']; this.searchUtils.page = ( page <= 0 ) ? 1 : page; @@ -122,15 +144,50 @@ export class SearchOrganizationsComponent { // this.searchPage.customFilter = this.customFilter; // this.searchPage.getSelectedFiltersFromUrl(params); this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "organization"); - + if(refine) { + this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); + } this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); firstLoad = false; - }); + })); } ngOnDestroy() { - this.sub.unsubscribe(); + for (let sub of this.subs) { + sub.unsubscribe(); + } } - sub: any; + + public _getFilters(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){ + if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) { + this.searchUtils.refineStatus = this.errorCodes.LOADING; + this.disableRefineForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); + this.subs.push(this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery) + //.switchMap( + .subscribe( + data => { + if (refine) { + this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]); + } + + this.searchUtils.refineStatus = this.errorCodes.DONE; + // if (this.searchUtils.totalResults == 0) { + // this.searchUtils.status = this.errorCodes.NONE; + // } + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + }, + err => { + this.handleError("Error getting organizations: ", err); + this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status); + + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + } + )); + } + } + public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){ if(page > this.pagingLimit) { size=0; @@ -149,19 +206,21 @@ export class SearchOrganizationsComponent { this.searchUtils.status = this.errorCodes.LOADING; //this.searchPage.openLoading(); this.disableForms = true; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); this.results = []; this.searchUtils.totalResults = 0; //console.info("Advanced Search for Organizations: Execute search query "+parameters); - this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( + //this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( + this.subs.push(this._searchOrganizationsService.advancedSearchOrganizations(parameters, page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( data => { this.searchUtils.totalResults = data[0]; this.results = data[1]; - if (refine) { - this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults); - }else{ + // if (refine) { + // this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults); + // }else{ + if(!refine) { this.searchPage.buildPageURLParameters(this.filters, [],false); } // this.searchPage.updateBaseUrlWithParameters(); @@ -172,7 +231,7 @@ export class SearchOrganizationsComponent { } //this.searchPage.closeLoading(); this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); if(this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit!!! @@ -190,7 +249,7 @@ export class SearchOrganizationsComponent { //console.log(err); this.handleError("Error getting organizations", err); this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - this.searchUtils.totalResults = 0; + //this.searchUtils.totalResults = 0; //TODO check erros (service not available, bad request) // if( ){ // this.searchUtils.status = errorCodes.ERROR; @@ -207,10 +266,10 @@ export class SearchOrganizationsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); } - ); + )); } } diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index c0f193ec..1756e9c4 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -9,6 +9,7 @@ import {SearchCustomFilter, SearchUtilsClass} from './searchUtils/searchUtils.cl import {EnvProperties} from '../utils/properties/env-properties'; import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class"; +import {properties} from "../../../environments/environment"; @Component({ selector: 'search-projects', @@ -19,10 +20,12 @@ import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class"; type="projects" [results]="results" [searchUtils]="searchUtils" + [sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size" [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" csvPath="projects" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" + [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [openaireLink]=openaireLink @@ -60,6 +63,7 @@ export class SearchProjectsComponent { public resourcesQuery = "(oaftype exact project)"; public csvParams: string; public disableForms: boolean = false; + public disableRefineForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; public pagingLimit: number = 0; @@ -75,45 +79,74 @@ export class SearchProjectsComponent { @Output() searchPageUpdates = new EventEmitter(); @Input() showAdvancedSearchLink:boolean = true; - constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) { + subs: any[] = []; + constructor (private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService ) { this.results =[]; this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); this.searchUtils.status = this.errorCodes.LOADING; - - - - + this.searchUtils.refineStatus = this.errorCodes.LOADING; } + ngOnInit() { - this.route.data - .subscribe((data: { envSpecific: EnvProperties }) => { - this.properties= data.envSpecific; + // this.route.data + // .subscribe((data: { envSpecific: EnvProperties }) => { + this.properties= properties; if (!this.simpleSearchLink) { this.simpleSearchLink = this.properties.searchLinkToProjects; } this.advancedSearchLink = this.properties.searchLinkToAdvancedProjects; this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink; - this.pagingLimit = data.envSpecific.pagingLimit; - this.isPiwikEnabled = data.envSpecific.enablePiwikTrack; + this.pagingLimit = properties.pagingLimit; + this.isPiwikEnabled = properties.enablePiwikTrack; - }); + // }); //var errorCodes:ErrorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; var firstLoad = true; - this.sub = this.route.queryParams.subscribe(params => { + this.subs.push(this.route.queryParams.subscribe(params => { this.loadPaging = true; if(params['page'] && this.searchUtils.page != params['page']) { this.loadPaging = false; this.oldTotalResults = this.searchUtils.totalResults; } var refine = true; - if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) { + if ( + ( + this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) + && (this.searchUtils.page == 1 || params['page']) + ) + && this.filters && !firstLoad + ) { + refine = false; + this.searchUtils.status = this.errorCodes.DONE; + } + + if ( + ( + this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy']) + && (this.searchUtils.sortBy == "" || params['sortBy']) + ) + && this.filters && !firstLoad + ) { refine = false; + this.searchUtils.status = this.errorCodes.DONE; } + + if ( + ( + this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size']) + && (this.searchUtils.size == 10 || params['size']) + ) + && this.filters && !firstLoad + ) { + refine = false; + this.searchUtils.status = this.errorCodes.DONE; + } + let page = (params['page']=== undefined)?1:+params['page']; this.searchUtils.page = ( page <= 0 ) ? 1 : page; @@ -125,14 +158,51 @@ 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"); + if(refine) { + this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); + } this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad)); firstLoad = false; - }); + })); } ngOnDestroy() { - this.sub.unsubscribe(); + for (let sub of this.subs) { + sub.unsubscribe(); + } } - sub: any; + + public _getFilters(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) { + if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) { + this.searchUtils.refineStatus = this.errorCodes.LOADING; + this.disableRefineForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); + this.subs.push(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery) + //.switchMap( + .subscribe( + data => { + if (refine) { + this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]); + this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); + } + + this.searchUtils.refineStatus = this.errorCodes.DONE; + // if (this.searchUtils.totalResults == 0) { + // this.searchUtils.status = this.errorCodes.NONE; + // } + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + }, + err => { + this.handleError("Error getting projects: ", err); + this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status); + + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + } + )); + } + } + public getResults(parameters:string, page: number, size: number, refine: boolean, refineFieldsFilterQuery = null){ if(page > this.pagingLimit) { size=0; @@ -153,20 +223,22 @@ export class SearchProjectsComponent { this.searchUtils.status = this.errorCodes.LOADING; //this.searchPage.openLoading(); this.disableForms = true; - this.searchPageUpdates.emit({disableForms: this.disableForms,searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); this.results = []; this.searchUtils.totalResults = 0; //console.info("Advanced Search for Publications: Execute search query "+parameters); - this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( + this.subs.push(this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( + //this._searchProjectsService.advancedSearchProjects(parameters, page, size, this.properties,(refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery).subscribe( data => { this.searchUtils.totalResults = data[0]; this.results = data[1]; // this.searchPage.updateBaseUrlWithParameters(); - if (refine) { - this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults); - this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); - }else{ + // if (refine) { + // this.filters = this.searchPage.prepareFiltersToShow(data[2], this.searchUtils.totalResults); + // this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); + // }else{ + if(!refine) { this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false); } @@ -177,7 +249,7 @@ export class SearchProjectsComponent { } //this.searchPage.closeLoading(); this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) if(this.searchUtils.status == this.errorCodes.DONE) { // Page out of limit!!! @@ -195,7 +267,7 @@ export class SearchProjectsComponent { //console.log(err); this.handleError("Error getting projects", err); this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - this.searchUtils.totalResults = null; + //this.searchUtils.totalResults = null; //TODO check erros (service not available, bad request) // if( ){ // this.searchUtils.status = errorCodes.ERROR; @@ -212,10 +284,10 @@ export class SearchProjectsComponent { //this.searchPage.closeLoading(); this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) } - ); + )); } } diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index e51a7e7e..e2d804d2 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -11,7 +11,6 @@ import {NewSearchPageComponent} from "./searchUtils/newSearchPage.component"; import {RangeFilter} from "../utils/rangeFilter/rangeFilterHelperClasses.class"; import {properties} from "../../../environments/environment"; - @Component({ selector: 'search-research-results', template: ` @@ -21,10 +20,12 @@ import {properties} from "../../../environments/environment"; [type]="getEntityName(resultType, true, true)" [results]="results" [searchUtils]="searchUtils" + [sortedByChanged]="searchUtils.sortBy" [resultsPerPageChanged]="searchUtils.size" [fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" [csvParams]="csvParams" [csvPath]="getEntityName(resultType, true, false)" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [disableForms]="disableForms" + [disableRefineForms]="disableRefineForms" [loadPaging]="loadPaging" [oldTotalResults]="oldTotalResults" [openaireLink]=openaireLink @@ -65,6 +66,7 @@ export class SearchResearchResultsComponent { public resourcesQuery = "((oaftype exact result) and (resulttypeid exact " + this.resultType + "))"; public csvParams: string; public disableForms: boolean = false; + public disableRefineForms: boolean = false; public loadPaging: boolean = true; public oldTotalResults: number = 0; @Input() openaireLink: string; @@ -92,6 +94,7 @@ export class SearchResearchResultsComponent { this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); this.searchUtils.status = this.errorCodes.LOADING; + this.searchUtils.refineStatus = this.errorCodes.LOADING; } ngOnInit() { @@ -108,16 +111,46 @@ export class SearchResearchResultsComponent { this.searchUtils.status = this.errorCodes.LOADING; var firstLoad = true; this.subs.push(this.route.queryParams.subscribe(params => { + //this.subs.push(this.route.queryParams.switchMap(params => { this.loadPaging = true; if (params['page'] && this.searchUtils.page != params['page']) { this.loadPaging = false; this.oldTotalResults = this.searchUtils.totalResults; } var refine = true; - if (this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) && this.filters && !firstLoad) { + if ( + ( + this.searchUtils.page != ((params['page'] === undefined) ? 1 : +params['page']) + && (this.searchUtils.page == 1 || params['page']) + ) + && this.filters && !firstLoad + ) { refine = false; - + this.searchUtils.status = this.errorCodes.DONE; } + + if ( + ( + this.searchUtils.sortBy != ((params['sortBy'] === undefined) ? "" : params['sortBy']) + && (this.searchUtils.sortBy == "" || params['sortBy']) + ) + && this.filters && !firstLoad + ) { + refine = false; + this.searchUtils.status = this.errorCodes.DONE; + } + + if ( + ( + this.searchUtils.size != ((params['size'] === undefined) ? 10 : +params['size']) + && (this.searchUtils.size == 10 || params['size']) + ) + && this.filters && !firstLoad + ) { + refine = false; + this.searchUtils.status = this.errorCodes.DONE; + } + let page = (params['page'] === undefined) ? 1 : +params['page']; this.searchUtils.page = (page <= 0) ? 1 : page; @@ -130,7 +163,11 @@ export class SearchResearchResultsComponent { this.searchUtils.sortBy = ""; } this.selectedFields = []; - this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap, this.customFilter, params, this.resultType, this.quickFilter); + + this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, this.rangeFields, this.fieldIdsMap,this.customFilter,params, this.resultType, this.quickFilter); + if(refine) { + this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, "", true, this.searchPage.getSearchAPIQueryForRangeFields(params)+this.searchPage.getSearchAPIQueryForRefineFields(params, 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; })); @@ -142,6 +179,38 @@ export class SearchResearchResultsComponent { } } + public _getFilters(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) { + if (page <= this.pagingLimit || this.searchUtils.refineStatus == this.errorCodes.LOADING) { + this.searchUtils.refineStatus = this.errorCodes.LOADING; + this.disableRefineForms = true; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); + this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery) + //.switchMap( + .subscribe( + data => { + if (refine) { + this.filters = this.searchPage.prepareFiltersToShow(data[2], data[0]); + this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); + } + + this.searchUtils.refineStatus = this.errorCodes.DONE; + // if (this.searchUtils.totalResults == 0) { + // this.searchUtils.status = this.errorCodes.NONE; + // } + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + }, + err => { + this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err); + this.searchUtils.refineStatus = this.errorMessages.getErrorCode(err.status); + + this.disableRefineForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + } + )); + } + } + public _getResults(parameters: string, page: number, size: number, sortBy: string, refine: boolean, refineFieldsFilterQuery = null) { if (page > this.pagingLimit) { size = 0; @@ -157,65 +226,66 @@ export class SearchResearchResultsComponent { this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; - this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}); + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}); this.results = []; this.searchUtils.totalResults = 0; - this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery) + //this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, (refine) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery) + this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery) .subscribe( - data => { - this.searchUtils.totalResults = data[0]; - 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); - } - - this.searchUtils.status = this.errorCodes.DONE; - if (this.searchUtils.totalResults == 0) { - this.searchUtils.status = this.errorCodes.NONE; - } - this.disableForms = false; - this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) - - if (this.searchUtils.status == this.errorCodes.DONE) { - // Page out of limit!!! - let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size); - if (!(Number.isInteger(totalPages))) { - totalPages = (parseInt(totalPages, 10) + 1); - } - if (totalPages < page) { - this.searchUtils.totalResults = 0; - this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; - } - } - }, - err => { - this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err); - this.searchUtils.status = this.errorMessages.getErrorCode(err.status); - this.searchUtils.totalResults = null; - //TODO check erros (service not available, bad request) - // if( ){ - // this.searchUtils.status = ErrorCodes.ERROR; - // } - //var errorCodes:ErrorCodes = new ErrorCodes(); - //this.searchUtils.status = errorCodes.NOT_AVAILABLE; - /*if(err.status == '404') { - this.searchUtils.status = this.errorCodes.NOT_FOUND; - } else if(err.status == '500') { - this.searchUtils.status = this.errorCodes.ERROR; - } else { - this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; - }*/ - - //this.searchPage.closeLoading(); - this.disableForms = false; - - this.searchPageUpdates.emit({disableForms: this.disableForms, searchUtils: this.searchUtils}) - + data => { + this.searchUtils.totalResults = data[0]; + this.results = data[1]; + // if (refine) { + // this.filters = this.searchPage.prepareFiltersToShow(data[2],this.searchUtils.totalResults); + // this.rangeFilters = this.searchPage.prepareRangeFiltersToShow(); + // } else { + if(!refine) { + this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false); } - )); + + this.searchUtils.status = this.errorCodes.DONE; + if (this.searchUtils.totalResults == 0) { + this.searchUtils.status = this.errorCodes.NONE; + } + this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + + if (this.searchUtils.status == this.errorCodes.DONE) { + // Page out of limit!!! + let totalPages: any = this.searchUtils.totalResults / (this.searchUtils.size); + if (!(Number.isInteger(totalPages))) { + totalPages = (parseInt(totalPages, 10) + 1); + } + if (totalPages < page) { + this.searchUtils.totalResults = 0; + this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; + } + } + }, + err => { + this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err); + this.searchUtils.status = this.errorMessages.getErrorCode(err.status); + + //TODO check erros (service not available, bad request) + // if( ){ + // this.searchUtils.status = ErrorCodes.ERROR; + // } + //var errorCodes:ErrorCodes = new ErrorCodes(); + //this.searchUtils.status = errorCodes.NOT_AVAILABLE; + /*if(err.status == '404') { + this.searchUtils.status = this.errorCodes.NOT_FOUND; + } else if(err.status == '500') { + this.searchUtils.status = this.errorCodes.ERROR; + } else { + this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; + }*/ + + //this.searchPage.closeLoading(); + this.disableForms = false; + this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils}) + + } + )); } } diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 8f3c22fc..83fd1d62 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -11,10 +11,11 @@ - + - - + - + - +
+ + +
No filters available
    - + +
  • - - + +
  • -
  • @@ -159,7 +169,7 @@ [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields" (queryChange)="queryChanged()" - [isDisabled]="disableForms" + [isDisabled]="disableForms || disableRefineForms" [simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink" [advancedSearchLinkParameters] @@ -192,9 +202,7 @@ addClass=" " [breadcrumbs]="breadcrumbs"> -
    +
    @@ -335,7 +248,7 @@ Advanced + [class]="((disableForms || disableRefineForms)?' uk-disabled uk-link-muted ':'') +' portal-link uk-float-right '">Advanced search - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + -
    -
    -
    - Filters: - +
    + + +
    +
    -
    - -
    -
    -
    - - +
    +
    +
    + Filters: + +
    + +
    +
    +
    + + + + +
    -
    - - - +
    + + + - + +
    +
    + + +
    + + + + + + + +
    + + + + + + +
    + +
    +

    For more results please try a new, more specific query

    +
    + +
    + + + + + + + +
    + + + Last index information +
    -
    - -
    - - - - - - - -
    - - - - - - -
    - -
    -

    For more results please try a new, more specific query

    -
    - -
    - - - - - - -
    - - - Last index information - -
    + -
    +
    -
    diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 38c6ebeb..1e135162 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -47,11 +47,14 @@ export class NewSearchPageComponent { @Input() simpleSearchLink: string = ""; @Input() advancedSearchLink: string = ""; @Input() disableForms: boolean = false; + @Input() disableRefineForms: boolean = false; @Input() loadPaging: boolean = true; @Input() oldTotalResults: number = 0; @Input() openaireLink: string; @Input() customFilter: SearchCustomFilter; @Input() sort: boolean = true; + @Input() sortedByChanged: string = ""; + @Input() resultsPerPageChanged: number; @Input() searchFormClass: string = "searchForm"; //From simple: @Input() rangeFilters: RangeFilter[] = []; @@ -153,6 +156,7 @@ export class NewSearchPageComponent { }else if(!this.simpleView && this.advancedSearchLink) { this.breadcrumbs.push({name: "Advanced Search", route: null}); } + //console.log(this.filters) } private getPageContents() { @@ -250,6 +254,7 @@ export class NewSearchPageComponent { if (this.quickFilter) { this.removeValueFromQuickFilter(); } + this.resultTypes = {}; for(let type of this.resultTypeOptions){ this.resultTypes[type.id]=false; } @@ -289,12 +294,15 @@ export class NewSearchPageComponent { sizeChanged($event) { - this.searchUtils.size = $event.value; + //this.searchUtils.size = $event.value; + this.resultsPerPageChanged = $event; + this.goTo(1); } sortByChanged($event) { - this.searchUtils.sortBy = $event.value; + //this.searchUtils.sortBy = $event.value; + this.sortedByChanged = $event; this.goTo(1); } @@ -1162,14 +1170,18 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal this.parameterValues.push("" + this.searchUtils.page); } - if (this.searchUtils.size != this.resultsPerPage) { + //if (this.searchUtils.size != this.resultsPerPage) { + if (this.resultsPerPageChanged && this.resultsPerPageChanged != this.resultsPerPage) { 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) { + if (this.sort && this.sortByChanged) { this.parameterNames.push("sortBy"); - this.parameterValues.push(this.searchUtils.sortBy); + //this.parameterValues.push(this.searchUtils.sortBy); + this.parameterValues.push(this.sortedByChanged); } for (let filter of filters) { var filterLimits = ""; @@ -1410,6 +1422,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal this.showUnknownFilters = true; this.filters = filters; } + this.buildPageURLParameters(this.URLCreatedFilters, this.URLCreatedRangeFilters, true); //this.checkSelectedRangeFilters(this.rangeFilters); diff --git a/searchPages/searchUtils/searchResultsPerPage.component.ts b/searchPages/searchUtils/searchResultsPerPage.component.ts index 4c11bfea..f325a355 100644 --- a/searchPages/searchUtils/searchResultsPerPage.component.ts +++ b/searchPages/searchUtils/searchResultsPerPage.component.ts @@ -30,8 +30,6 @@ export class SearchResultsPerPageComponent { ngOnInit() {} sizeChanged() { - this.sizeChange.emit({ - value: this.size - }); + this.sizeChange.emit(this.size); } } diff --git a/searchPages/searchUtils/searchSorting.component.ts b/searchPages/searchUtils/searchSorting.component.ts index b6b6f820..286de550 100644 --- a/searchPages/searchUtils/searchSorting.component.ts +++ b/searchPages/searchUtils/searchSorting.component.ts @@ -44,8 +44,6 @@ export class SearchSortingComponent { sortByChanged() { - this.sortByChange.emit({ - value: this.sortBy - }); + this.sortByChange.emit(this.sortBy); } } diff --git a/searchPages/searchUtils/searchUtils.class.ts b/searchPages/searchUtils/searchUtils.class.ts index 6963b8da..47e7f718 100644 --- a/searchPages/searchUtils/searchUtils.class.ts +++ b/searchPages/searchUtils/searchUtils.class.ts @@ -2,6 +2,7 @@ export class SearchUtilsClass{ page:number = 1; size:number = 10; status:number = 1; + refineStatus:number = 1; keyword:string = ""; baseUrl:string = ""; totalResults = null;