[Library|Trunk]

Add custom filter parameters when switching from simple to advanced search pages or change entities


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59938 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-23 16:08:36 +00:00
parent 39f5218fa1
commit fa25562aea
4 changed files with 13 additions and 1 deletions

View File

@ -513,6 +513,9 @@ export class SearchAllComponent {
if ( this.keyword.length > 0) { if ( this.keyword.length > 0) {
this.parameters["fv0"] = this.keyword; this.parameters["fv0"] = this.keyword;
this.parameters["f0"] = "q"; this.parameters["f0"] = "q";
}
if(this.customFilter){
this.parameters = this.customFilter.getParameters(this.parameters);
} }
this.router.navigate(["/search/find"], {queryParams: this.parameters}); this.router.navigate(["/search/find"], {queryParams: this.parameters});
} }

View File

@ -2,6 +2,7 @@
<a *ngIf="showSwitchSearchLink && simpleSearchLink && simpleSearchLink.length > 0" <a *ngIf="showSwitchSearchLink && simpleSearchLink && simpleSearchLink.length > 0"
routerLinkActive="router-link-active" routerLinkActive="router-link-active"
[routerLink]=simpleSearchLink style="z-index:1;" [routerLink]=simpleSearchLink style="z-index:1;"
[queryParams]="customFilter?customFilter.getParameters():{}"
[class]="(isDisabled)?'uk-float-right uk-disabled uk-link-muted portal-link uk-margin-right ':'uk-float-right portal-link uk-margin-right '">Quick search [class]="(isDisabled)?'uk-float-right uk-disabled uk-link-muted portal-link uk-margin-right ':'uk-float-right portal-link uk-margin-right '">Quick search
</a> </a>
<h6 class="uk-margin-small-bottom"> <h6 class="uk-margin-small-bottom">

View File

@ -216,7 +216,7 @@ export class EntitiesSelectionComponent {
entityChanged() { entityChanged() {
if (!this.simpleView || this.onChangeNavigate) { if (!this.simpleView || this.onChangeNavigate) {
this.router.navigate([this.getUrl(this.simpleView)]); this.router.navigate([this.getUrl(this.simpleView)], {queryParams: this.customFilter?this.customFilter.getParameters():{}});
} else { } else {
this.selectionChange.emit({ this.selectionChange.emit({
entity: this.selectedEntity, entity: this.selectedEntity,

View File

@ -27,6 +27,14 @@ export class SearchCustomFilter{
this.selected = null; this.selected = null;
this.promptToAddFilter = false; this.promptToAddFilter = false;
} }
public getParameters(params={}){
if(!this.isHiddenFilter){
params[this.queryFieldName] = this.valueId;
params['cf'] = true;
}
return params;
}
// public setFilter(filter:SearchCustomFilter){ // public setFilter(filter:SearchCustomFilter){
// if(!filter){ // if(!filter){
// return; // return;