-
- {{'item.bitstreams.upload.bundles.empty' | translate}}
-
-
diff --git a/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts b/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts
index 958b5181fd..35982a5233 100644
--- a/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts
+++ b/src/app/+item-page/bitstreams/upload/upload-bitstream.component.ts
@@ -1,4 +1,4 @@
-import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
+import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { RemoteData } from '../../../core/data/remote-data';
import { Item } from '../../../core/shared/item.model';
@@ -6,7 +6,7 @@ import { map, switchMap, take } from 'rxjs/operators';
import { ActivatedRoute, Router } from '@angular/router';
import { UploaderOptions } from '../../../shared/uploader/uploader-options.model';
import { Subscription } from 'rxjs/internal/Subscription';
-import { hasValue, isEmpty } from '../../../shared/empty.util';
+import { hasValue, isEmpty, isNotEmpty } from '../../../shared/empty.util';
import { ItemDataService } from '../../../core/data/item-data.service';
import { AuthService } from '../../../core/auth/auth.service';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
@@ -15,17 +15,28 @@ import { getBitstreamModulePath } from '../../../app-routing.module';
import { PaginatedList } from '../../../core/data/paginated-list';
import { Bundle } from '../../../core/shared/bundle.model';
import { BundleDataService } from '../../../core/data/bundle-data.service';
-import { getRemoteDataPayload, getSucceededRemoteData } from '../../../core/shared/operators';
+import {
+ getFirstSucceededRemoteDataPayload
+} from '../../../core/shared/operators';
+import { UploaderComponent } from '../../../shared/uploader/uploader.component';
@Component({
selector: 'ds-upload-bitstream',
- templateUrl: './upload-bitstream.component.html',
- changeDetection: ChangeDetectionStrategy.OnPush
+ templateUrl: './upload-bitstream.component.html'
})
/**
* Page component for uploading a bitstream to an item
*/
export class UploadBitstreamComponent implements OnInit, OnDestroy {
+ /**
+ * The file uploader component
+ */
+ @ViewChild(UploaderComponent, {static: false}) uploaderComponent: UploaderComponent;
+
+ /**
+ * The ID of the item to upload a bitstream to
+ */
+ itemId: string;
/**
* The item to upload a bitstream to
@@ -59,6 +70,11 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy {
itemAlias: null
});
+ /**
+ * The prefix for all i18n notification messages within this component
+ */
+ NOTIFICATIONS_PREFIX = 'item.bitstreams.upload.notifications.';
+
/**
* Array to track all subscriptions and unsubscribe them onDestroy
* @type {Array}
@@ -83,27 +99,45 @@ export class UploadBitstreamComponent implements OnInit, OnDestroy {
* Calls setUploadUrl after setting the selected bundle
*/
ngOnInit(): void {
+ this.itemId = this.route.snapshot.params.id;
this.itemRD$ = this.route.data.pipe(map((data) => data.item));
this.bundlesRD$ = this.itemRD$.pipe(
switchMap((itemRD: RemoteData