update state while adding gcode,

This commit is contained in:
sanjayk03-dev
2024-01-22 19:25:44 +05:30
parent 2ccbd2510c
commit d244b4c449
4 changed files with 9 additions and 12 deletions

View File

@@ -373,7 +373,8 @@ module.exports = {
return;
}
if(!this.config.gcodeList.some(item=> item == file.name)){
const isAlreadyPresent = this.config.gcodeList.find((element) => element == file.name);
if(isAlreadyPresent == undefined){
console.log('new gcode file');
this.config.gcodeList.push(file.name);
try {

View File

@@ -42,9 +42,6 @@ module.exports = {
updateNewGcode: function (event) {
this.newGcode[this.tab - 1] = event.target.value;
},
loadGcode: function (data) {
this.newGcode[this.tab - 1] = data;
},
macrosList: function () {
return this.config.macrosList.map((el) => el.gcode_file_name);
},
@@ -61,12 +58,12 @@ module.exports = {
});
const text = (await response.text()).split(" ").join("\n");
if (text.length > 20e6) {
this.loadGcode("File is large - gcode view disabled");
this.newGcode[this.tab - 1]="File is large - gcode view disabled";
} else {
this.loadGcode(text);
this.newGcode[this.tab - 1]=text;
}
} else {
this.loadGcode("");
this.newGcode[this.tab - 1]="";
}
console.log(this.newGcode[this.tab - 1]);
},

View File

@@ -246,8 +246,3 @@ class Config(object):
for name, tmpl in self.template.items():
conf = config.get(name, None)
self._encode(name, '', conf, tmpl, with_defaults)
def set_gcodeList(self, filename):
self.set('selected', filename)
time = os.path.getmtime(self.ctrl.get_upload(filename))
self.set('selected_time', time)

View File

@@ -38,6 +38,10 @@ class FileHandler(bbctrl.APIHandler):
def delete_ok(self, filename):
self.get_log('FileHandler').info('filename ' + filename)
allFiles = self.get_ctrl().state.return_files(filename)
for file in allFiles:
self.get_log('FileHandler').info('filename ' + file)
if not filename:
# Delete everything
for path in glob.glob(self.get_upload('*')):