[Library|Trunk]

- Search page - custom filter: add filter value when the custom filter doesn't exists in refine values - this allows to remove it if there are no results

- quick selections: add check for aggregator




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59901 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-11-18 17:04:41 +00:00
parent 8d9420e4a1
commit 18311e557d
3 changed files with 15 additions and 9 deletions

View File

@ -292,8 +292,7 @@
customFilter.selected == false && customFilter.promptToAddFilter"
class="uk-alert uk-animation-slide-top-small">
Do you want to see results only for {{customFilter.valueName}}? <a
(click)="addCustomFilter();">Click
here</a>.
(click)="addCustomFilter();">Click here</a>.
</div>
<div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"><a
class="uk-margin-top uk-button uk-button-text"

View File

@ -123,7 +123,6 @@ export class NewSearchPageComponent {
@ViewChild('removeCustomFilter') removeCustomFilter: AlertModal;
currentValueToRemove;
currentFilterToRemove;
isCustomFilterSelected:boolean = true;
constructor(private route: ActivatedRoute,
private location: Location,
private _meta: Meta,
@ -624,8 +623,8 @@ export class NewSearchPageComponent {
}
closeCustomFilterModal() {
this.customFilterEnabled = false;
this.removeFilter(this.currentValueToRemove, this.currentFilterToRemove, true);
this.isCustomFilterSelected = false;
}
public removeRangeFilter(filter: RangeFilter) {
@ -675,17 +674,25 @@ export class NewSearchPageComponent {
*/
addCustomFilter() {
this.customFilter.selected = true;
if(this.refineFields.indexOf(this.customFilter.queryFieldName) == -1 ){
this.customFilterEnabled = true;
}else {
this.customFilterEnabled = true;
if(this.refineFields.indexOf(this.customFilter.queryFieldName) != -1 ){
let found = false;
for (let filter of this.filters) {
if (this.customFilter.queryFieldName == filter.filterId) {
for (let value of filter.values) {
if (value.id == this.customFilter.valueId) {
value.selected = true;
filter.countSelectedValues++;
found = true;
break;
}
}
//add filter when field exist in refine but not in the refine values
if(!found){
filter.countSelectedValues ++ ;
filter.values.push({selected : true, name: this.customFilter.valueName, id: this.customFilter.valueId, number:0});
}
break;
}
}
}
@ -1015,7 +1022,7 @@ export class NewSearchPageComponent {
}
}
this.customFilterEnabled = URLparams["cf"] == "true";
if(this.customFilter && (this.customFilter.isHiddenFilter || (this.refineFields.indexOf(this.customFilter.queryFieldName) == -1 && this.customFilterEnabled))){
if(this.customFilter && (this.customFilter.isHiddenFilter || this.customFilterEnabled)){
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
}

View File

@ -92,7 +92,7 @@ export class QuickSelectionsComponent {
}));
if(this.properties && !this.initialized) {
if(this.properties.adminToolsCommunity !== "monitor") {
if(this.properties.adminToolsCommunity !== "monitor" && this.properties.adminToolsPortalType !== "aggregator" ) {
this.subs.push(this.config.communityInformationState.subscribe(data => {
if(data) {
var showEntity = {};