From a5527e8fa4e1fbd36ffffae01c7e95cfb920d664 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Tue, 15 May 2018 08:48:39 +0000 Subject: [PATCH] add communityId parameter in advanced pages of results - for filtering results based on community id git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@52027 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../advanced/advancedSearchDatasets.component.ts | 4 +++- .../advancedSearchPublications.component.ts | 4 ++-- .../advanced/advancedSearchSoftware.component.ts | 4 +++- .../searchUtils/advancedSearchPage.component.ts | 13 +++++++------ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/searchPages/advanced/advancedSearchDatasets.component.ts b/searchPages/advanced/advancedSearchDatasets.component.ts index d54038a3..84b4304d 100644 --- a/searchPages/advanced/advancedSearchDatasets.component.ts +++ b/searchPages/advanced/advancedSearchDatasets.component.ts @@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets" [disableForms]="disableForms" [loadPaging]="loadPaging" - [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId > + [oldTotalResults]="oldTotalResults" [(connectCommunityId)]=connectCommunityId [piwikSiteId]=piwikSiteId > ` @@ -33,6 +33,7 @@ export class AdvancedSearchDatasetsComponent { private errorCodes: ErrorCodes; properties:EnvProperties; @Input() piwikSiteId = null; +@Input() connectCommunityId: string; public results =[]; public filters =[]; @@ -82,6 +83,7 @@ export class AdvancedSearchDatasetsComponent { this.selectedFields =[]; this.searchPage.selectedFields = this.selectedFields; this.searchPage.fieldIdsMap = this.fieldIdsMap; + this.searchPage.connectCommunityId = this.connectCommunityId; this.searchPage.getSelectedFiltersFromUrl(params); this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); diff --git a/searchPages/advanced/advancedSearchPublications.component.ts b/searchPages/advanced/advancedSearchPublications.component.ts index 36b8d00d..66649c38 100644 --- a/searchPages/advanced/advancedSearchPublications.component.ts +++ b/searchPages/advanced/advancedSearchPublications.component.ts @@ -48,7 +48,7 @@ export class AdvancedSearchPublicationsComponent { public loadPaging: boolean = true; public oldTotalResults: number = 0; @Input() openaireLink: string ; - @Input() connectCommunityId: string = "egi||EGI Federation"; + @Input() connectCommunityId: string; public pagingLimit: number = 0; public isPiwikEnabled; properties:EnvProperties; @@ -88,7 +88,7 @@ export class AdvancedSearchPublicationsComponent { this.selectedFields =[]; this.searchPage.selectedFields = this.selectedFields; this.searchPage.fieldIdsMap = this.fieldIdsMap; - + this.searchPage.connectCommunityId = this.connectCommunityId; this.searchPage.getSelectedFiltersFromUrl(params); this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); }); diff --git a/searchPages/advanced/advancedSearchSoftware.component.ts b/searchPages/advanced/advancedSearchSoftware.component.ts index b49cbd7d..ef036a2f 100644 --- a/searchPages/advanced/advancedSearchSoftware.component.ts +++ b/searchPages/advanced/advancedSearchSoftware.component.ts @@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; [csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software" [disableForms]="disableForms" [loadPaging]="loadPaging" - [oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId> + [oldTotalResults]="oldTotalResults" [(connectCommunityId)]=connectCommunityId [piwikSiteId]=piwikSiteId> ` @@ -32,6 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties'; export class AdvancedSearchSoftwareComponent { private errorCodes: ErrorCodes; @Input() piwikSiteId = null; +@Input() connectCommunityId: string; public results =[]; public filters =[]; @@ -83,6 +84,7 @@ export class AdvancedSearchSoftwareComponent { this.selectedFields =[]; this.searchPage.selectedFields = this.selectedFields; this.searchPage.fieldIdsMap = this.fieldIdsMap; + this.searchPage.connectCommunityId = this.connectCommunityId; this.searchPage.getSelectedFiltersFromUrl(params); this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); diff --git a/searchPages/searchUtils/advancedSearchPage.component.ts b/searchPages/searchUtils/advancedSearchPage.component.ts index 38791caf..f05dac8b 100644 --- a/searchPages/searchUtils/advancedSearchPage.component.ts +++ b/searchPages/searchUtils/advancedSearchPage.component.ts @@ -147,11 +147,9 @@ export class AdvancedSearchPageComponent { this.selectedFields.push(dateField); } - }else{ - console.log(" "+this.connectCommunityId+" "+values[j]+" "+ fieldId) - if(!(this.connectCommunityId && fieldId == "community" && this.connectCommunityId == values[j] )){ + } + else{ this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,StringUtils.unquote(values[j]),operators[j]) ); - } } } } @@ -197,7 +195,6 @@ export class AdvancedSearchPageComponent { this.parameterValues.push(fields[this.fieldIds[i]].operators.join()); } } - //TODO -- if(includePage && this.searchUtils.page != 1){ params += "&page="+this.searchUtils.page; } @@ -229,7 +226,11 @@ export class AdvancedSearchPageComponent { countParams++; } } - //TODO -- + + //community + if(this.connectCommunityId ){ + params += (countParams == 0 ? "" : " and " ) + "communityId exact "+'"' + this.connectCommunityId +'"' + " "; + } return params; }