From 4dbba37d65c5050a10cd74816c9ec36c6d5344d3 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Tue, 2 Jan 2024 16:57:39 +0530 Subject: [PATCH] changing values of buttons dynamically --- src/js/macros.js | 3 +++ src/pug/templates/control-view.pug | 14 +++++++------- src/stylus/style.styl | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index 4d0098a..dd6d23e 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -89,6 +89,9 @@ module.exports = { this.config.macros[id].color=macrosColor; this.config.macros[id].gcode=this.state.selected; + console.log(this.state.selected_time); + console.log(typeof(this.state.selected_time)); + console.log(this.config.macros); try { await api.put("config/save",this.config); diff --git a/src/pug/templates/control-view.pug b/src/pug/templates/control-view.pug index 3671508..0205659 100644 --- a/src/pug/templates/control-view.pug +++ b/src/pug/templates/control-view.pug @@ -208,17 +208,17 @@ script#control-view-template(type="text/x-template") .bar(:style="'width:' + (progress || 0) * 100 + '%'") .macros-div(class="present") - button.macros-buttons(title="Click to run Macros 1", @click="open", - :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0") Macros 1 - button.macros-buttons(title="Click to run Macros 2", @click="open", + button.macros-buttons(title="Click to run Macros 1", @click="runMacros(0)", + :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0;background-color:{{config.macros[0].color}}") {{config.macros[0].name}} + button.macros-buttons(title="Click to run Macros 2", @click="runMacros(1)", :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0") Macros 2 - button.macros-buttons(title="Click to run Macros 3", @click="open", + button.macros-buttons(title="Click to run Macros 3", @click="runMacros(2)", :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0") Macros 3 - button.macros-buttons(title="Click to run Macros 4", @click="open", + button.macros-buttons(title="Click to run Macros 4", @click="runMacros(3)", :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0") Macros 4 - button.macros-buttons(title="Click to run Macros 5", @click="open", + button.macros-buttons(title="Click to run Macros 5", @click="runMacros(4)", :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0") Macros 5 - button.macros-buttons(title="Click to run Macros 6", @click="open", + button.macros-buttons(title="Click to run Macros 6", @click="runMacros(5)", :disabled="!true",style="height:60px;width:100px;font-weight:normal;border-radius:15px;border:0") Macros 6 diff --git a/src/stylus/style.styl b/src/stylus/style.styl index fb63f07..9256d75 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -617,9 +617,9 @@ span.unit display flex justify-content space-around height 60px - width 85% + width 50% margin 10px - margin-left 50px + margin-left 400px .macros width 90%