mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#118 Add button to cancel all the remaining upload
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
"FILE_UPLOAD": {
|
"FILE_UPLOAD": {
|
||||||
"BUTTON": {
|
"BUTTON": {
|
||||||
"UPLOAD_FILE": "Upload file",
|
"UPLOAD_FILE": "Upload file",
|
||||||
"UPLOAD_FOLDER": "Upload folder"
|
"UPLOAD_FOLDER": "Upload folder",
|
||||||
|
"CANCEL": "CANCEL"
|
||||||
},
|
},
|
||||||
"MESSAGES": {
|
"MESSAGES": {
|
||||||
"COMPLETED": "uploads complete",
|
"COMPLETED": "uploads complete",
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
"FILE_UPLOAD": {
|
"FILE_UPLOAD": {
|
||||||
"BUTTON": {
|
"BUTTON": {
|
||||||
"UPLOAD_FILE": "Carica un file",
|
"UPLOAD_FILE": "Carica un file",
|
||||||
"UPLOAD_FOLDER": "Carica una cartella"
|
"UPLOAD_FOLDER": "Carica una cartella",
|
||||||
|
"CANCEL": "CANCELLA"
|
||||||
},
|
},
|
||||||
"MESSAGES": {
|
"MESSAGES": {
|
||||||
"COMPLETED": "caricamenti completati",
|
"COMPLETED": "caricamenti completati",
|
||||||
|
@@ -6,3 +6,33 @@
|
|||||||
.cursor {
|
.cursor {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.body-dialog-header {
|
||||||
|
display: -webkit-box;
|
||||||
|
display: -moz-box;
|
||||||
|
display: -ms-flexbox;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-bottom: solid 1px #eee;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-dialog-action {
|
||||||
|
-webkit-flex: 1 1 auto;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0 18px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-dialog-cancel {
|
||||||
|
-webkit-flex: none;
|
||||||
|
flex: none;
|
||||||
|
display: inline;
|
||||||
|
padding-right: 13px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
@@ -1,3 +1,8 @@
|
|||||||
|
<div [ngClass]="{hide: isUploadCompleted()}" [ngClass]="{show: !isUploadCompleted()}"
|
||||||
|
class="body-dialog-header">
|
||||||
|
<div class="body-dialog-action"></div>
|
||||||
|
<div class="body-dialog-cancel"><a href="#" (click)="cancelAllFiles()">{{'FILE_UPLOAD.BUTTON.CANCEL' | translate}}</a></div>
|
||||||
|
</div>
|
||||||
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{'FILE_UPLOAD.FILE_INFO.NAME' | translate}}</th>
|
<th>{{'FILE_UPLOAD.FILE_INFO.NAME' | translate}}</th>
|
||||||
|
@@ -61,4 +61,30 @@ export class FileUploadingListComponent {
|
|||||||
});
|
});
|
||||||
file[0].setAbort();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user