changed str to int for tab
This commit is contained in:
@@ -9,10 +9,10 @@ module.exports = {
|
|||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
tab: "1",
|
tab: 1,
|
||||||
confirmReset: false,
|
confirmReset: false,
|
||||||
confirmSave: false,
|
confirmSave: false,
|
||||||
currentTab:undefined,
|
currentTab:1,
|
||||||
newGcode: ["", "", "", "", "", "", "", ""],
|
newGcode: ["", "", "", "", "", "", "", ""],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -38,17 +38,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateNewGcode(event) {
|
updateNewGcode(event) {
|
||||||
this.newGcode[this.currentTab] = event.target.value;
|
this.newGcode[this.tab] = event.target.value;
|
||||||
},
|
},
|
||||||
open: function () {
|
open: function () {
|
||||||
utils.clickFileInput("gcode-file-input");
|
utils.clickFileInput("gcode-file-input");
|
||||||
},
|
},
|
||||||
load: function () {
|
load: function () {
|
||||||
const file_time = this.state.selected_time;
|
const file_time = this.state.selected_time;
|
||||||
|
console.log(this.state.selected_time, "\n ",file_time);
|
||||||
const file = this.state.selected;
|
const file = this.state.selected;
|
||||||
|
console.log(this.state.selected);
|
||||||
|
console.log(this.state.line);
|
||||||
this.$broadcast("gcode-load", file);
|
this.$broadcast("gcode-load", file);
|
||||||
this.$broadcast("gcode-line", this.state.line);
|
this.$broadcast("gcode-line", this.state.line);
|
||||||
this.newGCode[this.currentTab] = "";
|
this.newGcode[this.tab] = "";
|
||||||
},
|
},
|
||||||
upload: function (e) {
|
upload: function (e) {
|
||||||
const files = e.target.files || e.dataTransfer.files;
|
const files = e.target.files || e.dataTransfer.files;
|
||||||
@@ -78,24 +81,25 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveMacros: async function () {
|
saveMacros: async function () {
|
||||||
|
console.log(this.state.selected);
|
||||||
var macrosName = document.getElementById(
|
var macrosName = document.getElementById(
|
||||||
`macros-name-${this.currentTab}`
|
`macros-name-${this.tab}`
|
||||||
).value;
|
).value;
|
||||||
var macrosColor = document.getElementById(
|
var macrosColor = document.getElementById(
|
||||||
`macros-color-${this.currentTab}`
|
`macros-color-${this.tab}`
|
||||||
).value;
|
).value;
|
||||||
|
|
||||||
console.log(this.currentTab);
|
console.log(this.tab);
|
||||||
console.log(macrosColor, macrosName);
|
console.log(macrosColor, macrosName);
|
||||||
|
|
||||||
this.config.macros[this.currentTab].name = macrosName;
|
this.config.macros[this.tab].name = macrosName;
|
||||||
console.log(this.config.macros[this.tab-1]);
|
console.log(this.config.macros[this.tab-1]);
|
||||||
this.config.macros[this.currentTab].color = macrosColor;
|
this.config.macros[this.tab].color = macrosColor;
|
||||||
this.config.macros[this.currentTab].gcode_file_name = this.state.selected;
|
this.config.macros[this.tab].gcode_file_name = this.state.selected;
|
||||||
this.config.macros[this.currentTab].gcode_file_time =
|
this.config.macros[this.tab].gcode_file_time =
|
||||||
this.state.selected_time;
|
this.state.selected_time;
|
||||||
console.log(this.config.macros);
|
console.log(this.config.macros);
|
||||||
this.cancelMacros(this.currentTab);
|
this.cancelMacros(this.tab);
|
||||||
this.confirmSave = false;
|
this.confirmSave = false;
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
@@ -107,9 +111,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancelMacros: function () {
|
cancelMacros: function () {
|
||||||
document.getElementById(`macros-name-${this.currentTab}`).value = "";
|
document.getElementById(`macros-name-${this.tab}`).value = "";
|
||||||
document.getElementById(`macros-color-${this.currentTab}`).value = "#ffffff";
|
document.getElementById(`macros-color-${this.tab}`).value = "#ffffff";
|
||||||
document.getElementById(`gcodeSelect-${this.currentTab}`).value = "default";
|
document.getElementById(`gcodeSelect-${this.tab}`).value = "default";
|
||||||
this.$broadcast("gcode-clear");
|
this.$broadcast("gcode-clear");
|
||||||
},
|
},
|
||||||
resetConfig: async function () {
|
resetConfig: async function () {
|
||||||
|
|||||||
@@ -28,28 +28,28 @@ script#macros-template(type="text/x-template")
|
|||||||
u Note:
|
u Note:
|
||||||
| Reset the macros to default macros recommended by Onefinity CNC.
|
| Reset the macros to default macros recommended by Onefinity CNC.
|
||||||
.tabs
|
.tabs
|
||||||
input#tab1(type="radio", name="tabs",checked="" @click="tab = '1'")
|
input#tab1(type="radio", name="tabs",checked="" @click="tab = 1")
|
||||||
label(for="tab1",style="height:50px;width:100px") Macros 1
|
label(for="tab1",style="height:50px;width:100px") Macros 1
|
||||||
|
|
||||||
input#tab2(type="radio", name="tabs", @click="tab = '2'")
|
input#tab2(type="radio", name="tabs", @click="tab = 2")
|
||||||
label(for="tab2",style="height:50px;width:100px") Macros 2
|
label(for="tab2",style="height:50px;width:100px") Macros 2
|
||||||
|
|
||||||
input#tab3(type="radio", name="tabs", @click="tab = '3'")
|
input#tab3(type="radio", name="tabs", @click="tab = 3")
|
||||||
label(for="tab3",style="height:50px;width:100px") Macros 3
|
label(for="tab3",style="height:50px;width:100px") Macros 3
|
||||||
|
|
||||||
input#tab4(type="radio", name="tabs", @click="tab = '4'")
|
input#tab4(type="radio", name="tabs", @click="tab = 4")
|
||||||
label(for="tab4",style="height:50px;width:100px") Macros 4
|
label(for="tab4",style="height:50px;width:100px") Macros 4
|
||||||
|
|
||||||
input#tab5(type="radio", name="tabs", @click="tab = '5'")
|
input#tab5(type="radio", name="tabs", @click="tab = 5")
|
||||||
label(for="tab5",style="height:50px;width:100px") Macros 5
|
label(for="tab5",style="height:50px;width:100px") Macros 5
|
||||||
|
|
||||||
input#tab6(type="radio", name="tabs", @click="tab = '6'")
|
input#tab6(type="radio", name="tabs", @click="tab = 6")
|
||||||
label(for="tab6",style="height:50px;width:100px") Macros 6
|
label(for="tab6",style="height:50px;width:100px") Macros 6
|
||||||
|
|
||||||
input#tab7(type="radio", name="tabs", @click="tab = '7'")
|
input#tab7(type="radio", name="tabs", @click="tab = 7")
|
||||||
label(for="tab7",style="height:50px;width:100px") Macros 7
|
label(for="tab7",style="height:50px;width:100px") Macros 7
|
||||||
|
|
||||||
input#tab8(type="radio", name="tabs", @click="tab = '8'")
|
input#tab8(type="radio", name="tabs", @click="tab = 8")
|
||||||
label(for="tab8",style="height:50px;width:100px") Macros 8
|
label(for="tab8",style="height:50px;width:100px") Macros 8
|
||||||
|
|
||||||
section#content1.tab-content
|
section#content1.tab-content
|
||||||
@@ -77,7 +77,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=0; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -107,7 +107,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=1; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -137,7 +137,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=2; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -167,7 +167,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=3; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -197,7 +197,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=4; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -227,7 +227,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=5; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -257,7 +257,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=6; confirmSave=true}",
|
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",
|
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
|
||||||
@@ -287,7 +287,7 @@ script#macros-template(type="text/x-template")
|
|||||||
.gcodeContainer
|
.gcodeContainer
|
||||||
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
|
||||||
gcode-viewer(v-if="state.selected !== 'default'")
|
gcode-viewer(v-if="state.selected !== 'default'")
|
||||||
button.submit-macros(title="Save Macros",@click="()=>{currentTab=7; confirmSave=true}",
|
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",
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user