[AAE-3543] Attach button enabled only when all files uploaded (#6731)

* [AAE-3543] Attach button enabled only when all files uploaded

* [AAE-3543] Add unit tests

* [AAE-3543] Corrected name of unit test

* [AAE-3543] Merged isQueueFinishedUploading() with isUploading()

* [AAE-3543] Added spacing to unit tests
This commit is contained in:
Thomas Hunter
2021-02-26 20:10:11 +01:00
committed by GitHub
parent e3029b12b7
commit a47045ab18
4 changed files with 48 additions and 5 deletions

View File

@@ -88,11 +88,14 @@ export class UploadService {
}
/**
* Checks whether the service is uploading a file.
* @returns True if a file is uploading, false otherwise
* Checks whether the service still has files uploading or awaiting upload.
* @returns True if files in the queue are still uploading, false otherwise
*/
isUploading(): boolean {
return !!this.activeTask;
const finishedFileStates = [FileUploadStatus.Complete, FileUploadStatus.Cancelled, FileUploadStatus.Aborted, FileUploadStatus.Error, FileUploadStatus.Deleted];
return this.queue.reduce((stillUploading: boolean, currentFile: FileModel) => {
return stillUploading || finishedFileStates.indexOf(currentFile.status) === -1;
}, false);
}
/**