[Aggregator|Trunk]

- Home search form: Add custom filter parameters when switching from simple to advanced search pages or change entities
- add custom filter in advanced search results


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-aggregator-portal/trunk@59939 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-23 16:09:45 +00:00
parent 94bace40e7
commit 1e4e5756f7
3 changed files with 28 additions and 7 deletions

View File

@ -10,7 +10,7 @@
<div class="uk-margin-small-top uk-padding-remove-left"> <div class="uk-margin-small-top uk-padding-remove-left">
<entities-selection [simpleView]="true" currentEntity="all" [selectedEntity]="selectedEntity" <entities-selection [simpleView]="true" currentEntity="all" [selectedEntity]="selectedEntity"
[properties]="properties" [onChangeNavigate]="false" [properties]="properties" [onChangeNavigate]="false"
(selectionChange)="entityChanged($event)" (selectionChange)="entityChanged($event)" [customFilter]="customFilter"
></entities-selection> ></entities-selection>
</div> </div>
<div class=" uk-padding-remove-left uk-margin-small-top"> <div class=" uk-padding-remove-left uk-margin-small-top">
@ -43,20 +43,20 @@
<ul class="uk-list uk-margin-remove-bottom"> <ul class="uk-list uk-margin-remove-bottom">
<li *ngIf="showSoftware || showPublications || showOrp || showDatasets"><a <li *ngIf="showSoftware || showPublications || showOrp || showDatasets"><a
[routerLink]="properties.searchLinkToAdvancedResults" [routerLink]="properties.searchLinkToAdvancedResults"
[queryParams]="{qf:true, q: keyword, op: 'and'}" [queryParams]="getQueryParamsForAdvancedSearch('result')"
>Research >Research
outcomes</a></li> outcomes</a></li>
<li *ngIf="showProjects"><a <li *ngIf="showProjects"><a
[routerLink]="properties.searchLinkToAdvancedProjects" [routerLink]="properties.searchLinkToAdvancedProjects"
[queryParams]="{q: keyword, op: 'and'}"> [queryParams]="getQueryParamsForAdvancedSearch('project')">
Projects</a></li> Projects</a></li>
<li *ngIf="showDataProviders"><a <li *ngIf="showDataProviders"><a
[routerLink]="properties.searchLinkToAdvancedDataProviders" [routerLink]="properties.searchLinkToAdvancedDataProviders"
[queryParams]="{q: keyword, op: 'and'}"> [queryParams]="getQueryParamsForAdvancedSearch('datasource')">
Content providers</a></li> Content providers</a></li>
<li *ngIf="showOrganizations"><a <li *ngIf="showOrganizations"><a
[routerLink]="properties.searchLinkToAdvancedOrganizations" [routerLink]="properties.searchLinkToAdvancedOrganizations"
[queryParams]="{q: keyword, op: 'and'}"> [queryParams]="getQueryParamsForAdvancedSearch('organization')">
Organizations</a></li> Organizations</a></li>
</ul> </ul>
</div> </div>

View File

@ -332,7 +332,28 @@ export class HomeComponent {
parameterNames.push("f0"); parameterNames.push("f0");
parameterValues.push("q"); parameterValues.push("q");
} }
console.log( this.routerHelper.createQueryParams(parameterNames, parameterValues)) if(this.customFilter){
parameterNames.push(this.customFilter.queryFieldName);
parameterValues.push(this.customFilter.valueId);
parameterNames.push("cf");
parameterValues.push("true");
}
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)}); this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
} }
getQueryParamsForAdvancedSearch(entity){
let params = {};
if (entity == "result") {
if (this.resultsQuickFilter) {
params["qf"] = "" + this.resultsQuickFilter.selected;
}
}
if(this.keyword.length > 0) {
params["fv0"] = "" + this.keyword;
params["f0"] = "q";
}
if(this.customFilter){
params = this.customFilter.getParameters(params);
}
return params;
}
} }

View File

@ -8,7 +8,7 @@ import {properties} from "../../../environments/environment";
@Component({ @Component({
selector: 'openaire-search-results', selector: 'openaire-search-results',
template: ` template: `
<search-research-results resultType="result" [simpleView]="false"></search-research-results> <search-research-results resultType="result" [simpleView]="false" [customFilter]="customFilter"></search-research-results>
` `
}) })