[Library|Trunk]

New search:
        fix issue with quick selections

add Page URL resolver component: to properly redirect old  routes to new research outcomes search page



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58156 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-02-28 10:05:59 +00:00
parent 1c7412cd63
commit c88ec8c54f
4 changed files with 66 additions and 14 deletions

View File

@ -130,7 +130,6 @@ export class SearchResearchResultsComponent {
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 = "";
} }
console.log(params);
this.selectedFields = []; 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);
this._getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, this.searchUtils.sortBy, refine, 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));

View File

@ -176,19 +176,14 @@ export class NewSearchPageComponent {
} }
} }
this.selectedFilters = 0; this.selectedFilters = 0;
//<<<<<<< .mine
for(let i = 0; i < this.rangeFilters.length; i++) { for(let i = 0; i < this.rangeFilters.length; i++) {
this.rangeFilters[i].selectedFromValue = null; this.rangeFilters[i].selectedFromValue = null;
this.rangeFilters[i].selectedToValue = null; this.rangeFilters[i].selectedToValue = null;
} }
this.selectedRangeFilters = 0; this.selectedRangeFilters = 0;
//||||||| .r58066
//=======
if (this.quickFilter) { if (this.quickFilter) {
this.removeValueFromQuickFilter(); this.removeValueFromQuickFilter();
} }
//>>>>>>> .r58095
this.goTo(1); this.goTo(1);
// this.clearKeywords(); // this.clearKeywords();
} }
@ -731,14 +726,15 @@ export class NewSearchPageComponent {
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId))); allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
} }
if (this.quickFilter) { if (this.quickFilter && this.entityType == "result") {
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["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))) { || ((URLparams[this.quickFilter.filterId] != undefined && StringUtils.URIDecode(URLparams[this.quickFilter.filterId]).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1).indexOf(StringUtils.quote(this.quickFilter.value)) != -1))) {
this.quickFilter.selected = true; this.quickFilter.selected = true;
} else { } else {
this.quickFilter.selected = false; 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); allFqs += "&fq=resultbestaccessright exact " + StringUtils.quote(this.quickFilter.value);
} }
} }
@ -1028,7 +1024,8 @@ export class NewSearchPageComponent {
// 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.parameterValues)
} }
/** /**

View File

@ -78,17 +78,21 @@ export class QuickSelectionsComponent implements OnChanges {
quickFilterChanged() { quickFilterChanged() {
let value = this.control.getRawValue(); let value = this.control.getRawValue();
this.quickFilter.selected = value.QFselected; this.quickFilter.selected = value.QFselected;
this.quickFilter.filter.countSelectedValues = 0;
if(this.quickFilter.filter) { if(this.quickFilter.filter) {
if (value.QFselected) { if (value.QFselected) {
for (let filterValue of this.quickFilter.filter.values) { 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 { } else {
for (let filterValue of this.quickFilter.filter.values) { for (let filterValue of this.quickFilter.filter.values) {
filterValue.selected = false; filterValue.selected = false;
} }
this.quickFilter.filter.countSelectedValues = 0;
} }
} }
this.typeChange.emit({}); this.typeChange.emit({});

View File

@ -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})
}
}
}