solving error in control-view, dynamic input, added 6 tabs,
This commit is contained in:
@@ -203,7 +203,13 @@ module.exports = {
|
|||||||
return Math.min(1, p);
|
return Math.min(1, p);
|
||||||
},
|
},
|
||||||
isMacrosPresent: function(val){
|
isMacrosPresent: function(val){
|
||||||
return this.config.macros[val].name!="" || this.config.macros[val].gcode!="";
|
try{
|
||||||
|
const res = this.config.macros[val].name!="" || this.config.macros[val].gcode!="";
|
||||||
|
console.log("result: ",val," : res");
|
||||||
|
return res;
|
||||||
|
}catch(err){
|
||||||
|
console.log("Error for macros present: ",err);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -82,25 +82,29 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveMacros: async function(id){
|
saveMacros: async function(id){
|
||||||
var macrosName = document.getElementById("macros-name").value;
|
console.log(typeof(id)," type");
|
||||||
var macrosColor = document.getElementById("macros-color").value;
|
var macrosName = document.getElementById(`macros-name-${id}`).value;
|
||||||
if(this.config.macros == undefined) {
|
var macrosColor = document.getElementById(`macros-color-${id}`).value;
|
||||||
console.log("macros is undefined");
|
|
||||||
this.config.macros=[];
|
console.log(macrosName);
|
||||||
}else{
|
console.log(macrosColor);
|
||||||
this.config.macros[id].name=macrosName;
|
// if(this.config.macros == undefined) {
|
||||||
this.config.macros[id].color=macrosColor;
|
// console.log("macros is undefined");
|
||||||
this.config.macros[id].gcode=this.state.selected;
|
// this.config.macros=[];
|
||||||
}
|
// }else{
|
||||||
console.log(this.config.macros);
|
// this.config.macros[id].name=macrosName;
|
||||||
try {
|
// this.config.macros[id].color=macrosColor;
|
||||||
await api.put("config/save",this.config);
|
// this.config.macros[id].gcode=this.state.selected;
|
||||||
console.log("Successfully saved");
|
// }
|
||||||
this.$dispatch("update");
|
// console.log(this.config.macros);
|
||||||
} catch (error) {
|
// try {
|
||||||
console.error("Restore Failed: ",error);
|
// await api.put("config/save",this.config);
|
||||||
alert("Restore failed");
|
// console.log("Successfully saved");
|
||||||
}
|
// this.$dispatch("update");
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("Restore Failed: ",error);
|
||||||
|
// alert("Restore failed");
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
printConfig: function(){
|
printConfig: function(){
|
||||||
console.log(this.config);
|
console.log(this.config);
|
||||||
|
|||||||
@@ -208,18 +208,18 @@ 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-buttons(title="Edit Macros 1", @click="open",
|
button.macros-buttons(title="Click to run Macros 1", @click="open",
|
||||||
:disabled="!isMacrosPresent(0)",style="height:100px;width:100px;font-weight:normal") Macros 1
|
:disabled="!isMacrosPresent(0)",style="height:60px;width:100px;font-weight:normal") Macros 1
|
||||||
button.macros-buttons(title="Edit Macros 1", @click="open",
|
button.macros-buttons(title="Click to run Macros 2", @click="open",
|
||||||
:disabled="!isMacrosPresent(1)",style="height:100px;width:100px;font-weight:normal") Macros 2
|
:disabled="!isMacrosPresent(1)",style="height:60px;width:100px;font-weight:normal") Macros 2
|
||||||
button.macros-buttons(title="Edit Macros 1", @click="open",
|
button.macros-buttons(title="Click to run Macros 3", @click="open",
|
||||||
:disabled="!isMacrosPresent(2)",style="height:100px;width:100px;font-weight:normal") Macros 3
|
:disabled="!isMacrosPresent(2)",style="height:60px;width:100px;font-weight:normal") Macros 3
|
||||||
button.macros-buttons(title="Edit Macros 1", @click="open",
|
button.macros-buttons(title="Click to run Macros 4", @click="open",
|
||||||
:disabled="!isMacrosPresent(3)",style="height:100px;width:100px;font-weight:normal") Macros 4
|
:disabled="!isMacrosPresent(3)",style="height:60px;width:100px;font-weight:normal") Macros 4
|
||||||
button.macros-buttons(title="Edit Macros 1", @click="open",
|
button.macros-buttons(title="Click to run Macros 5", @click="open",
|
||||||
:disabled="!isMacrosPresent(4)",style="height:100px;width:100px;font-weight:normal") Macros 5
|
:disabled="!isMacrosPresent(4)",style="height:60px;width:100px;font-weight:normal") Macros 5
|
||||||
button.macros-buttons(title="Edit Macros 1", @click="open",
|
button.macros-buttons(title="Click to run Macros 6", @click="open",
|
||||||
:disabled="!isMacrosPresent(5)",style="height:100px;width:100px;font-weight:normal") Macros 6
|
:disabled="!isMacrosPresent(5)",style="height:60px;width:100px;font-weight:normal") Macros 6
|
||||||
|
|
||||||
|
|
||||||
.tabs
|
.tabs
|
||||||
|
|||||||
@@ -14,12 +14,18 @@ script#macros-template(type="text/x-template")
|
|||||||
input#tab4(type="radio", name="tabs", @click="tab = '4'")
|
input#tab4(type="radio", name="tabs", @click="tab = '4'")
|
||||||
label(for="tab4",style="height:50px;width:100px") Macros 4
|
label(for="tab4",style="height:50px;width:100px") Macros 4
|
||||||
|
|
||||||
|
input#tab4(type="radio", name="tabs", @click="tab = '5'")
|
||||||
|
label(for="tab4",style="height:50px;width:100px") Macros 5
|
||||||
|
|
||||||
|
input#tab4(type="radio", name="tabs", @click="tab = '6'")
|
||||||
|
label(for="tab4",style="height:50px;width:100px") Macros 6
|
||||||
|
|
||||||
section#content1.tab-content
|
section#content1.tab-content
|
||||||
.macros-form
|
.macros-form
|
||||||
p.title Enter Macros 1 Name
|
p.title Enter Macros 1 Name
|
||||||
.input-container
|
.input-container
|
||||||
input.input-color(type="color",id="macros-color",value="#ffffff")
|
input.input-color(type="color",id="macros-color-0",value="#ffffff")
|
||||||
input.input-name(type="text",id="macros-name")
|
input.input-name(type="text",id="macros-name-0")
|
||||||
p.title Select/Upload G-Code
|
p.title Select/Upload G-Code
|
||||||
select(title="Select previously uploaded GCode programs.",
|
select(title="Select previously uploaded GCode programs.",
|
||||||
v-model="state.selected", @change="load", :disabled="!is_ready",
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
@@ -40,8 +46,8 @@ script#macros-template(type="text/x-template")
|
|||||||
.macros-form
|
.macros-form
|
||||||
p.title Enter Macros 2 Name
|
p.title Enter Macros 2 Name
|
||||||
.input-container
|
.input-container
|
||||||
input.input-color(type="color",id="macros-color",value="#ffffff")
|
input.input-color(type="color",id="macros-color-1",value="#ffffff")
|
||||||
input.input-name(type="text",id="macros-name")
|
input.input-name(type="text",id="macros-name-1")
|
||||||
p.title Select/Upload G-Code
|
p.title Select/Upload G-Code
|
||||||
select(title="Select previously uploaded GCode programs.",
|
select(title="Select previously uploaded GCode programs.",
|
||||||
v-model="state.selected", @change="load", :disabled="!is_ready",
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
@@ -62,8 +68,8 @@ script#macros-template(type="text/x-template")
|
|||||||
.macros-form
|
.macros-form
|
||||||
p.title Enter Macros 3 Name
|
p.title Enter Macros 3 Name
|
||||||
.input-container
|
.input-container
|
||||||
input.input-color(type="color",id="macros-color",value="#ffffff")
|
input.input-color(type="color",id="macros-color-2",value="#ffffff")
|
||||||
input.input-name(type="text",id="macros-name")
|
input.input-name(type="text",id="macros-name-2")
|
||||||
p.title Select/Upload G-Code
|
p.title Select/Upload G-Code
|
||||||
select(title="Select previously uploaded GCode programs.",
|
select(title="Select previously uploaded GCode programs.",
|
||||||
v-model="state.selected", @change="load", :disabled="!is_ready",
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
@@ -84,8 +90,8 @@ script#macros-template(type="text/x-template")
|
|||||||
.macros-form
|
.macros-form
|
||||||
p.title Enter Macros 4 Name
|
p.title Enter Macros 4 Name
|
||||||
.input-container
|
.input-container
|
||||||
input.input-color(type="color",id="macros-color",value="#ffffff")
|
input.input-color(type="color",id="macros-color-3",value="#ffffff")
|
||||||
input.input-name(type="text",id="macros-name")
|
input.input-name(type="text",id="macros-name-3")
|
||||||
p.title Select/Upload G-Code
|
p.title Select/Upload G-Code
|
||||||
select(title="Select previously uploaded GCode programs.",
|
select(title="Select previously uploaded GCode programs.",
|
||||||
v-model="state.selected", @change="load", :disabled="!is_ready",
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
@@ -101,6 +107,50 @@ script#macros-template(type="text/x-template")
|
|||||||
br
|
br
|
||||||
button.submit-macros(title="Save Macros",@click="saveMacros(3)",
|
button.submit-macros(title="Save Macros",@click="saveMacros(3)",
|
||||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border-color:#add1ad;margin-top:30px") Save Macros
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border-color:#add1ad;margin-top:30px") Save Macros
|
||||||
|
|
||||||
|
section#content5.tab-content
|
||||||
|
.macros-form
|
||||||
|
p.title Enter Macros 5 Name
|
||||||
|
.input-container
|
||||||
|
input.input-color(type="color",id="macros-color-4",value="#ffffff")
|
||||||
|
input.input-name(type="text",id="macros-name-4")
|
||||||
|
p.title Select/Upload G-Code
|
||||||
|
select(title="Select previously uploaded GCode programs.",
|
||||||
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
|
style="max-width:100%;height:40px;border-radius:5px")
|
||||||
|
option(v-for="file in state.files", :value="file") {{file}}
|
||||||
|
|
||||||
|
button.pure-button(title="Upload a new GCode program.", @click="open",
|
||||||
|
:disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px") Upload
|
||||||
|
|
||||||
|
form.gcode-file-input.file-upload
|
||||||
|
input(type="file", @change="upload", :disabled="!is_ready",
|
||||||
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
br
|
||||||
|
button.submit-macros(title="Save Macros",@click="saveMacros(4)",
|
||||||
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border-color:#add1ad;margin-top:30px") Save Macros
|
||||||
|
|
||||||
|
section#content6.tab-content
|
||||||
|
.macros-form
|
||||||
|
p.title Enter Macros 6 Name
|
||||||
|
.input-container
|
||||||
|
input.input-color(type="color",id="macros-color-5",value="#ffffff")
|
||||||
|
input.input-name(type="text",id="macros-name-5")
|
||||||
|
p.title Select/Upload G-Code
|
||||||
|
select(title="Select previously uploaded GCode programs.",
|
||||||
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
|
style="max-width:100%;height:40px;border-radius:5px")
|
||||||
|
option(v-for="file in state.files", :value="file") {{file}}
|
||||||
|
|
||||||
|
button.pure-button(title="Upload a new GCode program.", @click="open",
|
||||||
|
:disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px") Upload
|
||||||
|
|
||||||
|
form.gcode-file-input.file-upload
|
||||||
|
input(type="file", @change="upload", :disabled="!is_ready",
|
||||||
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
br
|
||||||
|
button.submit-macros(title="Save Macros",@click="saveMacros(5)",
|
||||||
|
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border-color:#add1ad;margin-top:30px") Save Macros
|
||||||
|
|
||||||
button.pure-button(title="Print config.", @click="printConfig",
|
button.pure-button(title="Print config.", @click="printConfig",
|
||||||
style="height:50px;width:120px;font-weight:normal;padding-top:5px") print Config
|
style="height:50px;width:120px;font-weight:normal;padding-top:5px") print Config
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ span.unit
|
|||||||
.macros-div
|
.macros-div
|
||||||
display flex
|
display flex
|
||||||
justify-content space-around
|
justify-content space-around
|
||||||
height 50px
|
height 60px
|
||||||
width 85%
|
width 85%
|
||||||
margin 10px
|
margin 10px
|
||||||
margin-left 50px
|
margin-left 50px
|
||||||
@@ -626,7 +626,7 @@ span.unit
|
|||||||
|
|
||||||
.tabs
|
.tabs
|
||||||
margin-top 5px
|
margin-top 5px
|
||||||
|
|
||||||
.submit-macros
|
.submit-macros
|
||||||
height 50px
|
height 50px
|
||||||
width 140px
|
width 140px
|
||||||
|
|||||||
Reference in New Issue
Block a user