From 04eeee5eba76d3bb9f19505a928f2074970d195f Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Mon, 22 Jan 2024 00:12:47 +0530 Subject: [PATCH] logging repsonse text --- src/js/macros.js | 20 ++++++++++++++------ src/py/bbctrl/State.py | 8 ++++---- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index 4ceffcb..4afc414 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -39,12 +39,17 @@ module.exports = { }, load: async function () { const file = this.state.selected; - const response = await fetch(`/api/file/${file}`, { cache: "no-cache" }); - const text = await response.text(); - if (text.length > 20e6) { - this.newGcode[this.tab - 1] = "File is large - gcode view disabled"; - } else { - this.newGcode[this.tab - 1] = text; + if(this.state.selected!='default'){ + const response = await fetch(`/api/file/${file}`, { cache: "no-cache" }); + const text = await response.text(); + console.log(text); + if (text.length > 20e6) { + this.newGcode[this.tab - 1] = "File is large - gcode view disabled"; + } else { + this.newGcode[this.tab - 1] = text; + } + }else{ + this.newGcode=''; } }, upload: function (e) { @@ -197,4 +202,7 @@ module.exports = { } }, }, + printState: function (){ + console.log(this.state); + } }; diff --git a/src/py/bbctrl/State.py b/src/py/bbctrl/State.py index e9cd638..0b4753b 100644 --- a/src/py/bbctrl/State.py +++ b/src/py/bbctrl/State.py @@ -146,10 +146,10 @@ class State(object): files.append(filename) files.sort() self.set('files', files) - self.log.info('===================') - for i in files: - self.log.info(i) - self.log.info('===================') + self.log.info('===================') + for i in files: + self.log.info(i) + self.log.info('===================') self.select_file(filename)