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
This commit is contained in:
argiro.kokogiannaki 2018-05-15 08:48:39 +00:00
parent b60ae2d33c
commit a5527e8fa4
4 changed files with 15 additions and 10 deletions

View File

@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets" [csvParams]="csvParams" csvPath="datasets" simpleSearchLink="/search/find/datasets"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId > [oldTotalResults]="oldTotalResults" [(connectCommunityId)]=connectCommunityId [piwikSiteId]=piwikSiteId >
</advanced-search-page> </advanced-search-page>
` `
@ -33,6 +33,7 @@ export class AdvancedSearchDatasetsComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
properties:EnvProperties; properties:EnvProperties;
@Input() piwikSiteId = null; @Input() piwikSiteId = null;
@Input() connectCommunityId: string;
public results =[]; public results =[];
public filters =[]; public filters =[];
@ -82,6 +83,7 @@ export class AdvancedSearchDatasetsComponent {
this.selectedFields =[]; this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields; this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap; this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.connectCommunityId = this.connectCommunityId;
this.searchPage.getSelectedFiltersFromUrl(params); this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);

View File

@ -48,7 +48,7 @@ export class AdvancedSearchPublicationsComponent {
public loadPaging: boolean = true; public loadPaging: boolean = true;
public oldTotalResults: number = 0; public oldTotalResults: number = 0;
@Input() openaireLink: string ; @Input() openaireLink: string ;
@Input() connectCommunityId: string = "egi||EGI Federation"; @Input() connectCommunityId: string;
public pagingLimit: number = 0; public pagingLimit: number = 0;
public isPiwikEnabled; public isPiwikEnabled;
properties:EnvProperties; properties:EnvProperties;
@ -88,7 +88,7 @@ export class AdvancedSearchPublicationsComponent {
this.selectedFields =[]; this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields; this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap; this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.connectCommunityId = this.connectCommunityId;
this.searchPage.getSelectedFiltersFromUrl(params); this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);
}); });

View File

@ -23,7 +23,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
[csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software" [csvParams]="csvParams" csvPath="software" simpleSearchLink="/search/find/software"
[disableForms]="disableForms" [disableForms]="disableForms"
[loadPaging]="loadPaging" [loadPaging]="loadPaging"
[oldTotalResults]="oldTotalResults" [piwikSiteId]=piwikSiteId> [oldTotalResults]="oldTotalResults" [(connectCommunityId)]=connectCommunityId [piwikSiteId]=piwikSiteId>
</advanced-search-page> </advanced-search-page>
` `
@ -32,6 +32,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
export class AdvancedSearchSoftwareComponent { export class AdvancedSearchSoftwareComponent {
private errorCodes: ErrorCodes; private errorCodes: ErrorCodes;
@Input() piwikSiteId = null; @Input() piwikSiteId = null;
@Input() connectCommunityId: string;
public results =[]; public results =[];
public filters =[]; public filters =[];
@ -83,6 +84,7 @@ export class AdvancedSearchSoftwareComponent {
this.selectedFields =[]; this.selectedFields =[];
this.searchPage.selectedFields = this.selectedFields; this.searchPage.selectedFields = this.selectedFields;
this.searchPage.fieldIdsMap = this.fieldIdsMap; this.searchPage.fieldIdsMap = this.fieldIdsMap;
this.searchPage.connectCommunityId = this.connectCommunityId;
this.searchPage.getSelectedFiltersFromUrl(params); this.searchPage.getSelectedFiltersFromUrl(params);
this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size); this.getResults(this.searchPage.createQueryParameters(), this.searchUtils.page, this.searchUtils.size);

View File

@ -147,11 +147,9 @@ export class AdvancedSearchPageComponent {
this.selectedFields.push(dateField); this.selectedFields.push(dateField);
} }
}else{
console.log(" "+this.connectCommunityId+" "+values[j]+" "+ fieldId)
if(!(this.connectCommunityId && fieldId == "community" && this.connectCommunityId == values[j] )){
this.selectedFields.push(new AdvancedField(fieldId,fieldparam,this.fieldIdsMap[fieldId].name,this.fieldIdsMap[fieldId].type,StringUtils.unquote(values[j]),operators[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()); this.parameterValues.push(fields[this.fieldIds[i]].operators.join());
} }
} }
//TODO --
if(includePage && this.searchUtils.page != 1){ if(includePage && this.searchUtils.page != 1){
params += "&page="+this.searchUtils.page; params += "&page="+this.searchUtils.page;
} }
@ -229,7 +226,11 @@ export class AdvancedSearchPageComponent {
countParams++; countParams++;
} }
} }
//TODO --
//community
if(this.connectCommunityId ){
params += (countParams == 0 ? "" : " and " ) + "communityId exact "+'"' + this.connectCommunityId +'"' + " ";
}
return params; return params;
} }