trying index

This commit is contained in:
sanjayk03-dev
2024-01-28 21:33:59 +05:30
parent 4c2b41118a
commit d3c5885538
5 changed files with 15 additions and 23 deletions

View File

@@ -280,10 +280,6 @@ module.exports = {
this.$dispatch("send", msg); this.$dispatch("send", msg);
}, },
getMacros: function(){
return this.config.macros;
},
load: function () { load: function () {
const file_time = this.state.selected_time; const file_time = this.state.selected_time;
const file = this.state.selected; const file = this.state.selected;

View File

@@ -9,7 +9,7 @@ module.exports = {
data: function () { data: function () {
return { return {
tab: "0", tab: "1",
confirmReset: false, confirmReset: false,
confirmSave: false, confirmSave: false,
deleteGCode: false, deleteGCode: false,
@@ -40,9 +40,6 @@ module.exports = {
macrosList: function () { macrosList: function () {
return this.config.macrosList.map(el => el.file_name); return this.config.macrosList.map(el => el.file_name);
}, },
getMacros: function(){
return this.config.macros;
},
getMacrosColor: function () { getMacrosColor: function () {
return this.config.macros[this.tab]["color"]; return this.config.macros[this.tab]["color"];
}, },
@@ -64,9 +61,9 @@ module.exports = {
const response = await fetch(`/api/file/EgZjaHJvbWUqCggBEAAYsQMYgAQyBggAEEUYOTIKCAE${file}`, { const response = await fetch(`/api/file/EgZjaHJvbWUqCggBEAAYsQMYgAQyBggAEEUYOTIKCAE${file}`, {
cache: "no-cache", cache: "no-cache",
}); });
console.log('response: ',response); console.log("response status: ", response.status);
const text = (await response.text()).split(" ").join("\n"); const text = (await response.text()).split(" ").join("\n");
console.log('text: ',text); console.log("text: ", text);
this.$set("newGcode[this.tab]", text); this.$set("newGcode[this.tab]", text);
} else { } else {
this.$set("newGcode[this.tab]", ""); this.$set("newGcode[this.tab]", "");
@@ -171,8 +168,7 @@ module.exports = {
console.log(" this.state.selected && time: ", this.state.selected, this.state.selected_time); console.log(" this.state.selected && time: ", this.state.selected, this.state.selected_time);
console.log("selectedValues: ", this.selectedValues[this.tab]); console.log("selectedValues: ", this.selectedValues[this.tab]);
var file_name = var file_name = this.selectedValues[this.tab] == "default" ? macrosName + ".ngc" : this.selectedValues[this.tab];
this.selectedValues[this.tab] == "default" ? macrosName + ".ngc" : this.selectedValues[this.tab];
var file = this.newGcode[this.tab]; var file = this.newGcode[this.tab];
this.uploadGCode(file_name, file); this.uploadGCode(file_name, file);
@@ -310,6 +306,8 @@ module.exports = {
color: "#dedede", color: "#dedede",
file_name: "", file_name: "",
}; };
this.newGcode.push("");
this.selectedValues.push("default");
this.config.macros.push(newMacros); this.config.macros.push(newMacros);
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);

View File

@@ -216,7 +216,7 @@ script#control-view-template(type="text/x-template")
.bar(:style="'width:' + (progress || 0) * 100 + '%'") .bar(:style="'width:' + (progress || 0) * 100 + '%'")
.macros-div(class="present") .macros-div(class="present")
button.macros-button(title="Click to run Macros",v-for="(index,macros) in getMacros", button.macros-button(title="Click to run Macros",v-for="(index,macros) in config.macros",
@click="runMacros(index)",:disabled="!is_ready",v-bind:style="{ backgroundColor: macros.color }") {{macros.name}} @click="runMacros(index)",:disabled="!is_ready",v-bind:style="{ backgroundColor: macros.color }") {{macros.name}}
.tabs .tabs

View File

@@ -30,17 +30,15 @@ script#macros-template(type="text/x-template")
h1 Macros Configuration h1 Macros Configuration
.flex-row-container .flex-row-container
button.config-button(title="Reset Macros", @click="confirmReset=true") Delete All Macros button.config-button(title="Reset Macros", @click="confirmReset=true") Delete All
.fa.fa-rotate-right button.config-button(title="Add a Macros", @click="addNewMacros", style="margin-left:5px") New Macros
button.config-button(title="Add a Macros", @click="addNewMacros", style="margin-left:5px") Add a Macros
.fa.fa-plus
.tabs .tabs
template(v-for="(index,macros) in getMacros",:key="index") template(v-for="(index,macros) in config.macros",:key="index+1")
input(type="radio",:id="'tab'+index", name="tabs",@click="tab = index.toString()") input(type="radio",:id="'tab'+(index+1)", name="tabs",@click="tab = (index+1).toString()")
label(:for="'tab'+index",style="height:50px;width:100px") Macros {{index+1}} label(:for="'tab'+(index+1)",style="height:50px;width:100px") Macros {{index+1}}
section.tab-content(v-for="(index,macros) in config.macros",:id="'content'+index") section.tab-content(v-for="(index,macros) in config.macros",:id="'content'+(index+1)")
.macros-form .macros-form
p.title Name p.title Name
.input-container .input-container

View File

@@ -652,9 +652,9 @@ span.unit
border-style solid border-style solid
.config-button .config-button
height 50px height 45px
margin-bottom 1rem margin-bottom 1rem
width 190px width 120px
border-radius 2px border-radius 2px
border 0 border 0
font-weight normal font-weight normal