upload dialog improvements (#1740)

Various upload dialog improvements

- fix: headers alignment
- fix: Name column alignment
- fix: rename ‘CANCEL’ button to ‘Cancel all’ (as it’s what it does)
- fix: ‘Cancel all’ button still visible after all upload complete
- new: improved layout and api for file upload components
- new: strongly typed methods for UploadService
This commit is contained in:
Denys Vuika
2017-03-21 14:45:48 +00:00
committed by Eugenio Romano
parent c846556e28
commit 62915aff93
12 changed files with 89 additions and 96 deletions

View File

@@ -66,20 +66,18 @@ export class UploadService {
*
* return {FileModel[]} - return the file added to the queue in this call.
*/
addToQueue(files: any[]): FileModel[] {
let latestFilesAdded: FileModel[] = [];
addToQueue(files: File[]): FileModel[] {
const result: FileModel[] = [];
for (let file of files) {
if (this.isFile(file)) {
let uploadingFileModel = new FileModel(file);
latestFilesAdded.push(uploadingFileModel);
this.queue.push(uploadingFileModel);
if (this.filesUploadObserverProgressBar) {
this.filesUploadObserverProgressBar.next(this.queue);
}
let uploadingFileModel = new FileModel(file);
result.push(uploadingFileModel);
this.queue.push(uploadingFileModel);
if (this.filesUploadObserverProgressBar) {
this.filesUploadObserverProgressBar.next(this.queue);
}
}
return latestFilesAdded;
return result;
}
/**
@@ -149,15 +147,6 @@ export class UploadService {
return this.queue;
}
/**
* Check if an item is a file.
*
* @return {boolean}
*/
private isFile(file: any): boolean {
return file !== null && (file instanceof Blob || (file.name && file.size));
}
/**
* Create a folder
* @param name - the folder name