message for folder upload

This commit is contained in:
sanjayk03-dev
2024-04-09 12:31:48 +05:30
parent d1764d4f09
commit 6b392ab21a
2 changed files with 21 additions and 2 deletions

View File

@@ -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 () {

View File

@@ -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",