111731: Renamed variables for clarity

This commit is contained in:
Alexandre Vryghem
2024-02-09 17:47:55 +01:00
parent eb33ae7cb8
commit 58a15329ac
7 changed files with 22 additions and 22 deletions

View File

@@ -1,9 +1,9 @@
<div> <div>
<div class="filters py-2"> <div class="filters py-2">
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option> <ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
<ng-container *ngFor="let page of (filterValues$ | async)"> <ng-container *ngFor="let page of (facetValues$ | async)">
<div [@facetLoad]="animationState"> <div [@facetLoad]="animationState">
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option> <ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
</div> </div>
</ng-container> </ng-container>
<div class="clearfix toggle-more-filters"> <div class="clearfix toggle-more-filters">

View File

@@ -1,9 +1,9 @@
<div> <div>
<div class="filters py-2"> <div class="filters py-2">
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option> <ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
<ng-container *ngFor="let page of (filterValues$ | async)"> <ng-container *ngFor="let page of (facetValues$ | async)">
<div [@facetLoad]="animationState"> <div [@facetLoad]="animationState">
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option> <ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
</div> </div>
</ng-container> </ng-container>
<div class="clearfix toggle-more-filters"> <div class="clearfix toggle-more-filters">

View File

@@ -173,7 +173,7 @@ describe('SearchFacetFilterComponent', () => {
const testValue = 'test'; const testValue = 'test';
beforeEach(() => { beforeEach(() => {
comp.selectedValues$ = observableOf(selectedValues.map((value) => comp.selectedAppliedFilters$ = observableOf(selectedValues.map((value) =>
Object.assign(new AppliedFilter(), { Object.assign(new AppliedFilter(), {
filter: filterName1, filter: filterName1,
operator: 'equals', operator: 'equals',

View File

@@ -36,7 +36,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
/** /**
* Emits an array of pages with values found for this facet * Emits an array of pages with values found for this facet
*/ */
filterValues$: BehaviorSubject<FacetValues[]> = new BehaviorSubject([]); facetValues$: BehaviorSubject<FacetValues[]> = new BehaviorSubject([]);
/** /**
* Emits the current last shown page of this facet's values * Emits the current last shown page of this facet's values
@@ -66,7 +66,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
/** /**
* Emits the active values for this filter * Emits the active values for this filter
*/ */
selectedValues$: Observable<AppliedFilter[]>; selectedAppliedFilters$: Observable<AppliedFilter[]>;
protected collapseNextUpdate = true; protected collapseNextUpdate = true;
@@ -236,7 +236,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
*/ */
protected applyFilterValue(data) { protected applyFilterValue(data) {
if (data.match(new RegExp(`^.+,(equals|query|authority)$`))) { if (data.match(new RegExp(`^.+,(equals|query|authority)$`))) {
this.selectedValues$.pipe(take(1)).subscribe((selectedValues: AppliedFilter[]) => { this.selectedAppliedFilters$.pipe(take(1)).subscribe((selectedValues: AppliedFilter[]) => {
if (isNotEmpty(data)) { if (isNotEmpty(data)) {
void this.router.navigate(this.getSearchLinkParts(), { void this.router.navigate(this.getSearchLinkParts(), {
queryParams: queryParams:
@@ -271,7 +271,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
}), }),
)), )),
map((newFacetValues: FacetValues) => { map((newFacetValues: FacetValues) => {
let filterValues: FacetValues[] = this.filterValues$.value; let filterValues: FacetValues[] = this.facetValues$.value;
if (this.collapseNextUpdate) { if (this.collapseNextUpdate) {
this.showFirstPageOnly(); this.showFirstPageOnly();
@@ -286,10 +286,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
return filterValues; return filterValues;
}), }),
tap((rd: FacetValues[]) => { tap((allFacetValues: FacetValues[]) => {
const allAppliedFilters: AppliedFilter[] = [].concat(...rd.map((facetValues: FacetValues) => facetValues.appliedFilters)) const allAppliedFilters: AppliedFilter[] = [].concat(...allFacetValues.map((facetValues: FacetValues) => facetValues.appliedFilters))
.filter((appliedFilter: AppliedFilter) => hasValue(appliedFilter)); .filter((appliedFilter: AppliedFilter) => hasValue(appliedFilter));
this.selectedValues$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe( this.selectedAppliedFilters$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe(
map((selectedValues: string[]) => { map((selectedValues: string[]) => {
const appliedFilters: AppliedFilter[] = selectedValues.map((value: string) => { const appliedFilters: AppliedFilter[] = selectedValues.map((value: string) => {
return allAppliedFilters.find((appliedFilter: AppliedFilter) => appliedFilter.value === stripOperatorFromFilterValue(value)); return allAppliedFilters.find((appliedFilter: AppliedFilter) => appliedFilter.value === stripOperatorFromFilterValue(value));
@@ -299,7 +299,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
}), }),
); );
this.animationState = 'ready'; this.animationState = 'ready';
this.filterValues$.next(rd); this.facetValues$.next(allFacetValues);
}) })
); );
} }

View File

@@ -1,9 +1,9 @@
<div> <div>
<div class="filters py-2"> <div class="filters py-2">
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option> <ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
<ng-container *ngFor="let page of (filterValues$ | async)"> <ng-container *ngFor="let page of (facetValues$ | async)">
<div [@facetLoad]="animationState"> <div [@facetLoad]="animationState">
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option> <ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
</div> </div>
</ng-container> </ng-container>
<div class="clearfix toggle-more-filters"> <div class="clearfix toggle-more-filters">

View File

@@ -39,7 +39,7 @@
[(ngModel)]="range" ngDefaultControl> [(ngModel)]="range" ngDefaultControl>
</nouislider> </nouislider>
</ng-container> </ng-container>
<ng-container *ngFor="let page of (filterValues$ | async)"> <ng-container *ngFor="let page of (facetValues$ | async)">
<div [@facetLoad]="animationState"> <div [@facetLoad]="animationState">
<ds-search-facet-range-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-range-option> <ds-search-facet-range-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-range-option>
</div> </div>

View File

@@ -1,9 +1,9 @@
<div> <div>
<div class="filters py-2"> <div class="filters py-2">
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option> <ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
<ng-container *ngFor="let page of (filterValues$ | async)"> <ng-container *ngFor="let page of (facetValues$ | async)">
<div [@facetLoad]="animationState"> <div [@facetLoad]="animationState">
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option> <ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
</div> </div>
</ng-container> </ng-container>
<div class="clearfix toggle-more-filters"> <div class="clearfix toggle-more-filters">