mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 14:03:06 +00:00
CST-6056 changes for filter result not working while lookup from text input
This commit is contained in:
@@ -9,6 +9,6 @@
|
||||
</span>
|
||||
</label>
|
||||
<span class="float-right filter-value-count ml-auto">
|
||||
<span class="badge badge-secondary badge-pill">{{filterValue.count}}</span>
|
||||
</span>
|
||||
<span class="badge badge-secondary badge-pill">{{filterValue.count}}</span>
|
||||
</span>
|
||||
</a>
|
||||
|
@@ -236,22 +236,21 @@ export class SearchFacetFilterComponent implements OnInit, OnDestroy {
|
||||
onSubmit(data: any) {
|
||||
if (data.match(new RegExp(`^.+,(equals|query|authority)$`))) {
|
||||
this.selectedValues$.pipe(take(1)).subscribe((selectedValues) => {
|
||||
if (isNotEmpty(data)) {
|
||||
this.router.navigate(this.getSearchLinkParts(), {
|
||||
queryParams:
|
||||
{
|
||||
[this.filterConfig.paramName]: [
|
||||
...selectedValues.map((facet) => this.getFacetValue(facet)),
|
||||
data
|
||||
]
|
||||
},
|
||||
queryParamsHandling: 'merge'
|
||||
});
|
||||
this.filter = '';
|
||||
}
|
||||
this.filterSearchResults = observableOf([]);
|
||||
if (isNotEmpty(data)) {
|
||||
this.router.navigate(this.getSearchLinkParts(), {
|
||||
queryParams:
|
||||
{
|
||||
[this.filterConfig.paramName]: [
|
||||
...selectedValues.map((facet) => this.getFacetValue(facet)),
|
||||
data
|
||||
]
|
||||
},
|
||||
queryParamsHandling: 'merge'
|
||||
});
|
||||
this.filter = '';
|
||||
}
|
||||
);
|
||||
this.filterSearchResults = observableOf([]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@
|
||||
[name]="filterConfig.paramName"
|
||||
[(ngModel)]="filter"
|
||||
(submitSuggestion)="onSubmit($event)"
|
||||
(clickSuggestion)="onClick($event)"
|
||||
(clickSuggestion)="onSubmit($event)"
|
||||
(findSuggestions)="findSuggestions($event)"
|
||||
ngDefaultControl
|
||||
></ds-filter-input-suggestions>
|
||||
|
@@ -3,6 +3,7 @@ import { FilterType } from '../../../models/filter-type.model';
|
||||
import { renderFacetFor } from '../search-filter-type-decorator';
|
||||
import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component';
|
||||
import { addOperatorToFilterValue } from '../../../search.utils';
|
||||
import { InputSuggestion } from '../../../../input-suggestions/input-suggestions.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-hierarchy-filter',
|
||||
@@ -22,6 +23,8 @@ export class SearchHierarchyFilterComponent extends SearchFacetFilterComponent i
|
||||
* @param data The string from the input field
|
||||
*/
|
||||
onSubmit(data: any) {
|
||||
super.onSubmit(addOperatorToFilterValue(data, 'query'));
|
||||
this.filterSearchResults.subscribe((filterSearchResults: InputSuggestion[]) => {
|
||||
super.onSubmit(addOperatorToFilterValue(data, filterSearchResults.length ? 'equals' : 'query'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
[name]="filterConfig.paramName"
|
||||
[(ngModel)]="filter"
|
||||
(submitSuggestion)="onSubmit($event)"
|
||||
(clickSuggestion)="onClick($event)"
|
||||
(clickSuggestion)="onSubmit($event)"
|
||||
(findSuggestions)="findSuggestions($event)"
|
||||
ngDefaultControl></ds-filter-input-suggestions>
|
||||
</div>
|
||||
|
@@ -3,6 +3,7 @@ import { FilterType } from '../../../models/filter-type.model';
|
||||
import { facetLoad, SearchFacetFilterComponent } from '../search-facet-filter/search-facet-filter.component';
|
||||
import { renderFacetFor } from '../search-filter-type-decorator';
|
||||
import { addOperatorToFilterValue, } from '../../../search.utils';
|
||||
import { InputSuggestion } from '../../../../input-suggestions/input-suggestions.model';
|
||||
|
||||
/**
|
||||
* This component renders a simple item page.
|
||||
@@ -28,6 +29,8 @@ export class SearchTextFilterComponent extends SearchFacetFilterComponent implem
|
||||
* @param data The string from the input field
|
||||
*/
|
||||
onSubmit(data: any) {
|
||||
super.onSubmit(addOperatorToFilterValue(data, 'query'));
|
||||
this.filterSearchResults.subscribe((filterSearchResults: InputSuggestion[]) => {
|
||||
super.onSubmit(addOperatorToFilterValue(data, filterSearchResults.length ? 'equals' : 'query'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user