reset mAcros list

This commit is contained in:
sanjayk03-dev
2024-01-23 14:33:51 +05:30
parent aa48701bcc
commit abfed3f596
2 changed files with 46 additions and 1 deletions

View File

@@ -125,7 +125,7 @@ module.exports = {
gcode_file_name: file.name,
gcode_file_time: this.state.selected_time,
};
if (!this.config.macrosList.some(item => item["gcode_file_name"] == file.name)) {
if (!this.config.macrosList.some(item => item.gcode_file_name == file.name)) {
console.log("new gcode file");
this.config.macrosList.push(gcodeData);
try {
@@ -330,5 +330,48 @@ module.exports = {
printConfig: function () {
console.log(this.config);
},
resetMacrosList: async function (){
this.config.macrosList=[
{
"gcode_file_name": "FireLaser.ngc",
"gcode_file_time": 1705008250.2333415
},
{
"gcode_file_name": "GoHomeXYZ.ngc",
"gcode_file_time": 1705008321.710827
},
{
"gcode_file_name": "ParkRearRightWW.ngc",
"gcode_file_time": 1705008360.977644
},
{
"gcode_file_name": "SpindleWarmUp1Minute.ngc",
"gcode_file_time": 1705008372.967075
},
{
"gcode_file_name": "TurnOnSpindle.ngc",
"gcode_file_time": 1705008405.5059154
},
{
"gcode_file_name": "TurnOffSpindleAndLaser.ngc",
"gcode_file_time": 1705008384.6566093
},
{
"gcode_file_name": "VacOn.ngc",
"gcode_file_time": 1705008413.7756715
},
{
"gcode_file_name": "TurnOffVac.ngc",
"gcode_file_time": 1705008395.476232
}
]
try {
await api.put("config/save", this.config);
this.$dispatch("update");
} catch (error) {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
},
},
};

View File

@@ -332,3 +332,5 @@ script#macros-template(type="text/x-template")
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Print State
button.submit-macros(title="Cancel Macros",@click="printConfig",
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Print Config
button.submit-macros(title="Cancel Macros",@click="resetMacrosList",
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Reset Macros List