From 3fc1bcfc1f6d289d8445bbffdc21e22d4a8199d8 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Mon, 22 Jan 2024 21:51:23 +0530 Subject: [PATCH] changed from arr to arrayobjects GCodeList --- src/js/control-view.js | 8 +++++--- src/py/bbctrl/FileHandler.py | 1 - src/resources/config-template.json | 7 +++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/js/control-view.js b/src/js/control-view.js index d0c829d..3c1948a 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -206,7 +206,8 @@ module.exports = { const filesWithNoMacros=this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name == item)); console.log('filesWithNoMacros: ',filesWithNoMacros); console.log("this.config.GCodeList",this.config.GCodeList) - const unionSet = new Set([...filesWithNoMacros, ...this.config.GCodeList]); + const GCodeListArray=this.config.GCodeList.map(item=> item['gcode_file_name']) + const unionSet = new Set([...filesWithNoMacros, ...GCodeListArray]); const files = [...unionSet]; console.log("files: ",files); return files; @@ -375,10 +376,11 @@ module.exports = { return; } - const isAlreadyPresent = this.config.GCodeList.find((element) => element == file.name); + const isAlreadyPresent = this.config.GCodeList.find((element) => element['gcode_file_name'] == file.name); if(isAlreadyPresent == undefined){ console.log('new gcode file'); - this.config.GCodeList.push(file.name); + const GCode={gcode_file_name: file.name } + this.config.GCodeList.push(GCode); try { await api.put("config/save", this.config); this.$dispatch("update"); diff --git a/src/py/bbctrl/FileHandler.py b/src/py/bbctrl/FileHandler.py index 947feef..8639f1f 100644 --- a/src/py/bbctrl/FileHandler.py +++ b/src/py/bbctrl/FileHandler.py @@ -37,7 +37,6 @@ class FileHandler(bbctrl.APIHandler): self.uploadFile.write(data) def delete_ok(self, filename): - self.get_log('FileHandler').info('filename ' + filename) allFiles = self.get_ctrl().state.return_files() for file in allFiles: self.get_log('FileHandler').info('filename ' + file) diff --git a/src/resources/config-template.json b/src/resources/config-template.json index 44c4d27..ff86aa7 100644 --- a/src/resources/config-template.json +++ b/src/resources/config-template.json @@ -693,9 +693,12 @@ "GCodeList": { "type": "list", "index": "numeric", - "default": [ ], + "default": [], "template": { - "type": "text" + "gcode_file_time": { + "type": "int", + "default": 1705008395 + } } },