macros bug fix
This commit is contained in:
@@ -22,6 +22,7 @@ module.exports = {
|
|||||||
GCodeNotFound: false,
|
GCodeNotFound: false,
|
||||||
macrosName: "",
|
macrosName: "",
|
||||||
isChecked: false,
|
isChecked: false,
|
||||||
|
macroFoundName: "",
|
||||||
fileName: "default",
|
fileName: "default",
|
||||||
newGcode: "",
|
newGcode: "",
|
||||||
};
|
};
|
||||||
@@ -210,16 +211,17 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
save_macro: async function () {
|
save_macro: async function () {
|
||||||
if (this.tab == 0) {
|
if (this.tab == 0 || !this.config.macros[this.tab - 1]) {
|
||||||
this.clear_macro();
|
this.clear_macro();
|
||||||
|
this.confirmSave = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const macros = [...this.state.macros];
|
|
||||||
macros.splice(this.tab - 1, 1);
|
|
||||||
const macros_list = macros.map(item => item.name);
|
|
||||||
var macrosName = document.getElementById(`macros-name`).value;
|
var macrosName = document.getElementById(`macros-name`).value;
|
||||||
var macrosColor = document.getElementById("macros-color").value;
|
var macrosColor = document.getElementById("macros-color").value;
|
||||||
var macrosAlert = this.isChecked;
|
var macrosAlert = this.isChecked;
|
||||||
|
const macros = [...this.state.macros];
|
||||||
|
macros.splice(this.tab - 1, 1);
|
||||||
|
const macros_list = macros.map(item => item.name);
|
||||||
const formattedFilename = macrosName
|
const formattedFilename = macrosName
|
||||||
.replace(/\\/g, "_")
|
.replace(/\\/g, "_")
|
||||||
.replace(/\//g, "_")
|
.replace(/\//g, "_")
|
||||||
@@ -260,6 +262,7 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
if (macro_with_filename) {
|
if (macro_with_filename) {
|
||||||
this.deleteGCode = false;
|
this.deleteGCode = false;
|
||||||
|
this.macroFoundName = macro_with_filename.file_name;
|
||||||
this.macroFound = true;
|
this.macroFound = true;
|
||||||
} else {
|
} else {
|
||||||
this.delete_current();
|
this.delete_current();
|
||||||
@@ -403,7 +406,8 @@ module.exports = {
|
|||||||
this.clear_macro();
|
this.clear_macro();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.config.macros = this.state.macros.splice(this.tab - 1, 1);
|
this.config.macros = [...this.state.macros];
|
||||||
|
this.config.macros.splice(this.tab - 1, 1);
|
||||||
this.clear_macro();
|
this.clear_macro();
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
|
|||||||
@@ -290,8 +290,11 @@ span.unit
|
|||||||
max-width 95%
|
max-width 95%
|
||||||
|
|
||||||
.drop-down-container
|
.drop-down-container
|
||||||
margin 1rem
|
|
||||||
height 50px
|
height 50px
|
||||||
|
display flex
|
||||||
|
justify-content space-around
|
||||||
|
width 50%
|
||||||
|
align-items center
|
||||||
|
|
||||||
table
|
table
|
||||||
border-collapse collapse
|
border-collapse collapse
|
||||||
|
|||||||
Reference in New Issue
Block a user