mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
90768: Prevent empty filters from being added
This commit is contained in:
@@ -230,27 +230,29 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submits a new active custom value to the filter from the input field
|
* Submits a new active custom value to the filter from the input field when the input field isn't empty.
|
||||||
* @param data The string from the input field
|
* @param data The string from the input field
|
||||||
*/
|
*/
|
||||||
onSubmit(data: any) {
|
onSubmit(data: any) {
|
||||||
this.selectedValues$.pipe(take(1)).subscribe((selectedValues) => {
|
if (data.match(new RegExp(`^.+,(equals|query|authority)$`))) {
|
||||||
if (isNotEmpty(data)) {
|
this.selectedValues$.pipe(take(1)).subscribe((selectedValues) => {
|
||||||
this.router.navigate(this.getSearchLinkParts(), {
|
if (isNotEmpty(data)) {
|
||||||
queryParams:
|
this.router.navigate(this.getSearchLinkParts(), {
|
||||||
{
|
queryParams:
|
||||||
[this.filterConfig.paramName]: [
|
{
|
||||||
...selectedValues.map((facet) => this.getFacetValue(facet)),
|
[this.filterConfig.paramName]: [
|
||||||
data
|
...selectedValues.map((facet) => this.getFacetValue(facet)),
|
||||||
]
|
data
|
||||||
},
|
]
|
||||||
queryParamsHandling: 'merge'
|
},
|
||||||
});
|
queryParamsHandling: 'merge'
|
||||||
this.filter = '';
|
});
|
||||||
|
this.filter = '';
|
||||||
|
}
|
||||||
|
this.filterSearchResults = observableOf([]);
|
||||||
}
|
}
|
||||||
this.filterSearchResults = observableOf([]);
|
);
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user