message for folder upload
This commit is contained in:
@@ -534,6 +534,15 @@ module.exports = {
|
||||
this.config.non_macros_list = [...this.state.non_macros_list];
|
||||
this.config.gcode_list = [...this.state.gcode_list];
|
||||
|
||||
let filesUploaded = 0;
|
||||
const totalFiles = files.length;
|
||||
|
||||
const checkIfAllFilesUploaded = () => {
|
||||
if (filesUploaded === totalFiles) {
|
||||
this.uploadFolder = false;
|
||||
}
|
||||
};
|
||||
|
||||
for (let file of files) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
@@ -549,6 +558,8 @@ module.exports = {
|
||||
|
||||
default:
|
||||
alert(`Unsupported file type: ${extension}`);
|
||||
filesUploaded++;
|
||||
checkIfAllFilesUploaded();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -577,15 +588,18 @@ module.exports = {
|
||||
}
|
||||
|
||||
this.save_config(this.config);
|
||||
filesUploaded++;
|
||||
checkIfAllFilesUploaded();
|
||||
};
|
||||
|
||||
reader.onerror = error => {
|
||||
alert("Error uploading file: ", error);
|
||||
this.uploadFolder = false;
|
||||
filesUploaded++;
|
||||
checkIfAllFilesUploaded();
|
||||
};
|
||||
reader.readAsText(file, "utf-8");
|
||||
}
|
||||
this.uploadFolder = false;
|
||||
},
|
||||
|
||||
delete_current: async function () {
|
||||
|
||||
@@ -276,7 +276,12 @@ script#control-view-template(type="text/x-template")
|
||||
|
||||
message(:show.sync="uploadFolder")
|
||||
h3(slot="header") Uploading
|
||||
p(slot="body") Uploading files is currently in progress. Do not close window.
|
||||
div(slot="body")
|
||||
p
|
||||
|
|
||||
| Uploading files is currently in progress.
|
||||
| Do not close window.
|
||||
|
|
||||
div(slot="footer")
|
||||
|
||||
button.pure-button(title="Execute one program step.", @click="step",
|
||||
|
||||
Reference in New Issue
Block a user