@@ -22,11 +22,7 @@ import {
2222 TranslateModule ,
2323 TranslateService ,
2424} from '@ngx-translate/core' ;
25- import {
26- BehaviorSubject ,
27- Observable ,
28- Subscription ,
29- } from 'rxjs' ;
25+ import { Subscription } from 'rxjs' ;
3026import {
3127 map ,
3228 take ,
@@ -43,6 +39,15 @@ import { Collection } from '../core/shared/collection.model';
4339import { getFirstCompletedRemoteData } from '../core/shared/operators' ;
4440import { FileValidator } from '../shared/utils/require-file.validator' ;
4541
42+ /**
43+ * Form values for bulk import page
44+ */
45+ interface BulkImportFormValues {
46+ name : string ;
47+ file ?: File ;
48+ abortOnError : boolean ;
49+ }
50+
4651/**
4752 * Page to perform an items bulk imports into the given collection.
4853 */
@@ -65,12 +70,6 @@ export class BulkImportPageComponent implements OnInit, OnDestroy {
6570
6671 subs : Subscription [ ] = [ ] ;
6772
68- /**
69- * A boolean representing if a create delete operation is pending
70- * @type {BehaviorSubject<boolean> }
71- */
72- processingImport$ : BehaviorSubject < boolean > = new BehaviorSubject < boolean > ( false ) ;
73-
7473 private selectedFile : File ;
7574
7675 constructor (
@@ -113,8 +112,12 @@ export class BulkImportPageComponent implements OnInit, OnDestroy {
113112 * @param form
114113 */
115114 submit ( ) {
115+ if ( ! this . selectedFile ) {
116+ this . notificationsService . error ( this . translationService . get ( 'bulk-import.error.no-file' ) ) ;
117+ return ;
118+ }
116119
117- const values : any = this . form . value ;
120+ const values : BulkImportFormValues = this . form . value ;
118121
119122 const stringParameters : ProcessParameter [ ] = [
120123 { name : '-c' , value : this . collectionId } ,
@@ -141,14 +144,6 @@ export class BulkImportPageComponent implements OnInit, OnDestroy {
141144 this . router . navigateByUrl ( getCollectionPageRoute ( this . collectionId ) ) ;
142145 }
143146
144- /**
145- * Return a boolean representing if t import operation is pending.
146- *
147- * @return {Observable<boolean> }
148- */
149- isProcessingImport ( ) : Observable < boolean > {
150- return this . processingImport$ . asObservable ( ) ;
151- }
152147
153148 private navigateToProcesses ( ) {
154149 this . requestService . setStaleByHrefSubstring ( '/processes' ) ;
0 commit comments