corrected version name, added alert box, trying defaults name

This commit is contained in:
sanjayk03-dev
2024-01-09 23:46:58 +05:30
parent cffbcb524f
commit be1aa15b4a
7 changed files with 38 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "bbctrl", "name": "bbctrl",
"version": "1.4.0 Alpha 1", "version": "1.4.0",
"homepage": "https://onefinitycnc.com/", "homepage": "https://onefinitycnc.com/",
"repository": "https://github.com/OneFinityCNC/onefinity", "repository": "https://github.com/OneFinityCNC/onefinity",
"license": "GPL-3.0+", "license": "GPL-3.0+",

View File

@@ -70,18 +70,21 @@ module.exports = {
}, },
}); });
}, },
saveMacros: async function (id) { saveMacros: async function () {
var macrosName = document.getElementById(`macros-name-${id}`).value; var macrosName = document.getElementById(`macros-name-${this.tab}`).value;
var macrosColor = document.getElementById(`macros-color-${id}`).value; var macrosColor = document.getElementById(
`macros-color-${this.tab}`
).value;
console.log(this.tab); console.log(this.tab);
this.config.macros[id].name = macrosName; this.config.macros[this.tab].name = macrosName;
this.config.macros[id].color = macrosColor; this.config.macros[this.tab].color = macrosColor;
this.config.macros[id].gcode_file_name = this.state.selected; this.config.macros[this.tab].gcode_file_name = this.state.selected;
this.config.macros[id].gcode_file_time = this.state.selected_time; this.config.macros[this.tab].gcode_file_time = this.state.selected_time;
console.log(this.config.macros); console.log(this.config.macros);
this.cancelMacros(id); this.cancelMacros(this.tab);
this.confirmSave = false;
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);
console.log("Successfully saved"); console.log("Successfully saved");
@@ -91,10 +94,10 @@ module.exports = {
alert("Restore failed"); alert("Restore failed");
} }
}, },
cancelMacros: function (id) { cancelMacros: function () {
document.getElementById(`macros-name-${id}`).value = ""; document.getElementById(`macros-name-${this.tab}`).value = "";
document.getElementById(`macros-color-${id}`).value = "#ffffff"; document.getElementById(`macros-color-${this.tab}`).value = "#ffffff";
document.getElementById(`gcodeSelect-${id}`).value = "default"; document.getElementById(`gcodeSelect-${this.tab}`).value = "default";
this.$broadcast("gcode-clear"); this.$broadcast("gcode-clear");
}, },
resetConfig: async function () { resetConfig: async function () {

View File

@@ -76,7 +76,7 @@ html(lang="en")
.brand .brand
img(src="/images/onefinity_logo.png") img(src="/images/onefinity_logo.png")
.version .version
div Version: v{{config.full_version}} div Version: v{{config.full_version}} Alpha 1
div IP Address: {{config.ip}} div IP Address: {{config.ip}}
div WiFi: {{config.wifiName}} div WiFi: {{config.wifiName}}
a.upgrade-link(v-if="show_upgrade()", href="#admin-general") a.upgrade-link(v-if="show_upgrade()", href="#admin-general")

View File

@@ -17,7 +17,7 @@ script#macros-template(type="text/x-template")
div(slot="footer") div(slot="footer")
button.pure-button(@click="confirmSave=false") Cancel button.pure-button(@click="confirmSave=false") Cancel
button.pure-button.pure-button-primary(@click="resetConfig") button.pure-button.pure-button-primary(@click="saveMacros")
| Confirm | Confirm
h1 Macros Configuration h1 Macros Configuration
@@ -76,9 +76,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content2.tab-content
@@ -104,9 +104,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content3.tab-content
@@ -132,9 +132,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content4.tab-content
@@ -160,9 +160,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content5.tab-content
@@ -188,9 +188,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content6.tab-content
@@ -216,9 +216,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content7.tab-content
@@ -244,9 +244,9 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 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 section#content8.tab-content
@@ -272,7 +272,7 @@ script#macros-template(type="text/x-template")
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
br br
gcode-viewer 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 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 style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel

View File

@@ -639,7 +639,8 @@
], ],
"template": { "template": {
"name": { "name": {
"type": "text", "type": "enum",
"values": ["FireLaser", "Home", "Perk", "Spindle Warmup", "Spindle ON", "Spindle OFF","Vacuum ON","Vacuum OFF"],
"default": " " "default": " "
}, },
"color": { "color": {

View File

@@ -1,5 +1,5 @@
{ {
"version": "1.4.0 Alpha 1", "version": "1.4.0",
"settings": { "settings": {
"junction-accel": 200000, "junction-accel": 200000,
"max-deviation": 0.05, "max-deviation": 0.05,

View File

@@ -650,7 +650,7 @@ span.unit
.tabs .tabs
margin-top 5px margin-top 5px
width 105% width 51.8rem
.submit-macros .submit-macros
height 50px height 50px