Skip to content

Commit 58a1532

Browse files
111731: Renamed variables for clarity
1 parent eb33ae7 commit 58a1532

7 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div>
22
<div class="filters py-2">
3-
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4-
<ng-container *ngFor="let page of (filterValues$ | async)">
3+
<ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4+
<ng-container *ngFor="let page of (facetValues$ | async)">
55
<div [@facetLoad]="animationState">
6-
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
6+
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
77
</div>
88
</ng-container>
99
<div class="clearfix toggle-more-filters">

src/app/shared/search/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div>
22
<div class="filters py-2">
3-
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4-
<ng-container *ngFor="let page of (filterValues$ | async)">
3+
<ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4+
<ng-container *ngFor="let page of (facetValues$ | async)">
55
<div [@facetLoad]="animationState">
6-
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
6+
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
77
</div>
88
</ng-container>
99
<div class="clearfix toggle-more-filters">

src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe('SearchFacetFilterComponent', () => {
173173
const testValue = 'test';
174174

175175
beforeEach(() => {
176-
comp.selectedValues$ = observableOf(selectedValues.map((value) =>
176+
comp.selectedAppliedFilters$ = observableOf(selectedValues.map((value) =>
177177
Object.assign(new AppliedFilter(), {
178178
filter: filterName1,
179179
operator: 'equals',

src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
3636
/**
3737
* Emits an array of pages with values found for this facet
3838
*/
39-
filterValues$: BehaviorSubject<FacetValues[]> = new BehaviorSubject([]);
39+
facetValues$: BehaviorSubject<FacetValues[]> = new BehaviorSubject([]);
4040

4141
/**
4242
* Emits the current last shown page of this facet's values
@@ -66,7 +66,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
6666
/**
6767
* Emits the active values for this filter
6868
*/
69-
selectedValues$: Observable<AppliedFilter[]>;
69+
selectedAppliedFilters$: Observable<AppliedFilter[]>;
7070

7171
protected collapseNextUpdate = true;
7272

@@ -236,7 +236,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
236236
*/
237237
protected applyFilterValue(data) {
238238
if (data.match(new RegExp(`^.+,(equals|query|authority)$`))) {
239-
this.selectedValues$.pipe(take(1)).subscribe((selectedValues: AppliedFilter[]) => {
239+
this.selectedAppliedFilters$.pipe(take(1)).subscribe((selectedValues: AppliedFilter[]) => {
240240
if (isNotEmpty(data)) {
241241
void this.router.navigate(this.getSearchLinkParts(), {
242242
queryParams:
@@ -271,7 +271,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
271271
}),
272272
)),
273273
map((newFacetValues: FacetValues) => {
274-
let filterValues: FacetValues[] = this.filterValues$.value;
274+
let filterValues: FacetValues[] = this.facetValues$.value;
275275

276276
if (this.collapseNextUpdate) {
277277
this.showFirstPageOnly();
@@ -286,10 +286,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
286286

287287
return filterValues;
288288
}),
289-
tap((rd: FacetValues[]) => {
290-
const allAppliedFilters: AppliedFilter[] = [].concat(...rd.map((facetValues: FacetValues) => facetValues.appliedFilters))
289+
tap((allFacetValues: FacetValues[]) => {
290+
const allAppliedFilters: AppliedFilter[] = [].concat(...allFacetValues.map((facetValues: FacetValues) => facetValues.appliedFilters))
291291
.filter((appliedFilter: AppliedFilter) => hasValue(appliedFilter));
292-
this.selectedValues$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe(
292+
this.selectedAppliedFilters$ = this.filterService.getSelectedValuesForFilter(this.filterConfig).pipe(
293293
map((selectedValues: string[]) => {
294294
const appliedFilters: AppliedFilter[] = selectedValues.map((value: string) => {
295295
return allAppliedFilters.find((appliedFilter: AppliedFilter) => appliedFilter.value === stripOperatorFromFilterValue(value));
@@ -299,7 +299,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
299299
}),
300300
);
301301
this.animationState = 'ready';
302-
this.filterValues$.next(rd);
302+
this.facetValues$.next(allFacetValues);
303303
})
304304
);
305305
}

src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div>
22
<div class="filters py-2">
3-
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4-
<ng-container *ngFor="let page of (filterValues$ | async)">
3+
<ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4+
<ng-container *ngFor="let page of (facetValues$ | async)">
55
<div [@facetLoad]="animationState">
6-
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
6+
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
77
</div>
88
</ng-container>
99
<div class="clearfix toggle-more-filters">

src/app/shared/search/search-filters/search-filter/search-range-filter/search-range-filter.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
[(ngModel)]="range" ngDefaultControl>
4040
</nouislider>
4141
</ng-container>
42-
<ng-container *ngFor="let page of (filterValues$ | async)">
42+
<ng-container *ngFor="let page of (facetValues$ | async)">
4343
<div [@facetLoad]="animationState">
4444
<ds-search-facet-range-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-range-option>
4545
</div>

src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div>
22
<div class="filters py-2">
3-
<ds-search-facet-selected-option *ngFor="let value of (selectedValues$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4-
<ng-container *ngFor="let page of (filterValues$ | async)">
3+
<ds-search-facet-selected-option *ngFor="let value of (selectedAppliedFilters$ | async)" [selectedValue]="value" [filterConfig]="filterConfig" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-selected-option>
4+
<ng-container *ngFor="let page of (facetValues$ | async)">
55
<div [@facetLoad]="animationState">
6-
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedValues$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
6+
<ds-search-facet-option *ngFor="let value of page.page; trackBy: trackUpdate" [filterConfig]="filterConfig" [filterValue]="value" [selectedValues$]="selectedAppliedFilters$" [inPlaceSearch]="inPlaceSearch"></ds-search-facet-option>
77
</div>
88
</ng-container>
99
<div class="clearfix toggle-more-filters">

0 commit comments

Comments
 (0)