#118 Add button to cancel all the remaining upload

This commit is contained in:
mauriziovitale84
2016-05-31 17:10:23 +01:00
parent 4a4a5468af
commit f4e8f6ed65
5 changed files with 65 additions and 2 deletions

View File

@@ -61,4 +61,30 @@ export class FileUploadingListComponent {
});
file[0].setAbort();
}
/**
* Call the abort method for each file
*/
cancelAllFiles() {
this.filesUploadingList.forEach((uploadingFileModel: FileModel) => {
uploadingFileModel.setAbort();
});
}
/**
* Verify if all the files are in state done or abort
* @returns {boolean} - false if there is a file in progress
*/
isUploadCompleted() {
let isPending = false;
let isAllCompleted = true;
for (let i = 0; i < this.filesUploadingList.length && !isPending; i++) {
let uploadingFileModel = this.filesUploadingList[i];
if (!uploadingFileModel.done && !uploadingFileModel.abort) {
isPending = true;
isAllCompleted = false;
}
}
return isAllCompleted;
}
}