mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
[CTS-3090] - fix pagination
This commit is contained in:
@@ -2,7 +2,7 @@ import { Component, OnInit, HostListener, ChangeDetectorRef, OnDestroy, Output,
|
|||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { Observable, Subscription, BehaviorSubject } from 'rxjs';
|
import { Observable, Subscription, BehaviorSubject } from 'rxjs';
|
||||||
import { hasValue } from '../empty.util';
|
import { hasValue } from '../empty.util';
|
||||||
import { map, mergeMap, startWith, debounceTime, distinctUntilChanged, switchMap, merge, scan } from 'rxjs/operators';
|
import { map, mergeMap, startWith, debounceTime, distinctUntilChanged, switchMap, merge, scan, reduce } from 'rxjs/operators';
|
||||||
import { RemoteData } from 'src/app/core/data/remote-data';
|
import { RemoteData } from 'src/app/core/data/remote-data';
|
||||||
import { FindListOptions } from 'src/app/core/data/request.models';
|
import { FindListOptions } from 'src/app/core/data/request.models';
|
||||||
import { PaginatedList } from 'src/app/core/data/paginated-list';
|
import { PaginatedList } from 'src/app/core/data/paginated-list';
|
||||||
@@ -92,8 +92,6 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
currentQuery: string;
|
currentQuery: string;
|
||||||
|
|
||||||
hideLoaderWhenUnsubscribed$ = new Observable(() => () => this.hideShowLoader(false) );
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
private collectionDataService: CollectionDataService,
|
private collectionDataService: CollectionDataService,
|
||||||
@@ -121,7 +119,7 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.subs.push(this.searchField.valueChanges.pipe(
|
this.subs.push(this.searchField.valueChanges.pipe(
|
||||||
debounceTime(300),
|
debounceTime(500),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
startWith('')
|
startWith('')
|
||||||
).subscribe(
|
).subscribe(
|
||||||
@@ -195,9 +193,8 @@ export class CollectionDropdownComponent implements OnInit, OnDestroy {
|
|||||||
collection: { id: collection.id, uuid: collection.id, name: collection.name }
|
collection: { id: collection.id, uuid: collection.id, name: collection.name }
|
||||||
})
|
})
|
||||||
))),
|
))),
|
||||||
scan((acc: any, value: any) => [...acc, ...value], []),
|
reduce((acc: any, value: any) => [...acc, ...value], []),
|
||||||
startWith([]),
|
startWith([])
|
||||||
merge(this.hideLoaderWhenUnsubscribed$)
|
|
||||||
);
|
);
|
||||||
this.subs.push(this.searchListCollection$.subscribe(
|
this.subs.push(this.searchListCollection$.subscribe(
|
||||||
(next) => { this.searchListCollection.push(...next); }, undefined,
|
(next) => { this.searchListCollection.push(...next); }, undefined,
|
||||||
|
Reference in New Issue
Block a user