double-dropdown

This commit is contained in:
sanjayk03-dev
2024-03-27 16:10:29 +05:30
parent 894e7b64cb
commit 7008e1b715
2 changed files with 48 additions and 32 deletions

View File

@@ -203,14 +203,26 @@ module.exports = {
const p = this.plan_time / this.toolpath.time;
return Math.min(1, p);
},
gcodeFiles: function () {
const filesWithNoMacros = this.state.files.filter(
item => !this.config.macros_list.some(compareItem => compareItem.file_name == item),
);
const gcodeList = this.config.non_macros_list.map(item => item.file_name);
const unionSet = new Set([...filesWithNoMacros, ...gcodeList]);
const files = [...unionSet].sort();
return files;
gcode_files: function () {
const files = this.config.gcode_list
.find(item => item.name == this.state.folder)
.files.map(item => item.file_name);
// const filesWithNoMacros = this.state.files.filter(
// item => !this.config.macros_list.some(compareItem => compareItem.file_name == item),
// );
// const gcodeList = this.config.non_macros_list.map(item => item.file_name);
// const unionSet = new Set([...filesWithNoMacros, ...gcodeList]);
// const files = [...unionSet].sort();
return files || [];
},
gcode_folders: function () {
let folders = [];
for (let item of this.config.gcode_list) {
if (item.type == "folder") {
folders.push(item.name);
}
}
return folders;
},
},
@@ -446,14 +458,6 @@ module.exports = {
],
});
}
try {
await api.put("config/save", this.config);
this.$dispatch("update");
} catch (error) {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
setImmediate(() =>
SvelteComponents.showDialog("Upload", {
file,
@@ -464,6 +468,13 @@ module.exports = {
}),
);
}
try {
await api.put("config/save", this.config);
this.$dispatch("update");
} catch (error) {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
},
delete_current: async function () {

View File

@@ -271,23 +271,23 @@ script#control-view-template(type="text/x-template")
v-if="false", style="height:100px;width:100px;font-weight:normal")
.fa.fa-step-forward
message(:show.sync="show_gcodes")
h3(slot="header") Select G-Code
div(slot="body")
details
summary
| folder name
ul.folder-list
li one
li two
//- message(:show.sync="show_gcodes")
//- h3(slot="header") Select G-Code
//- div(slot="body")
//- details
//- summary
//- | folder name
//- ul.folder-list
//- li one
//- li two
div(slot="footer")
button.pure-button(@click="show_gcodes=false") Cancel
button.pure-button.pure-button-primary(@click="show_gcodes=false") Select
//- div(slot="footer")
//- button.pure-button(@click="show_gcodes=false") Cancel
//- button.pure-button.pure-button-primary(@click="show_gcodes=false") Select
button.pure-button(title="Open Title", @click="show_gcodes=true",
:disabled="!is_ready",style="height:100px;width:100px;font-weight:normal")
.fa.fa-folder
//- button.pure-button(title="Open Title", @click="show_gcodes=true",
//- :disabled="!is_ready",style="height:100px;width:100px;font-weight:normal")
//- .fa.fa-folder
button.pure-button(title="Upload a new GCode program.", @click="open_file",
:disabled="!is_ready",style="height:100px;width:100px;font-weight:normal")
@@ -328,10 +328,15 @@ script#control-view-template(type="text/x-template")
.fa.fa-trash
|  Selected
select(title="Select previously uploaded GCode programs.",
v-model="state.folder", :disabled="!is_ready",
style="max-width:100%")
option(v-for="file in gcode_folders", :value="file") {{file}}
select(title="Select previously uploaded GCode programs.",
v-model="state.selected", @change="load", :disabled="!is_ready",
style="max-width:100%")
option(v-for="file in gcodeFiles", :value="file") {{file}}
option(v-for="file in gcode_files", :value="file") {{file}}
.progress(v-if="toolpath_progress && toolpath_progress < 1",
title="Simulating GCode to check for errors, calculate ETA and " +