From e66035c8962ad279209712b98c9b34e89d92e531 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Tue, 7 May 2024 12:09:47 +0200 Subject: [PATCH] 111731: Minimize all the facets when adding filter through advanced component & filter suggestions --- .../shared/search/advanced-search/advanced-search.component.ts | 1 + .../search-facet-filter/search-facet-filter.component.ts | 1 + src/app/shared/testing/search-filter-service.stub.ts | 3 +++ 3 files changed, 5 insertions(+) diff --git a/src/app/shared/search/advanced-search/advanced-search.component.ts b/src/app/shared/search/advanced-search/advanced-search.component.ts index ef9b36ba4d2..26a15eb1e37 100644 --- a/src/app/shared/search/advanced-search/advanced-search.component.ts +++ b/src/app/shared/search/advanced-search/advanced-search.component.ts @@ -97,6 +97,7 @@ export class AdvancedSearchComponent implements OnInit, OnDestroy { applyFilter(): void { if (isNotEmpty(this.currentValue)) { + this.searchFilterService.minimizeAll(); this.subs.push(this.searchConfigurationService.selectNewAppliedFilterParams(this.currentFilter, this.currentValue.trim(), this.currentOperator).pipe(take(1)).subscribe((params: Params) => { void this.router.navigate([this.searchService.getSearchLink()], { queryParams: params, diff --git a/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.ts b/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.ts index b7edf6069ed..c4fefeda4c9 100644 --- a/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.ts +++ b/src/app/shared/search/search-filters/search-filter/search-facet-filter/search-facet-filter.component.ts @@ -212,6 +212,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy { */ protected applyFilterValue(data: string): void { if (data.match(new RegExp(`^.+,(equals|query|authority)$`))) { + this.filterService.minimizeAll(); const valueParts = data.split(','); this.subs.push(this.searchConfigService.selectNewAppliedFilterParams(this.filterConfig.name, valueParts.slice(0, valueParts.length - 1).join(), valueParts[valueParts.length - 1]).pipe(take(1)).subscribe((params: Params) => { void this.router.navigate(this.getSearchLinkParts(), { diff --git a/src/app/shared/testing/search-filter-service.stub.ts b/src/app/shared/testing/search-filter-service.stub.ts index 594c0dd525a..c6547283415 100644 --- a/src/app/shared/testing/search-filter-service.stub.ts +++ b/src/app/shared/testing/search-filter-service.stub.ts @@ -71,4 +71,7 @@ export class SearchFilterServiceStub { resetPage(_filterName: string): void { } + minimizeAll(): void { + } + }