From 6521ea338a0e4fb3f87f61a7df2a81f377461644 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Thu, 4 Jan 2024 22:15:13 +0530 Subject: [PATCH] gcode clear when cancel, fixed alert box while reset --- src/js/macros.js | 3 ++- src/pug/templates/macros.pug | 14 +++++++------- src/stylus/style.styl | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index f393d5d..5db3d51 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -79,12 +79,12 @@ module.exports = { this.config.macros[id].color = macrosColor; this.config.macros[id].gcode_file_name = this.state.selected; this.config.macros[id].gcode_file_time = this.state.selected_time; - console.log(this.config.macros); try { await api.put("config/save", this.config); console.log("Successfully saved"); this.$dispatch("update"); + this.cancelMacros(); } catch (error) { console.error("Restore Failed: ", error); alert("Restore failed"); @@ -93,6 +93,7 @@ module.exports = { cancelMacros: function (id) { document.getElementById(`macros-name-${id}`).value = ""; document.getElementById(`macros-color-${id}`).value = "#ffffff"; + this.$broadcast("gcode-clear"); }, resetConfig: async function () { this.config.macros = [ diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index 1314bc0..bdade7e 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -10,7 +10,7 @@ script#macros-template(type="text/x-template") button.pure-button.pure-button-primary(@click="resetConfig") | Reset h1 Macros Configuration - button.pure-button(title="Print config.", @click="confirmReset='true'", + button.pure-button(title="Reset Macros", @click="confirmReset=true", style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around") Reset Macros .fa.fa-rotate-right .warning-box @@ -49,7 +49,7 @@ script#macros-template(type="text/x-template") 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 + :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload form.gcode-file-input.file-upload input(type="file", @change="upload", :disabled="!is_ready", @@ -74,7 +74,7 @@ script#macros-template(type="text/x-template") 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 + :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload form.gcode-file-input.file-upload input(type="file", @change="upload", :disabled="!is_ready", @@ -99,7 +99,7 @@ script#macros-template(type="text/x-template") 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 + :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload form.gcode-file-input.file-upload input(type="file", @change="upload", :disabled="!is_ready", @@ -124,7 +124,7 @@ script#macros-template(type="text/x-template") 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 + :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload form.gcode-file-input.file-upload input(type="file", @change="upload", :disabled="!is_ready", @@ -149,7 +149,7 @@ script#macros-template(type="text/x-template") 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 + :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload form.gcode-file-input.file-upload input(type="file", @change="upload", :disabled="!is_ready", @@ -174,7 +174,7 @@ script#macros-template(type="text/x-template") 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 + :disabled="!is_ready",style="height:40px;width:130px;font-weight:normal;border-radius:5px;margin-left:4px;background-color:#5a9ad7;color:#fff;display:flex;align-items:center;justify-content:space-around") Upload form.gcode-file-input.file-upload input(type="file", @change="upload", :disabled="!is_ready", diff --git a/src/stylus/style.styl b/src/stylus/style.styl index 2974dbd..0966a67 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -639,6 +639,8 @@ span.unit margin-bottom 10px margin-top 10px align-items center + justify-content center + .tabs margin-top 5px