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