mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge pull request #2113 from CrisGuzmanS/issues/1998
avoiding error when user unselect a filter option
This commit is contained in:
@@ -7,6 +7,7 @@ import { SearchService } from '../../../../core/shared/search/search.service';
|
|||||||
import { currentPath } from '../../../utils/route.utils';
|
import { currentPath } from '../../../utils/route.utils';
|
||||||
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../../core/pagination/pagination.service';
|
||||||
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
|
||||||
|
import { stripOperatorFromFilterValue } from '../../search.utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-search-label',
|
selector: 'ds-search-label',
|
||||||
@@ -83,7 +84,8 @@ export class SearchLabelComponent implements OnInit {
|
|||||||
normalizeFilterValue(value: string) {
|
normalizeFilterValue(value: string) {
|
||||||
// const pattern = /,[^,]*$/g;
|
// const pattern = /,[^,]*$/g;
|
||||||
const pattern = /,authority*$/g;
|
const pattern = /,authority*$/g;
|
||||||
return value.replace(pattern, '');
|
value = value.replace(pattern, '');
|
||||||
|
return stripOperatorFromFilterValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getFilterName(): string {
|
private getFilterName(): string {
|
||||||
|
@@ -4,7 +4,6 @@ import { Observable } from 'rxjs';
|
|||||||
import { Params, Router } from '@angular/router';
|
import { Params, Router } from '@angular/router';
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { stripOperatorFromFilterValue } from '../search.utils';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-search-labels',
|
selector: 'ds-search-labels',
|
||||||
@@ -37,7 +36,7 @@ export class SearchLabelsComponent {
|
|||||||
const labels = {};
|
const labels = {};
|
||||||
Object.keys(params)
|
Object.keys(params)
|
||||||
.forEach((key) => {
|
.forEach((key) => {
|
||||||
labels[key] = [...params[key].map((value) => stripOperatorFromFilterValue(value))];
|
labels[key] = [...params[key].map((value) => value)];
|
||||||
});
|
});
|
||||||
return labels;
|
return labels;
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user