From 906b2f5917a4f15d4e4eb62f06248471876e23d9 Mon Sep 17 00:00:00 2001 From: Victor Hugo Duran Santiago Date: Thu, 16 May 2024 18:45:41 -0600 Subject: [PATCH 1/4] Fix - hide search text field in the filter section if the number of facet values does not exceed the maximum number of facet values shown --- .../search-facet-filter/search-facet-filter.component.ts | 6 ++++++ .../search-text-filter/search-text-filter.component.html | 1 + 2 files changed, 7 insertions(+) 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 aedb5d3ee27..9753811b01f 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 @@ -104,6 +104,10 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy { */ isLastPage$: BehaviorSubject = new BehaviorSubject(false); + /** + * Emits true if show the search text + */ + isAvailableForShowSearchText: BehaviorSubject = new BehaviorSubject(false); /** * The value of the input field that is used to query for possible values for this filter */ @@ -289,6 +293,8 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy { getFirstSucceededRemoteDataPayload(), tap((facetValues: FacetValues) => { this.isLastPage$.next(hasNoValue(facetValues?.next)); + const hasLimitFacets = facetValues?.page.length < facetValues?.facetLimit; + this.isAvailableForShowSearchText.next(hasLimitFacets && hasNoValue(facetValues?.next)); }), )), map((newFacetValues: FacetValues) => { diff --git a/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html index 5723e540111..92d0b06f6c9 100644 --- a/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html @@ -26,5 +26,6 @@ (submitSuggestion)="onSubmit($event)" (clickSuggestion)="onClick($event)" (findSuggestions)="findSuggestions($event)" + *ngIf="!(isAvailableForShowSearchText | async)" ngDefaultControl> From 44480cba4aaa32a5f79185c9314dbd88c560f735 Mon Sep 17 00:00:00 2001 From: Victor Hugo Duran Santiago Date: Thu, 16 May 2024 20:17:12 -0600 Subject: [PATCH 2/4] Fix - hide search text field in the filter section if the number of facet values does not exceed the maximum number of facet values shown --- .../search-authority-filter.component.html | 1 + .../search-hierarchy-filter.component.html | 1 + 2 files changed, 2 insertions(+) diff --git a/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html index a9620412443..f0c9ea3d98c 100644 --- a/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html @@ -26,5 +26,6 @@ (submitSuggestion)="onSubmit($event)" (clickSuggestion)="onClick($event)" (findSuggestions)="findSuggestions($event)" + *ngIf="!(isAvailableForShowSearchText | async)" ngDefaultControl> diff --git a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html index 7a6e1d816a0..3b7b6d6802c 100644 --- a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html @@ -26,6 +26,7 @@ (submitSuggestion)="onSubmit($event)" (clickSuggestion)="onClick($event)" (findSuggestions)="findSuggestions($event)" + *ngIf="!(isAvailableForShowSearchText | async)" ngDefaultControl > From e3595e5f34b42f059df5673e8b90637ebedf9fcd Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 31 May 2024 12:53:45 -0500 Subject: [PATCH 3/4] Fix "Async pipe results should not be negated" from lint --- .../search-authority-filter.component.html | 2 +- .../search-hierarchy-filter.component.html | 2 +- .../search-text-filter/search-text-filter.component.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html index f0c9ea3d98c..1a95d68b2cf 100644 --- a/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-authority-filter/search-authority-filter.component.html @@ -26,6 +26,6 @@ (submitSuggestion)="onSubmit($event)" (clickSuggestion)="onClick($event)" (findSuggestions)="findSuggestions($event)" - *ngIf="!(isAvailableForShowSearchText | async)" + *ngIf="(isAvailableForShowSearchText | async) === false" ngDefaultControl> diff --git a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html index 3b7b6d6802c..51200571bd6 100644 --- a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html @@ -26,7 +26,7 @@ (submitSuggestion)="onSubmit($event)" (clickSuggestion)="onClick($event)" (findSuggestions)="findSuggestions($event)" - *ngIf="!(isAvailableForShowSearchText | async)" + *ngIf="(isAvailableForShowSearchText | async) === false" ngDefaultControl > diff --git a/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html index 92d0b06f6c9..037964c63f3 100644 --- a/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html @@ -26,6 +26,6 @@ (submitSuggestion)="onSubmit($event)" (clickSuggestion)="onClick($event)" (findSuggestions)="findSuggestions($event)" - *ngIf="!(isAvailableForShowSearchText | async)" + *ngIf="(isAvailableForShowSearchText | async) === false" ngDefaultControl> From bb341a3ea7c12f120fa4031c98d92b032739e0b9 Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 31 May 2024 14:11:57 -0500 Subject: [PATCH 4/4] Minor fix for scenarios where `page` is undefined. Fixes a few specs. --- .../search-facet-filter/search-facet-filter.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9753811b01f..f09c4f18f48 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 @@ -293,7 +293,7 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy { getFirstSucceededRemoteDataPayload(), tap((facetValues: FacetValues) => { this.isLastPage$.next(hasNoValue(facetValues?.next)); - const hasLimitFacets = facetValues?.page.length < facetValues?.facetLimit; + const hasLimitFacets = facetValues?.page?.length < facetValues?.facetLimit; this.isAvailableForShowSearchText.next(hasLimitFacets && hasNoValue(facetValues?.next)); }), )),