delete prompt ui change

This commit is contained in:
sanjayk03-dev
2024-05-31 14:41:35 +05:30
parent 0f3b241c1f
commit b3692d2239
3 changed files with 48 additions and 7 deletions

View File

@@ -55,6 +55,8 @@ module.exports = {
totalFiles: 0, totalFiles: 0,
files_sortby: "By Upload Date", files_sortby: "By Upload Date",
selected_items_to_delete: [], selected_items_to_delete: [],
search_query: "",
filtered_files: [],
}; };
}, },
@@ -230,6 +232,9 @@ module.exports = {
return files; return files;
} }
}, },
gcode_filtered_files: function () {
return this.filtered_files.filter(file => file.toLowerCase().includes(this.search_query.toLowerCase()));
},
gcode_folders: function () { gcode_folders: function () {
return this.state.gcode_list return this.state.gcode_list
.map(item => item.name) .map(item => item.name)
@@ -289,6 +294,11 @@ module.exports = {
alert("Restore failed"); alert("Restore failed");
} }
}, },
populateFiles(index) {
this.filtered_files = this.state.gcode_list[index].files.map(item => item.file_name);
},
getJogIncrStyle(value) { getJogIncrStyle(value) {
const weight = `font-weight:${this.jog_incr === value ? "bold" : "normal"}`; const weight = `font-weight:${this.jog_incr === value ? "bold" : "normal"}`;
const color = this.jog_incr === value ? "color:#0078e7" : ""; const color = this.jog_incr === value ? "color:#0078e7" : "";

View File

@@ -320,19 +320,24 @@ script#control-view-template(type="text/x-template")
:disabled="!state.selected || !is_ready",style="height:100px;width:100px;font-weight:normal") :disabled="!state.selected || !is_ready",style="height:100px;width:100px;font-weight:normal")
img(src="images/delete_gcode.png" style="height: 30px;") img(src="images/delete_gcode.png" style="height: 30px;")
message(:show.sync="deleteGCode") message.error-message(:show.sync="deleteGCode")
h3(slot="header") Select files to delete: h3(slot="header") Select files to delete:
div(slot="body") div(slot="body")
.gcode_container .search-bar
label(v-for="item in gcode_files" :key="item") input(type="text" v-model="search_query" placeholder="Search Files...")
input(type="checkbox" :value="item" v-model="selected_items_to_delete") .container
| {{ item }} .folders
div(v-for="(folder, index) in state.gcode_list" :key="index" @click="populateFiles(index)" class="folder-item") {{ folder.name }}
.files
label.file-item(v-for="item in gcode_filtered_files" :key="item")
input(type="checkbox" :value="item" v-model="selected_items_to_delete")
| {{ item }}
div(slot="footer") div(slot="footer")
button.pure-button(@click="cancel_delete") Cancel button.pure-button(@click="cancel_delete",style="height:50px") Cancel
//- button.pure-button.button-error(@click="delete_all_except_macros") //- button.pure-button.button-error(@click="delete_all_except_macros")
//- .fa.fa-trash //- .fa.fa-trash
//- |  All //- |  All
button.pure-button.button-success(@click="delete_current") button.pure-button.button-success(@click="delete_current",style="height:50px")
.fa.fa-trash .fa.fa-trash
|  Selected |  Selected

View File

@@ -297,6 +297,32 @@ span.unit
overflow-y scroll overflow-y scroll
max-height 400px max-height 400px
margin-bottom 10px margin-bottom 10px
.container
display flex
width 100%
height 100vh
.folders
width 30%
border-right 1px solid #ccc
padding 10px
overflow-y auto
.files
width 70%
padding 10px
overflow-y auto
.folder-item, .file-item
padding: 5px
cursor: pointer
.folder-item:hover, .file-item:hover
background-color #f0f0f0
.search-bar
margin-bottom 10px
table table
border-collapse collapse border-collapse collapse