diff --git a/src/js/macros.js b/src/js/macros.js index 27bab2d..2301095 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -23,6 +23,7 @@ module.exports = { macrosName: "", isChecked: false, macroFoundName: "", + macroFoundGcode: "", fileName: "default", newGcode: "", }; @@ -124,6 +125,8 @@ module.exports = { removeFromList: async function () { this.config.macros_list = [...this.state.macros_list]; this.config.macros_list = this.config.macros_list.filter(item => item.file_name != this.fileName); + this.config.macros = [...this.state.macros]; + this.config.macros.filter(item => item.file_name == this.fileName).forEach(item => (item.file_name = "default")); try { await api.put("config/save", this.config); this.$dispatch("update"); @@ -267,7 +270,8 @@ module.exports = { ); if (macro_with_filename) { this.deleteGCode = false; - this.macroFoundName = macro_with_filename.file_name; + this.macroFoundName = macro_with_filename.name; + this.macroFoundGcode = macro_with_filename.file_name; this.macroFound = true; } else { this.delete_current(); @@ -280,6 +284,8 @@ module.exports = { ); if (macro_with_filename.length != 0) { this.macroFound = false; + this.macroFoundName = ""; + this.macroFoundGcode = ""; macro_with_filename.forEach(item => (item.file_name = "default")); } if (filename == "default") { diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index ba1b0e0..320bfbf 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -13,9 +13,11 @@ script#macros-template(type="text/x-template") h3(slot="header") Alert div(slot="body") p - | The file is currently being used by a macro + | The file + strong {{macroFoundGcode}} + | is currently being used by a macro strong {{macroFoundName}} - | . You need to re-select a file for the macro. + | . You need to re-select a file for the macro. div(slot="footer") button.pure-button(@click="macroFound = false") Cancel button.pure-button.button-error(@click="delete_current")