changed from arr to arrayobjects GCodeList

This commit is contained in:
sanjayk03-dev
2024-01-22 21:51:23 +05:30
parent c75e7a55f1
commit 3fc1bcfc1f
3 changed files with 10 additions and 6 deletions

View File

@@ -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");

View File

@@ -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)

View File

@@ -693,9 +693,12 @@
"GCodeList": {
"type": "list",
"index": "numeric",
"default": [ ],
"default": [],
"template": {
"type": "text"
"gcode_file_time": {
"type": "int",
"default": 1705008395
}
}
},