mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Ensure a valid sort is specified
This commit is contained in:
@@ -28,6 +28,7 @@ import { SearchConfigurationService } from '../../../core/shared/search/search-c
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { NoContent } from '../../../core/shared/NoContent.model';
|
||||
import { getItemPageRoute } from '../../item-page-routing-paths';
|
||||
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-item-collection-mapper',
|
||||
@@ -73,6 +74,12 @@ export class ItemCollectionMapperComponent implements OnInit {
|
||||
*/
|
||||
mappedCollectionsRD$: Observable<RemoteData<PaginatedList<Collection>>>;
|
||||
|
||||
/**
|
||||
* Sort on title ASC by default
|
||||
* @type {SortOptions}
|
||||
*/
|
||||
defaultSortOptions: SortOptions = new SortOptions('dc.title', SortDirection.ASC);
|
||||
|
||||
/**
|
||||
* Firing this observable (shouldUpdate$.next(true)) forces the two lists to reload themselves
|
||||
* Usually fired after the lists their cache is cleared (to force a new request to the REST API)
|
||||
@@ -149,7 +156,8 @@ export class ItemCollectionMapperComponent implements OnInit {
|
||||
switchMap(([itemCollectionsRD, owningCollectionRD, searchOptions]) => {
|
||||
return this.searchService.search(Object.assign(new PaginatedSearchOptions(searchOptions), {
|
||||
query: this.buildQuery([...itemCollectionsRD.payload.page, owningCollectionRD.payload], searchOptions.query),
|
||||
dsoTypes: [DSpaceObjectType.COLLECTION]
|
||||
dsoTypes: [DSpaceObjectType.COLLECTION],
|
||||
sort: this.defaultSortOptions
|
||||
}), 10000).pipe(
|
||||
toDSpaceObjectListRD(),
|
||||
startWith(undefined)
|
||||
|
Reference in New Issue
Block a user