68346: Post-master-merge fixes & links

This commit is contained in:
Kristof De Langhe
2020-03-05 17:47:09 +01:00
parent a054938d80
commit cb21cd47bb
7 changed files with 24 additions and 11 deletions

View File

@@ -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

View File

@@ -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')
))
);
}

View File

@@ -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) {
}

View File

@@ -2,7 +2,7 @@
<div class="{{columnSizes.columns[0].buildClasses()}} row-element d-flex">
<ng-content select="[slot=drag-handle]"></ng-content>
<div class="float-left d-flex align-items-center">
{{ bitstream.name }}
{{ bitstreamName }}
</div>
</div>
<div class="{{columnSizes.columns[1].buildClasses()}} row-element d-flex align-items-center">
@@ -12,7 +12,7 @@
</div>
<div class="{{columnSizes.columns[2].buildClasses()}} row-element d-flex align-items-center">
<div class="text-center w-100">
{{ (format$ | async).shortDescription }}
{{ (format$ | async)?.shortDescription }}
</div>
</div>
<div class="{{columnSizes.columns[3].buildClasses()}} row-element d-flex align-items-center">

View File

@@ -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<BitstreamFormat>;
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()

View File

@@ -99,8 +99,9 @@ export class BundleDataService extends DataService<Bundle> {
* 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<RemoteData<PaginatedList<Bitstream>>> {
getBitstreams(bundleId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: Array<FollowLinkConfig<Bitstream>>): Observable<RemoteData<PaginatedList<Bitstream>>> {
const hrefObs = this.getBitstreamsEndpoint(bundleId).pipe(
map((href) => searchOptions ? searchOptions.toRestUrl(href) : href)
);
@@ -111,6 +112,6 @@ export class BundleDataService extends DataService<Bundle> {
this.requestService.configure(request);
});
return this.rdbService.buildList<Bitstream>(hrefObs);
return this.rdbService.buildList<Bitstream>(hrefObs, ...linksToFollow);
}
}

View File

@@ -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<RemoteData<BitstreamFormat>>;
}