88300: Issue 1379 - Angular: Browse-by Subject does not allow to proceed to next pages once filtered

This commit is contained in:
Yana De Pauw
2022-03-17 13:00:00 +01:00
parent 9fc7b57157
commit 97dc241c52
7 changed files with 65 additions and 139 deletions

View File

@@ -4,10 +4,13 @@ import { PaginatedList } from '../../core/data/paginated-list.model';
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
import { fadeIn, fadeInOut } from '../animations/fade';
import { Observable } from 'rxjs';
import { combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { ListableObject } from '../object-collection/shared/listable-object.model';
import { getStartsWithComponent, StartsWithType } from '../starts-with/starts-with-decorator';
import { PaginationService } from '../../core/pagination/pagination.service';
import { RouteService } from '../../core/services/route.service';
import { map } from 'rxjs/operators';
import { hasValue } from '../empty.util';
@Component({
selector: 'ds-browse-by',
@@ -97,8 +100,14 @@ export class BrowseByComponent implements OnInit {
*/
public sortDirections = SortDirection;
/**
* Observable that tracks if the back button should be displayed based on the path parameters
*/
shouldDisplayResetButton$: Observable<boolean>;
public constructor(private injector: Injector,
protected paginationService: PaginationService,
private routeService: RouteService
) {
}
@@ -148,6 +157,14 @@ export class BrowseByComponent implements OnInit {
],
parent: this.injector
});
const startsWith$ = this.routeService.getQueryParameterValue('startsWith');
const value$ = this.routeService.getQueryParameterValue('value');
this.shouldDisplayResetButton$ = observableCombineLatest([startsWith$, value$]).pipe(
map(([startsWith, value]) => hasValue(startsWith) || hasValue(value))
);
}
}