From 76c9977a5437a624937ec0c6bed569342be53b95 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Tue, 20 Oct 2020 11:21:37 +0000 Subject: [PATCH] [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 --- .../searchUtils/newSearchPage.component.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 1526f9a8..9bcd78f6 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -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(",");