fixed saving macros , added style to textarea

This commit is contained in:
sanjayk03-dev
2024-01-10 02:05:36 +05:30
parent 72a565007d
commit 1b98c6593b
2 changed files with 15 additions and 18 deletions

View File

@@ -35,9 +35,7 @@ module.exports = {
}, },
methods: { methods: {
updateNewGcode(event) { updateNewGcode(event) {
console.log(event);
this.newGcode = event.target.value; this.newGcode = event.target.value;
console.log(this.newGcode);
}, },
open: function () { open: function () {
utils.clickFileInput("gcode-file-input"); utils.clickFileInput("gcode-file-input");
@@ -51,16 +49,12 @@ module.exports = {
}, },
upload: function (e) { upload: function (e) {
const files = e.target.files || e.dataTransfer.files; const files = e.target.files || e.dataTransfer.files;
console.log(e);
console.log(files);
if (!files.length) { if (!files.length) {
return; return;
} }
const file = files[0]; const file = files[0];
console.log(file);
const extension = file.name.split(".").pop(); const extension = file.name.split(".").pop();
console.log(extension);
switch (extension.toLowerCase()) { switch (extension.toLowerCase()) {
case "nc": case "nc":
case "ngc": case "ngc":
@@ -82,19 +76,19 @@ module.exports = {
}); });
}, },
saveMacros: async function () { saveMacros: async function () {
var macrosName = document.getElementById(`macros-name-${this.tab}`).value; var macrosName = document.getElementById(`macros-name-${this.tab-1}`).value;
var macrosColor = document.getElementById( var macrosColor = document.getElementById(
`macros-color-${this.tab}` `macros-color-${this.tab-1}`
).value; ).value;
console.log(this.tab); console.log(this.tab-1);
this.config.macros[this.tab].name = macrosName; this.config.macros[this.tab-1].name = macrosName;
this.config.macros[this.tab].color = macrosColor; this.config.macros[this.tab-1].color = macrosColor;
this.config.macros[this.tab].gcode_file_name = this.state.selected; this.config.macros[this.tab-1].gcode_file_name = this.state.selected;
this.config.macros[this.tab].gcode_file_time = this.state.selected_time; this.config.macros[this.tab-1].gcode_file_time = this.state.selected_time;
console.log(this.config.macros); console.log(this.config.macros);
this.cancelMacros(this.tab); this.cancelMacros(this.tab-1);
this.confirmSave = false; this.confirmSave = false;
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);
@@ -106,9 +100,9 @@ module.exports = {
} }
}, },
cancelMacros: function () { cancelMacros: function () {
document.getElementById(`macros-name-${this.tab}`).value = ""; document.getElementById(`macros-name-${this.tab-1}`).value = "";
document.getElementById(`macros-color-${this.tab}`).value = "#ffffff"; document.getElementById(`macros-color-${this.tab-1}`).value = "#ffffff";
document.getElementById(`gcodeSelect-${this.tab}`).value = "default"; document.getElementById(`gcodeSelect-${this.tab-1}`).value = "default";
this.$broadcast("gcode-clear"); this.$broadcast("gcode-clear");
}, },
resetConfig: async function () { resetConfig: async function () {

View File

@@ -643,7 +643,10 @@ span.unit
border-style solid border-style solid
.new-gcode .new-gcode
display flex height 13rem
width 23rem
border-radius 10px
padding 20px
.warning-box .warning-box
display flex display flex