[Library|Trunk]

Search: fix result types initialization - show only for results


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59636 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-10-20 11:21:37 +00:00
parent 9818056509
commit 76c9977a54
1 changed files with 7 additions and 10 deletions

View File

@ -79,7 +79,7 @@ export class NewSearchPageComponent {
@Input() keywordFields = [];
@Input() simpleView: boolean = true;
@Input() formPlaceholderText = "Type Keywords...";
@Input() resultTypes:Filter = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"};
@Input() resultTypes:Filter = null;
resultTypeOptions = {"publications":{"id":"publication", "name":"Publications"},"datasets":{"id":"dataset", "name":"Research data"},
"software":{"id":"software", "name":"Software"},"other":{"id":"other", "name":" Other research products"}};
selectedTypesNum = 0;
@ -277,12 +277,9 @@ export class NewSearchPageComponent {
if (this.quickFilter) {
this.removeValueFromQuickFilter();
}
// this.resultTypes = new Filter();
// this.resultTypes.filterId = "";
this.resultTypes.values = [];
// for(let type of this.resultTypeOptions){
// this.resultTypes.values.push({name: type.name , id:type.id,selected:false, number:0});
// }
if(this.resultTypes) {
this.resultTypes.values = [];
}
this.goTo(1);
// this.clearKeywords();
}
@ -1324,7 +1321,7 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
this.parameterValues.push(this.searchUtils.keyword);
}
if (this.resultTypes && this.entityType == "result") {
if (this.resultTypes && (this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
let values = [];
for(let value of this.resultTypes.values){
values.push(value.id);
@ -1405,8 +1402,8 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
filters.push(filter)
}
}
if (this.entityType == "result") {
this.resultTypes.values = [];
if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"};
if (URLparams["type"]) {
let types = URLparams["type"];
types = Array.isArray(types) ? types.join(',').split(","):types.split(",");