diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.ts index 1aa5492730..1f50594685 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/item-edit-bitstream-bundle.component.ts @@ -17,7 +17,7 @@ export class ItemEditBitstreamBundleComponent implements OnInit { /** * The view on the bundle information and bitstreams */ - @ViewChild('bundleView', {static: false}) bundleView; + @ViewChild('bundleView', {static: true}) bundleView; /** * The bundle to display bitstreams for diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.ts index 4c52f5f811..5548da4029 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-bundle/paginated-drag-and-drop-bitstream-list/paginated-drag-and-drop-bitstream-list.component.ts @@ -7,6 +7,7 @@ import { BundleDataService } from '../../../../../core/data/bundle-data.service' import { switchMap } from 'rxjs/operators'; import { PaginatedSearchOptions } from '../../../../../shared/search/paginated-search-options.model'; import { ResponsiveTableSizes } from '../../../../../shared/responsive-table-sizes/responsive-table-sizes'; +import { followLink } from '../../../../../shared/utils/follow-link-config.model'; @Component({ selector: 'ds-paginated-drag-and-drop-bitstream-list', @@ -45,8 +46,11 @@ export class PaginatedDragAndDropBitstreamListComponent extends AbstractPaginate */ initializeObjectsRD(): void { this.objectsRD$ = this.currentPage$.pipe( - switchMap((page: number) => this.bundleService.getBitstreams(this.bundle.id, - new PaginatedSearchOptions({pagination: Object.assign({}, this.options, { currentPage: page })}))) + switchMap((page: number) => this.bundleService.getBitstreams( + this.bundle.id, + new PaginatedSearchOptions({pagination: Object.assign({}, this.options, { currentPage: page })}), + followLink('format') + )) ); } diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-drag-handle/item-edit-bitstream-drag-handle.component.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-drag-handle/item-edit-bitstream-drag-handle.component.ts index 7e9ca9ceba..3610fe4603 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-drag-handle/item-edit-bitstream-drag-handle.component.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream-drag-handle/item-edit-bitstream-drag-handle.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core'; @Component({ selector: 'ds-item-edit-bitstream-drag-handle', @@ -9,7 +9,7 @@ export class ItemEditBitstreamDragHandleComponent implements OnInit { /** * The view on the drag-handle */ - @ViewChild('handleView', {static: false}) handleView; + @ViewChild('handleView', {static: true}) handleView; constructor(private viewContainerRef: ViewContainerRef) { } diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.html b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.html index 0885fa5c32..08c7cf28df 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.html +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.html @@ -2,7 +2,7 @@
- {{ bitstream.name }} + {{ bitstreamName }}
@@ -12,7 +12,7 @@
- {{ (format$ | async).shortDescription }} + {{ (format$ | async)?.shortDescription }}
diff --git a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts index 19f0924989..87aab109a0 100644 --- a/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts +++ b/src/app/+item-page/edit-item-page/item-bitstreams/item-edit-bitstream/item-edit-bitstream.component.ts @@ -8,6 +8,7 @@ import { Observable } from 'rxjs/internal/Observable'; import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model'; import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators'; import { ResponsiveTableSizes } from '../../../../shared/responsive-table-sizes/responsive-table-sizes'; +import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-item-edit-bitstream', @@ -22,7 +23,7 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit { /** * The view on the bitstream */ - @ViewChild('bitstreamView', {static: false}) bitstreamView; + @ViewChild('bitstreamView', {static: true}) bitstreamView; /** * The current field, value and state of the bitstream @@ -44,12 +45,18 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit { */ bitstream: Bitstream; + /** + * The bitstream's name + */ + bitstreamName: string; + /** * The format of the bitstream */ format$: Observable; constructor(private objectUpdatesService: ObjectUpdatesService, + private dsoNameService: DSONameService, private viewContainerRef: ViewContainerRef) { } @@ -63,6 +70,7 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit { */ ngOnChanges(changes: SimpleChanges): void { this.bitstream = cloneDeep(this.fieldUpdate.field) as Bitstream; + this.bitstreamName = this.dsoNameService.getName(this.bitstream); this.format$ = this.bitstream.format.pipe( getSucceededRemoteData(), getRemoteDataPayload() diff --git a/src/app/core/data/bundle-data.service.ts b/src/app/core/data/bundle-data.service.ts index 498c3d48ff..160ea0ff0d 100644 --- a/src/app/core/data/bundle-data.service.ts +++ b/src/app/core/data/bundle-data.service.ts @@ -99,8 +99,9 @@ export class BundleDataService extends DataService { * Get a bundle's bitstreams using paginated search options * @param bundleId The bundle's ID * @param searchOptions The search options to use + * @param linksToFollow The {@link FollowLinkConfig}s for the request */ - getBitstreams(bundleId: string, searchOptions?: PaginatedSearchOptions): Observable>> { + getBitstreams(bundleId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: Array>): Observable>> { const hrefObs = this.getBitstreamsEndpoint(bundleId).pipe( map((href) => searchOptions ? searchOptions.toRestUrl(href) : href) ); @@ -111,6 +112,6 @@ export class BundleDataService extends DataService { this.requestService.configure(request); }); - return this.rdbService.buildList(hrefObs); + return this.rdbService.buildList(hrefObs, ...linksToFollow); } } diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts index 231d44eeff..ab9d1548b7 100644 --- a/src/app/core/shared/bitstream.model.ts +++ b/src/app/core/shared/bitstream.model.ts @@ -54,7 +54,7 @@ export class Bitstream extends DSpaceObject implements HALResource { * The BitstreamFormat of this Bitstream * Will be undefined unless the format {@link HALLink} has been resolved. */ - @link(BITSTREAM_FORMAT) + @link(BITSTREAM_FORMAT, false, 'format') format?: Observable>; }