This commit is contained in:
sanjayk03-dev
2023-12-30 11:37:31 +05:30
parent 129c27881a
commit 0bf3d936d4
6 changed files with 32 additions and 18 deletions

View File

@@ -114,7 +114,7 @@ module.exports = new Vue({
full_version: "<loading>", full_version: "<loading>",
ip: "<>", ip: "<>",
wifiName: "not connected", wifiName: "not connected",
macros:[{},{},{},{},{},{}] macros:[]
}, },
state: { state: {
messages: [], messages: [],

View File

@@ -203,12 +203,13 @@ module.exports = {
return Math.min(1, p); return Math.min(1, p);
}, },
isMacrosPresent: function(){ isMacrosPresent: function(){
if(this.config.macros!=undefined){ return (this.config.macros!=undefined)
console.log("isMacrosPresent",this.config.macros!=undefined); // if(this.config.macros!=undefined){
console.log(this.config.macros.length!=0); // console.log("isMacrosPresent",this.config.macros!=undefined);
return this.config.macros.length!=0; // console.log(this.config.macros.length!=0);
} // return this.config.macros.length!=0;
return false; // }
// return false;
} }
}, },

View File

@@ -55,8 +55,7 @@ module.exports = {
}, },
saveMacros: function(){ saveMacros: function(){
var macrosName = document.getElementById("macros-name").value; var macrosName = document.getElementById("macros-name").value;
var macrosColor = document.getElementById("macros-color").value var macrosColor = document.getElementById("macros-color").value;
console.log(this.state.selected);
if(this.config.macros == undefined) { if(this.config.macros == undefined) {
console.log("macros is undefined"); console.log("macros is undefined");
this.config.macros=[]; this.config.macros=[];
@@ -65,7 +64,8 @@ module.exports = {
this.config.macros.push({ this.config.macros.push({
id:Math.round(Math.random()*100000), id:Math.round(Math.random()*100000),
name:macrosName, name:macrosName,
color:macrosColor color:macrosColor,
gcode:this.state.selected,
}) })
console.log("Successfully saved"); console.log("Successfully saved");
console.log(this.config.macros); console.log(this.config.macros);

View File

@@ -209,7 +209,8 @@ script#control-view-template(type="text/x-template")
.macros-div .macros-div
.macros-buttons(v-if="isMacrosPresent") .macros-buttons(v-if="isMacrosPresent")
<p> there is a macro .submit-macros
a(href="#macros") Edit Macros
.tabs .tabs

View File

@@ -3,21 +3,19 @@ script#macros-template(type="text/x-template")
h1 Macros Configuration h1 Macros Configuration
.macros-form .macros-form
p.title Enter Macros Name p.title Enter Macros Name
input.input-name(type="text",id="macros-name")
p.title Select Your Macros Color
input.input-color(type="color",id="macros-color",value="#ffffff") input.input-color(type="color",id="macros-color",value="#ffffff")
input.input-name(type="text",id="macros-name")
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",
style="max-width:100%;height:40px;border-radius:5px") style="max-width:100%;height:40px;border-radius:5px")
option(v-for="file in state.files", :value="file") {{file}} option(v-for="file in state.files", :value="file") {{file}}
button.pure-button(title="Upload a new GCode program.", @click="open", button.pure-button(title="Upload a new GCode program.", @click="open",
:disabled="!is_ready",style="height:40px;width:50px;font-weight:normal;border-radius:5px") :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px") Upload
Upload br
button.submit-macros(title="Save Macros",@click="saveMacros", button.submit-macros(title="Save Macros",@click="saveMacros",
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border-color:#add1ad") Save Macros style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border-color:#add1ad") Save Macros
button.pure-button(title="Print config.", @click="printConfig", button.pure-button(title="Print config.", @click="printConfig",
style="height:50px;width:100px;font-weight:normal") style="height:50px;width:100px;font-weight:normal") print Config
.fa.fa-folder-open
gcode-viewer gcode-viewer

View File

@@ -611,6 +611,19 @@ span.unit
margin 0 0.5em margin 0 0.5em
vertical-align middle vertical-align middle
.macros-div
height 500px
width 500px
margin 100px
.submit-macros
height 50px
width 140px
font-weight normal
background-color #e6e6e6
color #fff
border 0
.macros-buttons .macros-buttons
padding 40px padding 40px
margin-left 200px margin-left 200px
@@ -1062,7 +1075,8 @@ tt.save
input.input-color input.input-color
height 40px height 40px
width 300px width 40px
border 1px solid #fdfdfd
border-radius 2px border-radius 2px
button button