From 06fadd1c3f104045b102b67eda99d4832adc8360 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Mon, 8 Apr 2024 22:30:56 +0530 Subject: [PATCH] alert when gcode not found --- src/js/control-view.js | 8 ++++++-- src/pug/templates/control-view.pug | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/js/control-view.js b/src/js/control-view.js index b0d569a..88c7e4f 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -49,6 +49,7 @@ module.exports = { showNoGcodeMessage: false, macrosLoading: false, show_gcodes: false, + GCodeNotFound: false, }; }, @@ -320,6 +321,11 @@ module.exports = { return; } + if (!this.state.files.includes(this.state.selected)) { + this.GCodeNotFound = true; + return; + } + this.last_file = file; this.last_file_time = file_time; @@ -617,7 +623,6 @@ module.exports = { } return true; }); - console.log(this.config.gcode_list); this.save_config(this.config); } } @@ -771,7 +776,6 @@ module.exports = { } try { this.load(); - console.log("selected", this.state); if (this.state.macros[id].alert == true) { this.macrosLoading = true; } else { diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 0dae333..88b1a4b 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -29,6 +29,14 @@ script#control-view-template(type="text/x-template") div(slot="footer") button.pure-button(@click="macrosLoading=false") Cancel button.pure-button.pure-button-primary(@click="start_pause") Run + + message(:show.sync="GCodeNotFound") + h3(slot="header") File not found + div(slot="body") + p It seems like the file you selected cannot be found. Try uploading again. + div(slot="footer") + button.pure-button.button-error(@click="GCodeNotFound=false") + | OK table(style="table-layout: fixed; width: 100%;") tr(style="height: fit-content;")