mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-1348] Upload Dialog - 'Cancel All' button does not render (#2192)
* refactored isUploadCancelled and isUploadCompleted * improved checks
This commit is contained in:
committed by
Mario Romano
parent
e6ae21a0bc
commit
734c1260ca
@@ -91,17 +91,14 @@ export class FileUploadingListComponent {
|
||||
* @returns {boolean} - false if there is at least one file in Progress
|
||||
*/
|
||||
isUploadCompleted(): boolean {
|
||||
let isPending = false;
|
||||
let isAllCompleted = true;
|
||||
|
||||
for (let i = 0; i < this.files.length && !isPending; i++) {
|
||||
let file = this.files[i];
|
||||
if (file.status === FileUploadStatus.Progress) {
|
||||
isPending = true;
|
||||
isAllCompleted = false;
|
||||
}
|
||||
}
|
||||
return isAllCompleted;
|
||||
return !this.isUploadCancelled() &&
|
||||
!!this.files.length &&
|
||||
!this.files
|
||||
.some(({status}) =>
|
||||
status === FileUploadStatus.Starting ||
|
||||
status === FileUploadStatus.Progress ||
|
||||
status === FileUploadStatus.Pending
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,10 +106,13 @@ export class FileUploadingListComponent {
|
||||
* @returns {boolean} - false if there is at least one file in Progress
|
||||
*/
|
||||
isUploadCancelled(): boolean {
|
||||
return this.files
|
||||
.filter((file) => file.status !== FileUploadStatus.Error)
|
||||
.every((file) => file.status === FileUploadStatus.Cancelled
|
||||
|| file.status === FileUploadStatus.Aborted);
|
||||
return !!this.files.length &&
|
||||
this.files
|
||||
.every(({status}) =>
|
||||
status === FileUploadStatus.Aborted ||
|
||||
status === FileUploadStatus.Cancelled ||
|
||||
status === FileUploadStatus.Error
|
||||
);
|
||||
}
|
||||
|
||||
uploadErrorFiles(): FileModel[] {
|
||||
|
Reference in New Issue
Block a user