64387: UploadBitstreamComponent intermediate commit

This commit is contained in:
Kristof De Langhe
2019-08-14 17:53:07 +02:00
parent 0ad505ba30
commit d1dbe49333
5 changed files with 66 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { RemoteData } from '../../../core/data/remote-data';
import { Item } from '../../../core/shared/item.model';
import { map } from 'rxjs/operators';
import { ActivatedRoute, Router } from '@angular/router';
@Component({
selector: 'ds-upload-bitstream',
templateUrl: './upload-bitstream.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
/**
* Page component for uploading a bitstream to an item
*/
export class UploadBitstreamComponent implements OnInit {
/**
* The item to upload a bitstream to
*/
itemRD$: Observable<RemoteData<Item>>;
/**
* The name of the bundle to add the bitstream to
* Defaults to ORIGINAL
*/
bundleName$: Observable<string>;
constructor(private route: ActivatedRoute) {
}
ngOnInit(): void {
this.itemRD$ = this.route.data.pipe(map((data) => data.item));
this.bundleName$ = this.route.queryParams.pipe(map((params) => params.bundleName));
}
}