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

View File

@@ -47,7 +47,10 @@ module.exports = {
return this.tab > 8;
},
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 () {
return this.config.macros.map(item => item.name);