[ADF-1358] Upload Dialog - Uploaded indicator should take in consideration cancelled files (#2197)

* indicate the number of files completed over cancelled ones

* changed test names
This commit is contained in:
Cilibiu Bogdan
2017-08-10 17:09:15 +03:00
committed by Mario Romano
parent f2db536148
commit 4ec188141b
5 changed files with 83 additions and 36 deletions

View File

@@ -87,8 +87,8 @@ export class FileUploadingListComponent {
}
/**
* Check if all the files are not in the Progress state.
* @returns {boolean} - false if there is at least one file in Progress
* Checks if all the files are uploaded
* @returns {boolean} - false if there is at least one file in Progress | Starting | Pending
*/
isUploadCompleted(): boolean {
return !this.isUploadCancelled() &&
@@ -102,8 +102,8 @@ export class FileUploadingListComponent {
}
/**
* Check if all the files are not in the Progress state.
* @returns {boolean} - false if there is at least one file in Progress
* Check if all the files are Cancelled | Aborted | Error.
* @returns {boolean} - false if there is at least one file in uploading states
*/
isUploadCancelled(): boolean {
return !!this.files.length &&
@@ -115,12 +115,20 @@ export class FileUploadingListComponent {
);
}
uploadErrorFiles(): FileModel[] {
return this.files.filter((item) => item.status === FileUploadStatus.Error);
/**
* Gets all the files with status Error.
* @returns {boolean} - false if there is none
*/
get uploadErrorFiles(): FileModel[] {
return this.files.filter(({status}) => status === FileUploadStatus.Error);
}
totalErrorFiles(): number {
return this.files.filter((item) => item.status === FileUploadStatus.Error).length;
/**
* Gets all the files with status Cancelled.
* @returns {boolean} - false if there is none
*/
get uploadCancelledFiles(): FileModel[] {
return this.files.filter(({status}) => status === FileUploadStatus.Cancelled);
}
private onRemoveSuccess(file: FileModel): void {