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);
},
getMacrosColor: function () {
return this.config.macros[this.tab - 1]['color'];
return this.config.macros[this.tab - 1]["color"];
},
getMacrosName: function () {
return this.config.macros[this.tab - 1]['name'];
return this.config.macros[this.tab - 1]["name"];
},
},
methods: {
@@ -179,9 +179,8 @@ module.exports = {
gcode_file_time: this.state.selected_time,
};
if (this.config.macrosList.some(item => item.gcode_file_name !== filename)) {
console.log('new item');
console.log("new item");
this.config.macrosList.push(gcodeData);
}
try {
await api.put("config/save", this.config);
@@ -190,6 +189,7 @@ module.exports = {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
}
},
saveMacros: async function () {
var macrosName = document.getElementById(`macros-name-${this.tab - 1}`).value;
@@ -225,7 +225,7 @@ module.exports = {
this.$set("newGcode[this.tab-1]", "");
} else {
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]}`);
this.$set("newGcode[this.tab-1]", "");
this.config.macrosList = this.config.macrosList.filter(
@@ -238,7 +238,7 @@ module.exports = {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
}else{
} else {
alert("You cannot delete GCode of Default Macros");
}
}
@@ -330,41 +330,41 @@ module.exports = {
printConfig: function () {
console.log(this.config);
},
resetMacrosList: async function (){
this.config.macrosList=[
resetMacrosList: async function () {
this.config.macrosList = [
{
"gcode_file_name": "FireLaser.ngc",
"gcode_file_time": 1705008250.2333415
gcode_file_name: "FireLaser.ngc",
gcode_file_time: 1705008250.2333415,
},
{
"gcode_file_name": "GoHomeXYZ.ngc",
"gcode_file_time": 1705008321.710827
gcode_file_name: "GoHomeXYZ.ngc",
gcode_file_time: 1705008321.710827,
},
{
"gcode_file_name": "ParkRearRightWW.ngc",
"gcode_file_time": 1705008360.977644
gcode_file_name: "ParkRearRightWW.ngc",
gcode_file_time: 1705008360.977644,
},
{
"gcode_file_name": "SpindleWarmUp1Minute.ngc",
"gcode_file_time": 1705008372.967075
gcode_file_name: "SpindleWarmUp1Minute.ngc",
gcode_file_time: 1705008372.967075,
},
{
"gcode_file_name": "TurnOnSpindle.ngc",
"gcode_file_time": 1705008405.5059154
gcode_file_name: "TurnOnSpindle.ngc",
gcode_file_time: 1705008405.5059154,
},
{
"gcode_file_name": "TurnOffSpindleAndLaser.ngc",
"gcode_file_time": 1705008384.6566093
gcode_file_name: "TurnOffSpindleAndLaser.ngc",
gcode_file_time: 1705008384.6566093,
},
{
"gcode_file_name": "VacOn.ngc",
"gcode_file_time": 1705008413.7756715
gcode_file_name: "VacOn.ngc",
gcode_file_time: 1705008413.7756715,
},
{
"gcode_file_name": "TurnOffVac.ngc",
"gcode_file_time": 1705008395.476232
}
]
gcode_file_name: "TurnOffVac.ngc",
gcode_file_time: 1705008395.476232,
},
];
try {
await api.put("config/save", this.config);
this.$dispatch("update");