Linking projects: when there are no results filters can't be removed

This commit is contained in:
argirok 2022-06-28 13:19:08 +03:00
parent 78fcf59349
commit a85ec2bfbd
2 changed files with 26 additions and 12 deletions

View File

@ -11,15 +11,7 @@
</div>
</div>
<div *ngIf="showResults" class="uk-margin-top">
<div *ngIf="openaireResultsStatus == errorCodes.NONE" class="uk-alert uk-alert-primary"
role="alert">No Results found
</div>
<div *ngIf="openaireResultsStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning"
role="alert">An Error Occured
</div>
<div *ngIf="openaireResultsStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger"
role="alert">Service not available
</div>
<div class="uk-grid">
<div class="search-filters uk-width-1-1">
@ -74,7 +66,7 @@
</div>
</div>-->
<ng-container *ngIf="openaireResultsNum > 0">
<!-- <ng-container *ngIf="openaireResultsNum > 0">-->
<ng-container *ngFor="let filter of rangeFilters">
<div class="uk-inline">
@ -107,10 +99,18 @@
</div>
</div>
</ng-container>
</ng-container>
<!-- </ng-container>-->
</div>
<div class="uk-width-expand@m uk-width-1-1@s uk-first-column">
<div *ngIf="openaireResultsStatus == errorCodes.NONE" class="uk-alert uk-alert-primary"
role="alert">No Results found
</div>
<div *ngIf="openaireResultsStatus == errorCodes.ERROR" class="uk-alert uk-alert-warning"
role="alert">An Error Occured
</div>
<div *ngIf="openaireResultsStatus == errorCodes.NOT_AVAILABLE" class="uk-alert uk-alert-danger"
role="alert">Service not available
</div>
<div *ngIf="openaireResultsStatus == errorCodes.LOADING" class="uk-animation-fade uk-margin-top uk-width-1-1"
role="alert"><span class="loading-gif uk-align-center"></span></div>
<claim-results [localStoragePrefix]="localStoragePrefix" [results]=openaireResults

View File

@ -87,6 +87,7 @@ export class ClaimProjectsSearchFormComponent {
this.openaireResultsStatus = this.errorCodes.DONE;
if(this.openaireResultsNum == 0){
this.openaireResultsStatus = this.errorCodes.NONE;
this.filters = this.checkSelectedFilters( [], this.prevFilters);
}
}else {
this.openaireResultsStatus = this.errorCodes.ERROR;
@ -273,6 +274,19 @@ export class ClaimProjectsSearchFormComponent {
}
}
if(filters.length == 0 ){
for(let j=0; j< prevFilters.length ; j++){
let filter = Object.assign({}, prevFilters[j]);
filter.values = [];
for(let filterValue of prevFilters[j].values) {
if(filterValue.selected){
filterValue.number = 0;
filter.values.push(filterValue);
}
}
filters.push(filter)
}
}
return filters;
}
totalPages(totalResults: number): number {