From 18b53388d67ab7a962187898d390a0dafa9ee153 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Mon, 22 Jan 2024 22:42:35 +0530 Subject: [PATCH] back to config.py --- src/js/control-view.js | 8 +++----- src/py/bbctrl/Config.py | 2 ++ src/resources/config-template.json | 12 ------------ 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/js/control-view.js b/src/js/control-view.js index 3c1948a..d0c829d 100644 --- a/src/js/control-view.js +++ b/src/js/control-view.js @@ -206,8 +206,7 @@ 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 GCodeListArray=this.config.GCodeList.map(item=> item['gcode_file_name']) - const unionSet = new Set([...filesWithNoMacros, ...GCodeListArray]); + const unionSet = new Set([...filesWithNoMacros, ...this.config.GCodeList]); const files = [...unionSet]; console.log("files: ",files); return files; @@ -376,11 +375,10 @@ module.exports = { return; } - const isAlreadyPresent = this.config.GCodeList.find((element) => element['gcode_file_name'] == file.name); + const isAlreadyPresent = this.config.GCodeList.find((element) => element == file.name); if(isAlreadyPresent == undefined){ console.log('new gcode file'); - const GCode={gcode_file_name: file.name } - this.config.GCodeList.push(GCode); + this.config.GCodeList.push(file.name); try { await api.put("config/save", this.config); this.$dispatch("update"); diff --git a/src/py/bbctrl/Config.py b/src/py/bbctrl/Config.py index 83a679d..52f3597 100644 --- a/src/py/bbctrl/Config.py +++ b/src/py/bbctrl/Config.py @@ -41,6 +41,7 @@ class Config(object): self.log = ctrl.log.get('Config') self.values = {} + self.values['GCodeList'] = [] try: self.version = "1.4.0" @@ -62,6 +63,7 @@ class Config(object): try: self._upgrade(config) + config['GCodeList'] = self.get('GCodeList', ["Test.ngc"]) except Exception: self.log.exception('Internal error: Failed to upgrade config') except Exception as e: diff --git a/src/resources/config-template.json b/src/resources/config-template.json index ff86aa7..282f117 100644 --- a/src/resources/config-template.json +++ b/src/resources/config-template.json @@ -690,18 +690,6 @@ } }, - "GCodeList": { - "type": "list", - "index": "numeric", - "default": [], - "template": { - "gcode_file_time": { - "type": "int", - "default": 1705008395 - } - } - }, - "admin": { "auto-check-upgrade": { "type": "bool",