front for delete and

This commit is contained in:
sanjayk03-dev
2024-01-23 03:39:28 +05:30
parent fcea3ef0af
commit 2778d05fc5
3 changed files with 16 additions and 4 deletions

View File

@@ -405,8 +405,10 @@ module.exports = {
},
delete_current: function() {
if (this.state.selected) {
api.delete(`file/${this.state.selected}`);
if(this.config.macrosList.find(item=>item.gcode_file_name==this.state.selected)==undefined){
if (this.state.selected) {
api.delete(`file/${this.state.selected}`);
}
}
this.deleteGCode = false;
@@ -417,6 +419,12 @@ module.exports = {
this.deleteGCode = false;
},
delete_all_except_macros: function() {
macrosList=this.config.macros.map(item=>item.gcode_file_name).toString();
api.delete(`file/EgZjaHJvbWUqCggBEAAYsQMYgAQyBggAEEUYOTIKCAE${macrosList}`);
this.deleteGCode = false;
},
home: function(axis) {
this.ask_home = false;

View File

@@ -293,6 +293,9 @@ script#control-view-template(type="text/x-template")
button.pure-button.button-success(@click="delete_current")
.fa.fa-trash
|  Selected
button.pure-button.button-success(@click="delete_all_except_macros")
.fa.fa-trash
|  Not Macros
select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="loadGCode", :disabled="!is_ready",

View File

@@ -137,8 +137,9 @@ class State(object):
def load_gcodes(self):
GCodeList = []
files = copy.deepcopy(self.get('files'))
macrosList = self.ctrl.config.get('macrosList', [])
# GCodeList = copy.deepcopy(self.get('files'))
# macrosList = self.ctrl.config.get('macrosList', [])
# macro_names = [macro["gcode_file_name"] for macro in macrosList]
# GCodeList = [file for file in files if file not in macro_names]