updating macros to auto refresh, sorting all gcodes

This commit is contained in:
sanjayk03-dev
2024-04-04 11:50:52 +05:30
parent 7cd2fff0c7
commit c420060e26
2 changed files with 8 additions and 5 deletions

View File

@@ -216,13 +216,13 @@ module.exports = {
if (this.state.folder == "Unorganized files") { if (this.state.folder == "Unorganized files") {
files = this.config.gcode_list.filter(item => item.type == "file" && this.state.files.includes(item.name)); files = this.config.gcode_list.filter(item => item.type == "file" && this.state.files.includes(item.name));
files = files.map(item => item.name); files = files.map(item => item.name);
return files; return files.sort();
} }
files = this.config.gcode_list files = this.config.gcode_list
.find(item => item.name == this.state.folder) .find(item => item.name == this.state.folder)
.files.filter(item => this.state.files.includes(item.file_name)) .files.filter(item => this.state.files.includes(item.file_name))
.map(item => item.file_name); .map(item => item.file_name);
return files; return files.sort();
}, },
gcode_folders: function () { gcode_folders: function () {
let folders = []; let folders = [];
@@ -231,7 +231,7 @@ module.exports = {
folders.push(item.name); folders.push(item.name);
} }
} }
return folders; return folders.sort();
}, },
}, },
@@ -463,7 +463,7 @@ module.exports = {
}; };
xhr.onerror = function () { xhr.onerror = function () {
console.error("Network error during file upload"); alert("Upload failed.");
}; };
xhr.upload.onprogress = function (event) { xhr.upload.onprogress = function (event) {

View File

@@ -47,7 +47,10 @@ module.exports = {
return this.tab > 8; return this.tab > 8;
}, },
macros_gcode_list: function () { macros_gcode_list: function () {
return this.config.macros_list.map(el => el.file_name).sort(); return this.config.macros_list
.filter(item => this.state.files.includes(item.file_name))
.map(item => item.file_name)
.sort();
}, },
macros_list: function () { macros_list: function () {
return this.config.macros.map(item => item.name); return this.config.macros.map(item => item.name);