diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index 290b4d6e..e4769485 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -130,7 +130,6 @@ export class SearchResearchResultsComponent { if (this.searchUtils.sortBy && this.searchUtils.sortBy != "resultdateofacceptance,descending" && this.searchUtils.sortBy != "resultdateofacceptance,ascending") { this.searchUtils.sortBy = ""; } -console.log(params); 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)); diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index c6e47f0c..af1acc8c 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -176,19 +176,14 @@ export class NewSearchPageComponent { } } this.selectedFilters = 0; -//<<<<<<< .mine - for(let i = 0; i < this.rangeFilters.length; i++) { this.rangeFilters[i].selectedFromValue = null; this.rangeFilters[i].selectedToValue = null; } this.selectedRangeFilters = 0; -//||||||| .r58066 -//======= if (this.quickFilter) { this.removeValueFromQuickFilter(); } -//>>>>>>> .r58095 this.goTo(1); // this.clearKeywords(); } @@ -731,14 +726,15 @@ export class NewSearchPageComponent { allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))); } - if (this.quickFilter) { - if ((this.entityType == "result" && firstLoad && URLparams[this.quickFilter.filterId] == undefined && (URLparams["qf"] == undefined || URLparams["qf"] == "true")) - || ((this.entityType == "result" && URLparams[this.quickFilter.filterId] != undefined && StringUtils.URIDecode(URLparams[this.quickFilter.filterId]).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1).indexOf(StringUtils.quote(this.quickFilter.value)) != -1))) { + if (this.quickFilter && this.entityType == "result") { + if((firstLoad && URLparams[this.quickFilter.filterId] == undefined && URLparams["qf"] == undefined) || URLparams["qf"] == "true" + || ((URLparams[this.quickFilter.filterId] != undefined && StringUtils.URIDecode(URLparams[this.quickFilter.filterId]).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1).indexOf(StringUtils.quote(this.quickFilter.value)) != -1))) { this.quickFilter.selected = true; } else { this.quickFilter.selected = false; } - if (this.entityType == "result" && firstLoad && URLparams[this.quickFilter.filterId] == undefined && (URLparams["qf"] == undefined || URLparams["qf"] == "true")) { + if ((firstLoad && URLparams[this.quickFilter.filterId] == undefined && URLparams["qf"] == undefined) + ||( URLparams[this.quickFilter.filterId] == undefined && URLparams["qf"] == "true")) { allFqs += "&fq=resultbestaccessright exact " + StringUtils.quote(this.quickFilter.value); } } @@ -1028,7 +1024,8 @@ export class NewSearchPageComponent { // this.parameterNames.push("sortBy"); // this.parameterValues.push(this.searchUtils.sortBy); // } - + // console.log(this.parameterNames) + // console.log(this.parameterValues) } /** diff --git a/searchPages/searchUtils/quick-selections.component.ts b/searchPages/searchUtils/quick-selections.component.ts index e7791862..4479f3e3 100644 --- a/searchPages/searchUtils/quick-selections.component.ts +++ b/searchPages/searchUtils/quick-selections.component.ts @@ -78,17 +78,21 @@ export class QuickSelectionsComponent implements OnChanges { quickFilterChanged() { let value = this.control.getRawValue(); this.quickFilter.selected = value.QFselected; + this.quickFilter.filter.countSelectedValues = 0; if(this.quickFilter.filter) { if (value.QFselected) { for (let filterValue of this.quickFilter.filter.values) { - filterValue.selected = (filterValue.name == this.quickFilter.value) + if((filterValue.name == this.quickFilter.value)) { + filterValue.selected = true + this.quickFilter.filter.countSelectedValues = 1; + }else{ + filterValue.selected = false; + } } - this.quickFilter.filter.countSelectedValues = 1; } else { for (let filterValue of this.quickFilter.filter.values) { filterValue.selected = false; } - this.quickFilter.filter.countSelectedValues = 0; } } this.typeChange.emit({}); diff --git a/utils/pageURLResolver.component.ts b/utils/pageURLResolver.component.ts new file mode 100644 index 00000000..a46640ca --- /dev/null +++ b/utils/pageURLResolver.component.ts @@ -0,0 +1,52 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; + + +@Component({ + selector: 'page-URL-resolver', + template: ` + ` +}) + +export class PageURLResolverComponent { + parameters= {}; + constructor(private route: ActivatedRoute, private router : Router) { + } + + ngOnInit() { + this.route.queryParams.subscribe(params => { + console.log(params); + this.parameters = Object.assign({}, params); + this.navigateTO(this.router.url.split("?")[0]) + + }); + } + + navigateTO(url:string){ + if( url == "/search/find/publications" ){ + this.parameters["type"]="publications"; + this.router.navigate(["/search/find/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/find/datasets" ){ + this.parameters["type"]="datasets"; + this.router.navigate(["/search/find/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/find/software" ){ + this.parameters["type"]="software"; + this.router.navigate(["/search/find/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/find/other" ){ + this.parameters["type"]="other"; + this.router.navigate(["/search/find/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/advanced/publications" ){ + this.parameters["type"]="publications"; + this.router.navigate(["/search/advanced/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/advanced/datasets" ){ + this.parameters["type"]="datasets"; + this.router.navigate(["/search/advanced/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/advanced/software" ){ + this.parameters["type"]="software"; + this.router.navigate(["/search/advanced/research-results"],{queryParams:this.parameters}) + }else if( url == "/search/advanced/other" ){ + this.parameters["type"]="other"; + this.router.navigate(["/search/advanced/research-results"],{queryParams:this.parameters}) + } + } +}