message in upload folder
This commit is contained in:
@@ -52,6 +52,7 @@ module.exports = {
|
|||||||
GCodeNotFound: false,
|
GCodeNotFound: false,
|
||||||
uploadFolder: false,
|
uploadFolder: false,
|
||||||
filesUploaded: 0,
|
filesUploaded: 0,
|
||||||
|
totalFiles: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -488,7 +489,9 @@ module.exports = {
|
|||||||
|
|
||||||
xhr.onload = function () {
|
xhr.onload = function () {
|
||||||
this.filesUploaded++;
|
this.filesUploaded++;
|
||||||
checkIfAllFilesUploaded();
|
if (this.filesUploaded == this.totalFiles) {
|
||||||
|
this.uploadFolder = false;
|
||||||
|
}
|
||||||
if (xhr.status >= 200 && xhr.status < 300) {
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
console.log("File uploaded " + filename);
|
console.log("File uploaded " + filename);
|
||||||
} else {
|
} else {
|
||||||
@@ -535,6 +538,8 @@ module.exports = {
|
|||||||
upload_folder: async function (e) {
|
upload_folder: async function (e) {
|
||||||
this.uploadFolder = true;
|
this.uploadFolder = true;
|
||||||
this.filesUploaded = 0;
|
this.filesUploaded = 0;
|
||||||
|
this.totalFiles = files.length;
|
||||||
|
|
||||||
const files = e.target.files || e.dataTransfer.files;
|
const files = e.target.files || e.dataTransfer.files;
|
||||||
if (!files.length) {
|
if (!files.length) {
|
||||||
return;
|
return;
|
||||||
@@ -544,8 +549,6 @@ module.exports = {
|
|||||||
this.config.non_macros_list = [...this.state.non_macros_list];
|
this.config.non_macros_list = [...this.state.non_macros_list];
|
||||||
this.config.gcode_list = [...this.state.gcode_list];
|
this.config.gcode_list = [...this.state.gcode_list];
|
||||||
|
|
||||||
const totalFiles = files.length;
|
|
||||||
|
|
||||||
for (let file of files) {
|
for (let file of files) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
@@ -562,7 +565,9 @@ module.exports = {
|
|||||||
default:
|
default:
|
||||||
alert(`Unsupported file type: ${extension}`);
|
alert(`Unsupported file type: ${extension}`);
|
||||||
this.filesUploaded++;
|
this.filesUploaded++;
|
||||||
checkIfAllFilesUploaded();
|
if (this.filesUploaded == this.totalFiles) {
|
||||||
|
this.uploadFolder = false;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -597,7 +602,9 @@ module.exports = {
|
|||||||
alert("Error uploading file: ", error);
|
alert("Error uploading file: ", error);
|
||||||
this.uploadFolder = false;
|
this.uploadFolder = false;
|
||||||
this.filesUploaded++;
|
this.filesUploaded++;
|
||||||
checkIfAllFilesUploaded();
|
if (this.filesUploaded == this.totalFiles) {
|
||||||
|
this.uploadFolder = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
reader.readAsText(file, "utf-8");
|
reader.readAsText(file, "utf-8");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,11 +277,10 @@ script#control-view-template(type="text/x-template")
|
|||||||
message(:show.sync="uploadFolder")
|
message(:show.sync="uploadFolder")
|
||||||
h3(slot="header") Uploading
|
h3(slot="header") Uploading
|
||||||
div(slot="body")
|
div(slot="body")
|
||||||
|
h3 Uploading files is currently in progress
|
||||||
p
|
p
|
||||||
| {{filesUploaded}} files uploaded
|
| {{filesUploaded}} files uploaded.
|
||||||
| Uploading files is currently in progress.
|
|
||||||
| Do not close window.
|
| Do not close window.
|
||||||
|
|
|
||||||
div(slot="footer")
|
div(slot="footer")
|
||||||
|
|
||||||
button.pure-button(title="Execute one program step.", @click="step",
|
button.pure-button(title="Execute one program step.", @click="step",
|
||||||
|
|||||||
Reference in New Issue
Block a user