bug fix delete_files_and_folder

This commit is contained in:
sanjayk03-dev
2024-04-08 23:38:56 +05:30
parent 885f2130bf
commit c3af555d05
2 changed files with 13 additions and 8 deletions

View File

@@ -635,24 +635,29 @@ module.exports = {
return;
}
this.config.gcode_list = [...this.state.gcode_list];
this.config.non_macros_list = [...this.state.non_macros_list];
if (this.state.folder != "default") {
this.config.gcode_list = [...this.state.gcode_list];
const selected_folder = this.config.gcode_list.find(
item => item.type == "folder" && item.name == this.state.folder,
).files;
if (selected_folder) {
const files_to_delete = selected_folder.map(item => item.file_name).toString();
await api.delete(`file/DINCAIQABiDARixAxiABDIHCAMQABiABDIHCAQQABiABDIH${files_to_delete}`);
var files_to_delete = selected_folder.map(item => item.file_name);
this.config.gcode_list = this.config.gcode_list.filter(item => item.name != this.state.folder);
}
} else {
const selected_folder = this.config.gcode_list.filter(item => item.type == "file");
if (selected_folder) {
const files_to_delete = selected_folder.map(item => item.name).toString();
await api.delete(`file/DINCAIQABiDARixAxiABDIHCAMQABiABDIHCAQQABiABDIH${files_to_delete}`);
var files_to_delete = selected_folder.map(item => item.name);
this.config.gcode_list = this.config.gcode_list.filter(item => item.type != "file");
}
}
await api.delete(`file/DINCAIQABiDARixAxiABDIHCAMQABiABDIHCAQQABiABDIH${files_to_delete.toString()}`);
this.config.non_macros_list = this.config.non_macros_list.filter(
item => !files_to_delete.includes(item.file_name),
);
this.save_config(this.config);
this.state.folder = "default";
this.confirmDelete = false;

View File

@@ -318,6 +318,9 @@ script#control-view-template(type="text/x-template")
.fa.fa-trash
|  Selected
button.submit-macros(title="Cancel Macros",@click="print_config",style="margin-left:5px;background-color:#fafafa;") CONFIG
button.submit-macros(title="Cancel Macros",@click="print_state",style="margin-left:5px;background-color:#fafafa;") STATE
.drop-down-container
message(:show.sync="create_folder")
h3(slot="header") Enter folder name:
@@ -367,9 +370,6 @@ script#control-view-template(type="text/x-template")
//- :disabled="!is_ready")
//- | Upload File
button.submit-macros(title="Cancel Macros",@click="print_config",style="margin-left:5px;background-color:#fafafa;") CONFIG
button.submit-macros(title="Cancel Macros",@click="print_state",style="margin-left:5px;background-color:#fafafa;") STATE
.progress(v-if="toolpath_progress && toolpath_progress < 1",
title="Simulating GCode to check for errors, calculate ETA and " +
"generate 3D view. You can run GCode before the simulation " +