From be1aa15b4a72016494586a843e0bd81458a166fc Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Tue, 9 Jan 2024 23:46:58 +0530 Subject: [PATCH] corrected version name, added alert box, trying defaults name --- package.json | 2 +- src/js/macros.js | 27 +++++++++++---------- src/pug/index.pug | 2 +- src/pug/templates/macros.pug | 34 +++++++++++++-------------- src/resources/config-template.json | 3 ++- src/resources/onefinity_defaults.json | 2 +- src/stylus/style.styl | 2 +- 7 files changed, 38 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index bf41cfd..0490aad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bbctrl", - "version": "1.4.0 Alpha 1", + "version": "1.4.0", "homepage": "https://onefinitycnc.com/", "repository": "https://github.com/OneFinityCNC/onefinity", "license": "GPL-3.0+", diff --git a/src/js/macros.js b/src/js/macros.js index ed46eb6..01c53cc 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -70,18 +70,21 @@ module.exports = { }, }); }, - saveMacros: async function (id) { - var macrosName = document.getElementById(`macros-name-${id}`).value; - var macrosColor = document.getElementById(`macros-color-${id}`).value; + saveMacros: async function () { + var macrosName = document.getElementById(`macros-name-${this.tab}`).value; + var macrosColor = document.getElementById( + `macros-color-${this.tab}` + ).value; console.log(this.tab); - this.config.macros[id].name = macrosName; - this.config.macros[id].color = macrosColor; - this.config.macros[id].gcode_file_name = this.state.selected; - this.config.macros[id].gcode_file_time = this.state.selected_time; + this.config.macros[this.tab].name = macrosName; + this.config.macros[this.tab].color = macrosColor; + this.config.macros[this.tab].gcode_file_name = this.state.selected; + this.config.macros[this.tab].gcode_file_time = this.state.selected_time; console.log(this.config.macros); - this.cancelMacros(id); + this.cancelMacros(this.tab); + this.confirmSave = false; try { await api.put("config/save", this.config); console.log("Successfully saved"); @@ -91,10 +94,10 @@ module.exports = { alert("Restore failed"); } }, - cancelMacros: function (id) { - document.getElementById(`macros-name-${id}`).value = ""; - document.getElementById(`macros-color-${id}`).value = "#ffffff"; - document.getElementById(`gcodeSelect-${id}`).value = "default"; + cancelMacros: function () { + document.getElementById(`macros-name-${this.tab}`).value = ""; + document.getElementById(`macros-color-${this.tab}`).value = "#ffffff"; + document.getElementById(`gcodeSelect-${this.tab}`).value = "default"; this.$broadcast("gcode-clear"); }, resetConfig: async function () { diff --git a/src/pug/index.pug b/src/pug/index.pug index 0ad1326..b43c25a 100644 --- a/src/pug/index.pug +++ b/src/pug/index.pug @@ -76,7 +76,7 @@ html(lang="en") .brand img(src="/images/onefinity_logo.png") .version - div Version: v{{config.full_version}} + div Version: v{{config.full_version}} Alpha 1 div IP Address: {{config.ip}} div WiFi: {{config.wifiName}} a.upgrade-link(v-if="show_upgrade()", href="#admin-general") diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index a6a6352..1102c9d 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -17,7 +17,7 @@ script#macros-template(type="text/x-template") div(slot="footer") button.pure-button(@click="confirmSave=false") Cancel - button.pure-button.pure-button-primary(@click="resetConfig") + button.pure-button.pure-button-primary(@click="saveMacros") | Confirm h1 Macros Configuration @@ -76,9 +76,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(0)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(0)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content2.tab-content @@ -104,9 +104,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(1)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(1)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content3.tab-content @@ -132,9 +132,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(2)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(2)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content4.tab-content @@ -160,9 +160,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(3)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(3)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content5.tab-content @@ -188,9 +188,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(4)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(4)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content6.tab-content @@ -216,9 +216,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(5)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(5)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content7.tab-content @@ -244,9 +244,9 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(6)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(6)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel section#content8.tab-content @@ -272,7 +272,7 @@ script#macros-template(type="text/x-template") accept=".nc,.ngc,.gcode,.gc") br gcode-viewer - button.submit-macros(title="Save Macros",@click="saveMacros(7)", + button.submit-macros(title="Save Macros",@click="confirmSave=true", style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save - button.submit-macros(title="Cancel Macros",@click="cancelMacros(7)", + button.submit-macros(title="Cancel Macros",@click="cancelMacros", style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel diff --git a/src/resources/config-template.json b/src/resources/config-template.json index 44e19d8..7f9d5bb 100644 --- a/src/resources/config-template.json +++ b/src/resources/config-template.json @@ -639,7 +639,8 @@ ], "template": { "name": { - "type": "text", + "type": "enum", + "values": ["FireLaser", "Home", "Perk", "Spindle Warmup", "Spindle ON", "Spindle OFF","Vacuum ON","Vacuum OFF"], "default": " " }, "color": { diff --git a/src/resources/onefinity_defaults.json b/src/resources/onefinity_defaults.json index ef67c8e..6a5dcf5 100644 --- a/src/resources/onefinity_defaults.json +++ b/src/resources/onefinity_defaults.json @@ -1,5 +1,5 @@ { - "version": "1.4.0 Alpha 1", + "version": "1.4.0", "settings": { "junction-accel": 200000, "max-deviation": 0.05, diff --git a/src/stylus/style.styl b/src/stylus/style.styl index c4b4afa..f448caf 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -650,7 +650,7 @@ span.unit .tabs margin-top 5px - width 105% + width 51.8rem .submit-macros height 50px