From fdcd508a217daaf5e2a5f6bfbde85d911b4eab55 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Tue, 20 Oct 2020 09:17:15 +0000 Subject: [PATCH] [Explore|Trunk] Home component: updates after changing quick-selection component git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@59633 d315682c-612b-4755-9ff5-7f18f6832af3 --- explore/src/app/home/home.component.html | 6 ++-- explore/src/app/home/home.component.ts | 35 +++++++++++++++--------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/explore/src/app/home/home.component.html b/explore/src/app/home/home.component.html index 865c605e..91a00069 100644 --- a/explore/src/app/home/home.component.html +++ b/explore/src/app/home/home.component.html @@ -41,8 +41,7 @@
+ [properties]="properties" >
@@ -576,8 +575,7 @@
+ [properties]="properties">
diff --git a/explore/src/app/home/home.component.ts b/explore/src/app/home/home.component.ts index f491dedc..70415ddc 100644 --- a/explore/src/app/home/home.component.ts +++ b/explore/src/app/home/home.component.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import {Component, Input} from '@angular/core'; import {Subscription} from 'rxjs'; import {ActivatedRoute, Router} from '@angular/router'; import {Location} from '@angular/common'; @@ -149,7 +149,7 @@ export class HomeComponent { selectedEntity = "all"; selectedEntitySimpleUrl; selectedEntityAdvancedUrl; - resultTypes = {publication:true, dataset:true, software:true, other:true}; + resultTypes:Filter = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Result Types",filterOperator:"or"}; public pageContents = null; useHelpText: boolean = true; @@ -229,6 +229,18 @@ export class HomeComponent { this.showProjects = showEntity["project"]; this.showDataProviders = showEntity["datasource"]; this.showOrganizations = showEntity["organization"]; + if(this.showPublications){ + this.resultTypes.values.push({name: "Publications" , id:"publications",selected:true, number:0}); + } + if(this.showDatasets){ + this.resultTypes.values.push({name: "Research data" , id:"datasets",selected:true, number:0}); + } + if(this.showSoftware){ + this.resultTypes.values.push({name: "Software" , id:"software",selected:true, number:0}); + } + if(this.showOrp){ + this.resultTypes.values.push({name: "Other research products" , id:"other",selected:true, number:0}); + } this.getNumbers(); // if(this.showDataProviders) { // this.fetchDataproviders.getResultsForHome(this.numResults, this.properties); @@ -376,22 +388,18 @@ export class HomeComponent { if (this.selectedEntity == "result") { if (this.resultTypes) { let values = []; - if (this.resultTypes.publication) { - values.push("publications"); - } - if (this.resultTypes.dataset) { - values.push("datasets"); - } - if (this.resultTypes.software) { - values.push("software"); - } - if (this.resultTypes.other) { - values.push("other"); + console.log(this.resultTypes.values) + for(let value of this.resultTypes.values){ + if (value.selected) { + values.push(value.id); + } } if (values.length > 0 && values.length !=4) { parameterNames.push("type"); parameterValues.push(values.join(",")); } + console.log(parameterNames) + console.log(parameterValues) if (this.resultsQuickFilter) { parameterNames.push("qf"); parameterValues.push("" + this.resultsQuickFilter.selected); @@ -404,6 +412,7 @@ export class HomeComponent { parameterNames.push("op"); parameterValues.push("and"); } + console.log( this.routerHelper.createQueryParams(parameterNames, parameterValues)) this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)}); } }