fixing the list

This commit is contained in:
sanjayk03-dev
2024-01-22 10:20:48 +05:30
parent 96657f3cb1
commit ddbbd56b15
2 changed files with 14 additions and 4 deletions

View File

@@ -42,8 +42,7 @@ module.exports = {
tab: "auto", tab: "auto",
ask_home: true, ask_home: true,
showGcodeMessage: false, showGcodeMessage: false,
gcode_files:this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name === item.gcode_file_name)) gcode_files:this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name === item))
.map(item => item.gcode_file_name)
}; };
}, },

View File

@@ -85,14 +85,16 @@ module.exports = {
return; return;
} }
SvelteComponents.showDialog("Upload", { SvelteComponents.showDialog("Upload", {
file, file,
onComplete: () => { onComplete: () => {
this.last_file_time = undefined; // Force reload this.last_file_time = undefined; // Force reload
}, },
}); });
}, },
uploadGCode: function (filename, file) { uploadGCode: async function (filename, file) {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.onload = function () { xhr.onload = function () {
@@ -116,6 +118,15 @@ module.exports = {
xhr.open("PUT", `/api/file/${encodeURIComponent(filename)}`, true); xhr.open("PUT", `/api/file/${encodeURIComponent(filename)}`, true);
xhr.send(file); xhr.send(file);
// this.config.macrosList.push()
// try {
// await api.put("config/save", this.config);
// this.$dispatch("update");
// } catch (error) {
// console.error("Restore Failed: ", error);
// alert("Restore failed");
// }
}, },
saveMacros: async function () { saveMacros: async function () {
var macrosName = document.getElementById( var macrosName = document.getElementById(
@@ -130,7 +141,7 @@ module.exports = {
if (this.state.selected == "default") { if (this.state.selected == "default") {
var file = this.newGcode[this.tab - 1]; var file = this.newGcode[this.tab - 1];
this.uploadGCode(macrosName, file); this.uploadGCode(macrosName, file,);
} }
this.config.macros[this.tab - 1].name = macrosName; this.config.macros[this.tab - 1].name = macrosName;