[ADF-3095] ability to intercept, pause and resume upload process (#3416)

* prevent and resume upload process

* upload fixes and confirmation dialog demo

* ability to toggle the upload confirmation demo

* fix tests

* unit tests

* docs update

* remove deprecation

* fix test name
This commit is contained in:
Denys Vuika
2018-05-31 10:21:32 +01:00
committed by Eugenio Romano
parent 64a8c66103
commit 54e80e7863
11 changed files with 273 additions and 36 deletions

View File

@@ -98,7 +98,7 @@ export class UploadService {
* Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
* @param emitter (Deprecated) Emitter to invoke on file status change
*/
uploadFilesInTheQueue(emitter: EventEmitter<any>): void {
uploadFilesInTheQueue(emitter?: EventEmitter<any>): void {
if (!this.activeTask) {
let file = this.queue.find(currentFile => currentFile.status === FileUploadStatus.Pending);
if (file) {
@@ -200,15 +200,21 @@ export class UploadService {
})
.on('abort', () => {
this.onUploadAborted(file);
emitter.emit({ value: 'File aborted' });
if (emitter) {
emitter.emit({ value: 'File aborted' });
}
})
.on('error', err => {
this.onUploadError(file, err);
emitter.emit({ value: 'Error file uploaded' });
if (emitter) {
emitter.emit({ value: 'Error file uploaded' });
}
})
.on('success', data => {
this.onUploadComplete(file, data);
emitter.emit({ value: data });
if (emitter) {
emitter.emit({ value: data });
}
})
.catch(err => {
throw err;