gcode clear when cancel, fixed alert box while reset

This commit is contained in:
sanjayk03-dev
2024-01-04 22:15:13 +05:30
parent 443e4bd39a
commit 6521ea338a
3 changed files with 11 additions and 8 deletions

View File

@@ -79,12 +79,12 @@ module.exports = {
this.config.macros[id].color = macrosColor; this.config.macros[id].color = macrosColor;
this.config.macros[id].gcode_file_name = this.state.selected; this.config.macros[id].gcode_file_name = this.state.selected;
this.config.macros[id].gcode_file_time = this.state.selected_time; this.config.macros[id].gcode_file_time = this.state.selected_time;
console.log(this.config.macros); console.log(this.config.macros);
try { try {
await api.put("config/save", this.config); await api.put("config/save", this.config);
console.log("Successfully saved"); console.log("Successfully saved");
this.$dispatch("update"); this.$dispatch("update");
this.cancelMacros();
} catch (error) { } catch (error) {
console.error("Restore Failed: ", error); console.error("Restore Failed: ", error);
alert("Restore failed"); alert("Restore failed");
@@ -93,6 +93,7 @@ module.exports = {
cancelMacros: function (id) { cancelMacros: function (id) {
document.getElementById(`macros-name-${id}`).value = ""; document.getElementById(`macros-name-${id}`).value = "";
document.getElementById(`macros-color-${id}`).value = "#ffffff"; document.getElementById(`macros-color-${id}`).value = "#ffffff";
this.$broadcast("gcode-clear");
}, },
resetConfig: async function () { resetConfig: async function () {
this.config.macros = [ this.config.macros = [

View File

@@ -10,7 +10,7 @@ script#macros-template(type="text/x-template")
button.pure-button.pure-button-primary(@click="resetConfig") button.pure-button.pure-button-primary(@click="resetConfig")
| Reset | Reset
h1 Macros Configuration 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 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 .fa.fa-rotate-right
.warning-box .warning-box
@@ -49,7 +49,7 @@ script#macros-template(type="text/x-template")
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: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 form.gcode-file-input.file-upload
input(type="file", @change="upload", :disabled="!is_ready", 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}} 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: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 form.gcode-file-input.file-upload
input(type="file", @change="upload", :disabled="!is_ready", 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}} 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: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 form.gcode-file-input.file-upload
input(type="file", @change="upload", :disabled="!is_ready", 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}} 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: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 form.gcode-file-input.file-upload
input(type="file", @change="upload", :disabled="!is_ready", 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}} 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: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 form.gcode-file-input.file-upload
input(type="file", @change="upload", :disabled="!is_ready", 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}} 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: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 form.gcode-file-input.file-upload
input(type="file", @change="upload", :disabled="!is_ready", input(type="file", @change="upload", :disabled="!is_ready",

View File

@@ -639,6 +639,8 @@ span.unit
margin-bottom 10px margin-bottom 10px
margin-top 10px margin-top 10px
align-items center align-items center
justify-content center
.tabs .tabs
margin-top 5px margin-top 5px