fixing big in macros name

This commit is contained in:
sanjayk03-dev
2024-01-11 23:05:01 +05:30
parent 556cb5a31e
commit 8c4f8dfadd
2 changed files with 23 additions and 20 deletions

View File

@@ -12,10 +12,13 @@ module.exports = {
tab: "1",
confirmReset: false,
confirmSave: false,
currentTab:undefined,
newGcode: ["", "", "", "", "", "", "", ""],
};
},
components: {
"axis-control": require("./axis-control"),
"path-viewer": require("./path-viewer"),
"gcode-viewer": require("./gcode-viewer"),
},
computed: {
@@ -35,7 +38,7 @@ module.exports = {
},
methods: {
updateNewGcode(event) {
this.newGcode[this.tab - 1] = event.target.value;
this.newGcode[this.currentTab] = event.target.value;
},
open: function () {
utils.clickFileInput("gcode-file-input");
@@ -77,23 +80,23 @@ module.exports = {
},
saveMacros: async function () {
var macrosName = document.getElementById(
`macros-name-${this.tab - 1}`
`macros-name-${this.currentTab}`
).value;
var macrosColor = document.getElementById(
`macros-color-${this.tab - 1}`
`macros-color-${this.currentTab}`
).value;
console.log(this.tab - 1);
console.log(this.currentTab);
console.log(macrosColor, macrosName);
this.config.macros[this.tab - 1].name = macrosName;
this.config.macros[this.currentTab].name = macrosName;
console.log(this.config.macros[this.tab-1]);
this.config.macros[this.tab - 1].color = macrosColor;
this.config.macros[this.tab - 1].gcode_file_name = this.state.selected;
this.config.macros[this.tab - 1].gcode_file_time =
this.config.macros[this.currentTab].color = macrosColor;
this.config.macros[this.currentTab].gcode_file_name = this.state.selected;
this.config.macros[this.currentTab].gcode_file_time =
this.state.selected_time;
console.log(this.config.macros);
this.cancelMacros(this.tab - 1);
this.cancelMacros(this.currentTab);
this.confirmSave = false;
try {
await api.put("config/save", this.config);
@@ -105,9 +108,9 @@ module.exports = {
}
},
cancelMacros: function () {
document.getElementById(`macros-name-${this.tab - 1}`).value = "";
document.getElementById(`macros-color-${this.tab - 1}`).value = "#ffffff";
document.getElementById(`gcodeSelect-${this.tab - 1}`).value = "default";
document.getElementById(`macros-name-${this.currentTab}`).value = "";
document.getElementById(`macros-color-${this.currentTab}`).value = "#ffffff";
document.getElementById(`gcodeSelect-${this.currentTab}`).value = "default";
this.$broadcast("gcode-clear");
},
resetConfig: async function () {

View File

@@ -77,7 +77,7 @@ script#macros-template(type="text/x-template")
.gcodeContainer
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=0;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=1;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=2;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=3;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=4;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=5;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=6;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",
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
textarea.new-gcode( v-if="state.selected=='default'",:value='newGcode[tab-1]' @input="updateNewGcode")
gcode-viewer(v-if="state.selected !== 'default'")
button.submit-macros(title="Save Macros",@click="confirmSave=true",
button.submit-macros(title="Save Macros",@click="currentTab=7;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",
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel