From 504fdfaa3c4c8f29c53b126644904b153300a8f7 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 12 Jun 2019 14:13:56 +0000 Subject: [PATCH] [Library|Trunk] Changes for Aggregator portal: use a customFilter in search pages, and pass it through the components for landing pages check if a route is available in order to add linking and deposit links git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56059 d315682c-612b-4755-9ff5-7f18f6832af3 --- landingPages/dataset/dataset.component.html | 4 +-- landingPages/dataset/dataset.component.ts | 10 ++++++++ landingPages/orp/orp.component.html | 5 ++-- landingPages/orp/orp.component.ts | 10 ++++++++ landingPages/project/project.component.html | 8 +++--- landingPages/project/project.component.ts | 10 ++++++++ .../publication/publication.component.html | 5 ++-- .../publication/publication.component.ts | 10 ++++++++ landingPages/software/software.component.html | 4 +-- landingPages/software/software.component.ts | 10 ++++++++ .../advancedSearchDatasets.component.ts | 5 +++- .../advancedSearchOrganizations.component.ts | 4 ++- .../advanced/advancedSearchOrps.component.ts | 5 +++- .../advancedSearchPublications.component.ts | 4 ++- .../advancedSearchSoftware.component.ts | 4 ++- searchPages/find/search.component.html | 13 +++++----- searchPages/find/search.component.ts | 20 +++++++++++---- .../advancedSearchPage.component.ts | 7 +++++- .../searchUtils/browseEntities.component.ts | 9 ++++--- .../searchUtils/searchPage.component.ts | 7 ++++-- searchPages/searchUtils/searchUtils.class.ts | 25 +++++++++++++++++++ .../simple/searchDatasets.component.ts | 4 ++- .../simple/searchOrganizations.component.ts | 4 ++- searchPages/simple/searchOrps.component.ts | 4 ++- .../simple/searchPublications.component.ts | 4 ++- .../simple/searchSoftware.component.ts | 6 +++-- services/organization.service.ts | 2 +- services/searchOrganizations.service.ts | 5 +++- sharedComponents/navigationBar.component.html | 19 ++++++++------ sharedComponents/navigationBar.component.ts | 2 +- .../fetchDatasets.class.ts | 8 +++--- utils/fetchEntitiesClasses/fetchOrps.class.ts | 7 ++++-- .../fetchPublications.class.ts | 7 ++++-- .../fetchSoftware.class.ts | 8 +++--- 34 files changed, 199 insertions(+), 60 deletions(-) diff --git a/landingPages/dataset/dataset.component.html b/landingPages/dataset/dataset.component.html index 393fd635..837941e5 100644 --- a/landingPages/dataset/dataset.component.html +++ b/landingPages/dataset/dataset.component.html @@ -246,13 +246,13 @@ - -
+
- -
+
- -
+
- -
+
- -
+
- +
@@ -175,7 +175,7 @@
- +
@@ -194,7 +194,7 @@
- +
@@ -213,7 +213,7 @@
- +
@@ -269,11 +269,12 @@
+ type="organization" urlParam="organizationId" [(properties)]=properties >
- +
diff --git a/searchPages/find/search.component.ts b/searchPages/find/search.component.ts index 3a09303f..856f87ac 100644 --- a/searchPages/find/search.component.ts +++ b/searchPages/find/search.component.ts @@ -33,6 +33,7 @@ import {ConfigurationService} from '../../utils/configuration/configurat import {EnvProperties} from '../../utils/properties/env-properties'; import { SEOService } from '../../sharedComponents/SEO/SEO.service'; import {StringUtils} from '../../utils/string-utils.class'; +import {SearchCustomFilter} from "../searchUtils/searchUtils.class"; @Component({ changeDetection: ChangeDetectionStrategy.Default, @@ -101,6 +102,7 @@ export class SearchComponent { @Input() logoURL; @Input() name; @Input() connectCommunityId =null; + @Input() customFilter:SearchCustomFilter= null; @Input() piwikSiteId = null; @Input() formPlaceholderText = "Search for research results, projects, content providers & organizations in OpenAIRE"; @@ -171,13 +173,18 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj this.showOrganizations = false; this.showDataProviders = false; } + if((this.customFilter && this.customFilter.queryFieldName=="country")){ + this.showProjects = false; + // this.showOrganizations = false; + this.showDataProviders = false; + } this.sub = this.route.queryParams.subscribe(params => { this.reloadTabs(); this.keyword = (params['keyword'])?params['keyword']:""; if(this.keyword !=null && this.keyword.length > 0){ - //if showPublications == false will set another entity as the first + //if showPublications == false will setValues another entity as the first if(this.showPublications){ this.activeTab = "publications"; this.searchPublications(); @@ -249,7 +256,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj this.fetchPublications.searchUtils.status != this.errorCodes.NONE /*&& this.fetchPublications.searchUtils.status != this.errorCodes.ERROR*/) { this.reloadPublications = false; - this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId); + this.fetchPublications.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId, this.customFilter); this.linkToSearchPublications = this.properties.searchLinkToPublications;// + "?keyword=" + this.keyword; } } @@ -260,7 +267,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj this.fetchDatasets.searchUtils.status != this.errorCodes.NONE /*&& this.fetchDatasets.searchUtils.status != this.errorCodes.ERROR*/) { this.reloadDatasets = false; - this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId); + this.fetchDatasets.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId, this.customFilter); this.linkToSearchDatasets =this.properties.searchLinkToDatasets;// + "?keyword=" + this.keyword; } } @@ -273,7 +280,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj ( this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || this.fetchSoftware.searchUtils.status == this.errorCodes.DONE )*/) { this.reloadSoftware = false; - this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId); + this.fetchSoftware.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId, this.customFilter); this.linkToSearchSoftware = this.properties.searchLinkToSoftware;// + "?keyword=" + this.keyword; } } @@ -284,7 +291,7 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj this.fetchOrps.searchUtils.status != this.errorCodes.NONE /*&& this.fetchOrps.searchUtils.status != this.errorCodes.ERROR*/) { this.reloadOrps = false; - this.fetchOrps.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId); + this.fetchOrps.getResultsByKeyword(this.keyword, 1, 10,this.properties, this.connectCommunityId, this.customFilter); this.linkToSearchOrps =this.properties.searchLinkToOrps; } } @@ -356,6 +363,9 @@ public subPub;public subData; public subSoftware; public subOrps; public subProj private count() { var refineParams = this.connectCommunityId?("&fq="+StringUtils.URIEncode("communityId exact " + StringUtils.quote((this.connectCommunityId )))):null; + if(this.customFilter){ + refineParams = (refineParams?(refineParams+'&'):'')+"&fq="+StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId ))); + } if(this.activeTab != "publications" && this.showPublications){ this.fetchPublications.searchUtils.status = this.errorCodes.LOADING; this.fetchPublications.results = []; diff --git a/searchPages/searchUtils/advancedSearchPage.component.ts b/searchPages/searchUtils/advancedSearchPage.component.ts index d49a7af2..4d05d09e 100644 --- a/searchPages/searchUtils/advancedSearchPage.component.ts +++ b/searchPages/searchUtils/advancedSearchPage.component.ts @@ -9,7 +9,7 @@ import {Observable} from 'rxjs'; import {Filter, Value, AdvancedField} from '../searchUtils/searchHelperClasses.class'; import {SearchResult} from '../../utils/entities/searchResult'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; -import {SearchUtilsClass} from './searchUtils.class'; +import {SearchCustomFilter, SearchUtilsClass} from './searchUtils.class'; import {ModalLoading} from '../../utils/modal/loading.component'; import {StringUtils, Dates} from '../../utils/string-utils.class'; import {ErrorCodes} from '../../utils/properties/errorCodes'; @@ -43,6 +43,7 @@ export class AdvancedSearchPageComponent { @Input() oldTotalResults: number = 0; @Input() openaireLink: string; @Input() connectCommunityId: string; + @Input() customFilter:SearchCustomFilter= null; @Input() sort: boolean = false; @Input() searchFormClass: string = "searchForm"; piwiksub: any; @@ -256,6 +257,10 @@ export class AdvancedSearchPageComponent { //community if(this.connectCommunityId ){ params += (countParams == 0 ? "" : " and " ) + "communityId exact "+'"' + this.connectCommunityId +'"' + " "; + countParams++; + } + if(this.customFilter){ + params+= (countParams == 0 ? "" : " and " ) + this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId )); } return params; diff --git a/searchPages/searchUtils/browseEntities.component.ts b/searchPages/searchUtils/browseEntities.component.ts index d2e394a5..48631292 100644 --- a/searchPages/searchUtils/browseEntities.component.ts +++ b/searchPages/searchUtils/browseEntities.component.ts @@ -9,7 +9,7 @@ import {ErrorCodes} from '../../utils/properties/errorCodes'; import {ErrorMessagesComponent} from '../../utils/errorMessages.component'; import {SearchFields, FieldDetails} from '../../utils/properties/searchFields'; import {SearchPageComponent } from '../searchUtils/searchPage.component'; -import {SearchUtilsClass} from '../searchUtils/searchUtils.class'; +import {SearchCustomFilter, SearchUtilsClass} from '../searchUtils/searchUtils.class'; import{EnvProperties} from '../../utils/properties/env-properties'; import {StringUtils} from '../../utils/string-utils.class'; @@ -24,7 +24,7 @@ import {StringUtils} from '../../utils/string-utils.class';