From 20c4a3b39da7c8ecb14ae1e6843938576f54bbe2 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Tue, 2 Jan 2024 19:08:01 +0530 Subject: [PATCH] added flushing and printing config --- src/js/control-view.js | 2 +- src/js/macros.js | 15 +++++++++------ src/pug/templates/macros.pug | 14 ++++++++------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/js/control-view.js b/src/js/control-view.js index 082f88a..9ec186e 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -511,7 +511,7 @@ module.exports = { try{ this.load(); console.log("Loaded file"); - // this.start_pause(); + this.start_pause(); }catch(error){ console.warn("Error running program: ",error); } diff --git a/src/js/macros.js b/src/js/macros.js index ced63c5..1edeee7 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -100,7 +100,10 @@ module.exports = { alert("Restore failed"); } }, - printConfig: async function(){ + printConfig: function(){ + console.log(this.config); + }, + flushConfig: async function(){ this.config.macros=[ { name:"Macros 1", @@ -110,25 +113,25 @@ module.exports = { }, { name:"Macros 2", - color: "", + color: "#efefef", gcode_file_name: " ", gcode_file_time: 0 }, { name:"Macros 3", - color: "", + color: "#efefef", gcode_file_name: " ", gcode_file_time: 0 }, { name:"Macros 4", - color: "", + color: "#efefef", gcode_file_name: " ", gcode_file_time: 0 }, { name:"Macros 5", - color: "", + color: "#efefef", gcode_file_name: " ", gcode_file_time: 0 }, @@ -141,7 +144,7 @@ module.exports = { ] try { await api.put("config/save",this.config); - console.log("Successfully saved"); + console.log("Successfully flushed"); this.$dispatch("update"); } catch (error) { console.error("Restore Failed: ",error); diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index 916b600..0ff78ee 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -25,7 +25,7 @@ script#macros-template(type="text/x-template") p.title Enter Macros 1 Name .input-container input.input-color(type="color",id="macros-color-0",value="#ffffff") - input.input-name(type="text",id="macros-name-0") + input.input-name(type="text",maxlength='10',id="macros-name-0") p.title Select/Upload G-Code select(title="Select previously uploaded GCode programs.", v-model="state.selected", @change="load", :disabled="!is_ready", @@ -47,7 +47,7 @@ script#macros-template(type="text/x-template") p.title Enter Macros 2 Name .input-container input.input-color(type="color",id="macros-color-1",value="#ffffff") - input.input-name(type="text",id="macros-name-1") + input.input-name(type="text",maxlength='10',id="macros-name-1") p.title Select/Upload G-Code select(title="Select previously uploaded GCode programs.", v-model="state.selected", @change="load", :disabled="!is_ready", @@ -69,7 +69,7 @@ script#macros-template(type="text/x-template") p.title Enter Macros 3 Name .input-container input.input-color(type="color",id="macros-color-2",value="#ffffff") - input.input-name(type="text",id="macros-name-2") + input.input-name(type="text",maxlength='10',id="macros-name-2") p.title Select/Upload G-Code select(title="Select previously uploaded GCode programs.", v-model="state.selected", @change="load", :disabled="!is_ready", @@ -91,7 +91,7 @@ script#macros-template(type="text/x-template") p.title Enter Macros 4 Name .input-container input.input-color(type="color",id="macros-color-3",value="#ffffff") - input.input-name(type="text",id="macros-name-3") + input.input-name(type="text",maxlength='10',id="macros-name-3") p.title Select/Upload G-Code select(title="Select previously uploaded GCode programs.", v-model="state.selected", @change="load", :disabled="!is_ready", @@ -113,7 +113,7 @@ script#macros-template(type="text/x-template") p.title Enter Macros 5 Name .input-container input.input-color(type="color",id="macros-color-4",value="#ffffff") - input.input-name(type="text",id="macros-name-4") + input.input-name(type="text",maxlength='10',id="macros-name-4") p.title Select/Upload G-Code select(title="Select previously uploaded GCode programs.", v-model="state.selected", @change="load", :disabled="!is_ready", @@ -135,7 +135,7 @@ script#macros-template(type="text/x-template") p.title Enter Macros 6 Name .input-container input.input-color(type="color",id="macros-color-5",value="#ffffff") - input.input-name(type="text",id="macros-name-5") + input.input-name(type="text",maxlength='10',id="macros-name-5") p.title Select/Upload G-Code select(title="Select previously uploaded GCode programs.", v-model="state.selected", @change="load", :disabled="!is_ready", @@ -154,4 +154,6 @@ script#macros-template(type="text/x-template") button.pure-button(title="Print config.", @click="printConfig", style="height:50px;width:120px;font-weight:normal;padding-top:5px") print Config + button.pure-button(title="Print config.", @click="flushConfig", + style="height:50px;width:120px;font-weight:normal;padding-top:5px") Flush Config