dynamic macros count
This commit is contained in:
@@ -209,7 +209,7 @@ module.exports = {
|
||||
console.log("this.config.gcodeList", this.config.gcodeList);
|
||||
const gcodelist = this.config.gcodeList.map(item => item.file_name);
|
||||
const unionSet = new Set([...filesWithNoMacros, ...gcodelist]);
|
||||
const files = [...unionSet];
|
||||
const files = [...unionSet].sort();
|
||||
console.log("final files: ", files);
|
||||
return files;
|
||||
},
|
||||
|
||||
@@ -298,5 +298,21 @@ module.exports = {
|
||||
alert("Restore failed");
|
||||
}
|
||||
},
|
||||
addNewMacros: async function () {
|
||||
const length = this.config.macros.length;
|
||||
const newMacros = {
|
||||
name: `Macros ${length + 1}`,
|
||||
color: "#dedede",
|
||||
file_name: "",
|
||||
};
|
||||
this.config.macros.push(newMacros);
|
||||
try {
|
||||
await api.put("config/save", this.config);
|
||||
this.$dispatch("update");
|
||||
} catch (error) {
|
||||
console.error("Restore Failed: ", error);
|
||||
alert("Restore failed");
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user