moved config

This commit is contained in:
sanjayk03-dev
2024-01-23 16:17:38 +05:30
parent 3c7cde0615
commit 49d15e3c54

View File

@@ -69,10 +69,10 @@ module.exports = {
return this.config.macrosList.map(el => el.gcode_file_name); return this.config.macrosList.map(el => el.gcode_file_name);
}, },
getMacrosColor: function () { getMacrosColor: function () {
return this.config.macros[this.tab - 1]['color']; return this.config.macros[this.tab - 1]["color"];
}, },
getMacrosName: function () { getMacrosName: function () {
return this.config.macros[this.tab - 1]['name']; return this.config.macros[this.tab - 1]["name"];
}, },
}, },
methods: { methods: {
@@ -179,9 +179,8 @@ module.exports = {
gcode_file_time: this.state.selected_time, gcode_file_time: this.state.selected_time,
}; };
if (this.config.macrosList.some(item => item.gcode_file_name !== filename)) { if (this.config.macrosList.some(item => item.gcode_file_name !== filename)) {
console.log('new item'); console.log("new item");
this.config.macrosList.push(gcodeData); this.config.macrosList.push(gcodeData);
}
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);
@@ -190,6 +189,7 @@ module.exports = {
console.error("Restore Failed: ", error); console.error("Restore Failed: ", error);
alert("Restore failed"); alert("Restore failed");
} }
}
}, },
saveMacros: async function () { saveMacros: async function () {
var macrosName = document.getElementById(`macros-name-${this.tab - 1}`).value; var macrosName = document.getElementById(`macros-name-${this.tab - 1}`).value;
@@ -225,7 +225,7 @@ module.exports = {
this.$set("newGcode[this.tab-1]", ""); this.$set("newGcode[this.tab-1]", "");
} else { } else {
if (!this.isPresent({ gcode_file_name: this.selectedValues[this.tab - 1] })) { if (!this.isPresent({ gcode_file_name: this.selectedValues[this.tab - 1] })) {
console.log('this is not default macros'); console.log("this is not default macros");
api.delete(`file/${this.selectedValues[this.tab - 1]}`); api.delete(`file/${this.selectedValues[this.tab - 1]}`);
this.$set("newGcode[this.tab-1]", ""); this.$set("newGcode[this.tab-1]", "");
this.config.macrosList = this.config.macrosList.filter( this.config.macrosList = this.config.macrosList.filter(
@@ -333,38 +333,38 @@ module.exports = {
resetMacrosList: async function () { resetMacrosList: async function () {
this.config.macrosList = [ this.config.macrosList = [
{ {
"gcode_file_name": "FireLaser.ngc", gcode_file_name: "FireLaser.ngc",
"gcode_file_time": 1705008250.2333415 gcode_file_time: 1705008250.2333415,
}, },
{ {
"gcode_file_name": "GoHomeXYZ.ngc", gcode_file_name: "GoHomeXYZ.ngc",
"gcode_file_time": 1705008321.710827 gcode_file_time: 1705008321.710827,
}, },
{ {
"gcode_file_name": "ParkRearRightWW.ngc", gcode_file_name: "ParkRearRightWW.ngc",
"gcode_file_time": 1705008360.977644 gcode_file_time: 1705008360.977644,
}, },
{ {
"gcode_file_name": "SpindleWarmUp1Minute.ngc", gcode_file_name: "SpindleWarmUp1Minute.ngc",
"gcode_file_time": 1705008372.967075 gcode_file_time: 1705008372.967075,
}, },
{ {
"gcode_file_name": "TurnOnSpindle.ngc", gcode_file_name: "TurnOnSpindle.ngc",
"gcode_file_time": 1705008405.5059154 gcode_file_time: 1705008405.5059154,
}, },
{ {
"gcode_file_name": "TurnOffSpindleAndLaser.ngc", gcode_file_name: "TurnOffSpindleAndLaser.ngc",
"gcode_file_time": 1705008384.6566093 gcode_file_time: 1705008384.6566093,
}, },
{ {
"gcode_file_name": "VacOn.ngc", gcode_file_name: "VacOn.ngc",
"gcode_file_time": 1705008413.7756715 gcode_file_time: 1705008413.7756715,
}, },
{ {
"gcode_file_name": "TurnOffVac.ngc", gcode_file_name: "TurnOffVac.ngc",
"gcode_file_time": 1705008395.476232 gcode_file_time: 1705008395.476232,
} },
] ];
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);
this.$dispatch("update"); this.$dispatch("update");