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 * The view on the bundle information and bitstreams
*/ */
@ViewChild('bundleView', {static: false}) bundleView; @ViewChild('bundleView', {static: true}) bundleView;
/** /**
* The bundle to display bitstreams for * 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 { switchMap } from 'rxjs/operators';
import { PaginatedSearchOptions } from '../../../../../shared/search/paginated-search-options.model'; import { PaginatedSearchOptions } from '../../../../../shared/search/paginated-search-options.model';
import { ResponsiveTableSizes } from '../../../../../shared/responsive-table-sizes/responsive-table-sizes'; import { ResponsiveTableSizes } from '../../../../../shared/responsive-table-sizes/responsive-table-sizes';
import { followLink } from '../../../../../shared/utils/follow-link-config.model';
@Component({ @Component({
selector: 'ds-paginated-drag-and-drop-bitstream-list', selector: 'ds-paginated-drag-and-drop-bitstream-list',
@@ -45,8 +46,11 @@ export class PaginatedDragAndDropBitstreamListComponent extends AbstractPaginate
*/ */
initializeObjectsRD(): void { initializeObjectsRD(): void {
this.objectsRD$ = this.currentPage$.pipe( this.objectsRD$ = this.currentPage$.pipe(
switchMap((page: number) => this.bundleService.getBitstreams(this.bundle.id, switchMap((page: number) => this.bundleService.getBitstreams(
new PaginatedSearchOptions({pagination: Object.assign({}, this.options, { currentPage: page })}))) 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({ @Component({
selector: 'ds-item-edit-bitstream-drag-handle', selector: 'ds-item-edit-bitstream-drag-handle',
@@ -9,7 +9,7 @@ export class ItemEditBitstreamDragHandleComponent implements OnInit {
/** /**
* The view on the drag-handle * The view on the drag-handle
*/ */
@ViewChild('handleView', {static: false}) handleView; @ViewChild('handleView', {static: true}) handleView;
constructor(private viewContainerRef: ViewContainerRef) { constructor(private viewContainerRef: ViewContainerRef) {
} }

View File

@@ -2,7 +2,7 @@
<div class="{{columnSizes.columns[0].buildClasses()}} row-element d-flex"> <div class="{{columnSizes.columns[0].buildClasses()}} row-element d-flex">
<ng-content select="[slot=drag-handle]"></ng-content> <ng-content select="[slot=drag-handle]"></ng-content>
<div class="float-left d-flex align-items-center"> <div class="float-left d-flex align-items-center">
{{ bitstream.name }} {{ bitstreamName }}
</div> </div>
</div> </div>
<div class="{{columnSizes.columns[1].buildClasses()}} row-element d-flex align-items-center"> <div class="{{columnSizes.columns[1].buildClasses()}} row-element d-flex align-items-center">
@@ -12,7 +12,7 @@
</div> </div>
<div class="{{columnSizes.columns[2].buildClasses()}} row-element d-flex align-items-center"> <div class="{{columnSizes.columns[2].buildClasses()}} row-element d-flex align-items-center">
<div class="text-center w-100"> <div class="text-center w-100">
{{ (format$ | async).shortDescription }} {{ (format$ | async)?.shortDescription }}
</div> </div>
</div> </div>
<div class="{{columnSizes.columns[3].buildClasses()}} row-element d-flex align-items-center"> <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 { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators'; import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators';
import { ResponsiveTableSizes } from '../../../../shared/responsive-table-sizes/responsive-table-sizes'; import { ResponsiveTableSizes } from '../../../../shared/responsive-table-sizes/responsive-table-sizes';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
@Component({ @Component({
selector: 'ds-item-edit-bitstream', selector: 'ds-item-edit-bitstream',
@@ -22,7 +23,7 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit {
/** /**
* The view on the bitstream * The view on the bitstream
*/ */
@ViewChild('bitstreamView', {static: false}) bitstreamView; @ViewChild('bitstreamView', {static: true}) bitstreamView;
/** /**
* The current field, value and state of the bitstream * The current field, value and state of the bitstream
@@ -44,12 +45,18 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit {
*/ */
bitstream: Bitstream; bitstream: Bitstream;
/**
* The bitstream's name
*/
bitstreamName: string;
/** /**
* The format of the bitstream * The format of the bitstream
*/ */
format$: Observable<BitstreamFormat>; format$: Observable<BitstreamFormat>;
constructor(private objectUpdatesService: ObjectUpdatesService, constructor(private objectUpdatesService: ObjectUpdatesService,
private dsoNameService: DSONameService,
private viewContainerRef: ViewContainerRef) { private viewContainerRef: ViewContainerRef) {
} }
@@ -63,6 +70,7 @@ export class ItemEditBitstreamComponent implements OnChanges, OnInit {
*/ */
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
this.bitstream = cloneDeep(this.fieldUpdate.field) as Bitstream; this.bitstream = cloneDeep(this.fieldUpdate.field) as Bitstream;
this.bitstreamName = this.dsoNameService.getName(this.bitstream);
this.format$ = this.bitstream.format.pipe( this.format$ = this.bitstream.format.pipe(
getSucceededRemoteData(), getSucceededRemoteData(),
getRemoteDataPayload() getRemoteDataPayload()

View File

@@ -99,8 +99,9 @@ export class BundleDataService extends DataService<Bundle> {
* Get a bundle's bitstreams using paginated search options * Get a bundle's bitstreams using paginated search options
* @param bundleId The bundle's ID * @param bundleId The bundle's ID
* @param searchOptions The search options to use * @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( const hrefObs = this.getBitstreamsEndpoint(bundleId).pipe(
map((href) => searchOptions ? searchOptions.toRestUrl(href) : href) map((href) => searchOptions ? searchOptions.toRestUrl(href) : href)
); );
@@ -111,6 +112,6 @@ export class BundleDataService extends DataService<Bundle> {
this.requestService.configure(request); 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 * The BitstreamFormat of this Bitstream
* Will be undefined unless the format {@link HALLink} has been resolved. * Will be undefined unless the format {@link HALLink} has been resolved.
*/ */
@link(BITSTREAM_FORMAT) @link(BITSTREAM_FORMAT, false, 'format')
format?: Observable<RemoteData<BitstreamFormat>>; format?: Observable<RemoteData<BitstreamFormat>>;
} }