65717: Edit-bitstreams fetch all bundles and expandable bitstream list

This commit is contained in:
Kristof De Langhe
2019-10-23 17:04:23 +02:00
parent cbbc776922
commit 7e3ba86ccc
8 changed files with 138 additions and 20 deletions

View File

@@ -20,6 +20,7 @@ import { Item } from '../../../core/shared/item.model';
import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list';
import { Bundle } from '../../../core/shared/bundle.model';
import { PaginatedSearchOptions } from '../../../+search-page/paginated-search-options.model';
@Component({
selector: 'ds-item-bitstreams',
@@ -36,6 +37,15 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
*/
bundles$: Observable<Bundle[]>;
/**
* The page options to use for fetching the bundles
*/
bundlesOptions = {
id: 'bundles-pagination-options',
currentPage: 1,
pageSize: 9999
} as any;
/**
* A subscription that checks when the item is deleted in cache and reloads the item by sending a new request
* This is used to update the item in cache after bitstreams are deleted
@@ -70,7 +80,7 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
* Actions to perform after the item has been initialized
*/
postItemInit(): void {
this.bundles$ = this.item.bundles.pipe(
this.bundles$ = this.itemService.getBundles(this.item.id, new PaginatedSearchOptions({pagination: this.bundlesOptions})).pipe(
getSucceededRemoteData(),
getRemoteDataPayload(),
map((bundlePage: PaginatedList<Bundle>) => bundlePage.page)