save button disabling
This commit is contained in:
@@ -13,10 +13,16 @@ module.exports = {
|
||||
confirmReset: false,
|
||||
confirmSave: false,
|
||||
deleteGCode: false,
|
||||
edited: false,
|
||||
selectedValues: ["default", "default", "default", "default", "default", "default", "default", "default"],
|
||||
newGcode: ["", "", "", "", "", "", "", ""],
|
||||
};
|
||||
},
|
||||
events: {
|
||||
"macros-edited": function () {
|
||||
this.edited = true;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
mach_state: function () {
|
||||
const cycle = this.state.cycle;
|
||||
@@ -47,6 +53,7 @@ module.exports = {
|
||||
},
|
||||
updateNewGcode: function (event) {
|
||||
this.newGcode[this.tab - 1] = event.target.value;
|
||||
this.$dispatch("macros-edited");
|
||||
},
|
||||
loadMacrosGcode: async function () {
|
||||
const file = this.selectedValues[this.tab - 1];
|
||||
@@ -59,6 +66,7 @@ module.exports = {
|
||||
} else {
|
||||
this.$set("newGcode[this.tab-1]", "");
|
||||
}
|
||||
this.$dispatch("macros-edited");
|
||||
console.log("loaded GCode: ", this.newGcode[this.tab - 1]);
|
||||
},
|
||||
uploadMacrosGcode: async function (e) {
|
||||
@@ -99,6 +107,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
this.$set("selectedValues[this.tab - 1]", file.name);
|
||||
this.$dispatch("macros-edited");
|
||||
|
||||
SvelteComponents.showDialog("Upload", {
|
||||
file,
|
||||
@@ -169,6 +178,7 @@ module.exports = {
|
||||
this.confirmSave = false;
|
||||
try {
|
||||
await api.put("config/save", this.config);
|
||||
this.edited = false;
|
||||
console.log("Successfully saved");
|
||||
this.$dispatch("update");
|
||||
} catch (error) {
|
||||
@@ -213,7 +223,7 @@ module.exports = {
|
||||
const defaultValue = this.config.macros[this.tab - 1];
|
||||
document.getElementById(`macros-name-${this.tab - 1}`).value = defaultValue.name;
|
||||
document.getElementById(`macros-color-${this.tab - 1}`).value = defaultValue.color;
|
||||
document.getElementById(`gcodeSelect-${this.tab - 1}`).value = "default";
|
||||
this.$set("selectedValues[this.tab-1]", "default");
|
||||
this.$set("newGcode[this.tab-1]", "");
|
||||
},
|
||||
deleteAllMacros: async function () {
|
||||
|
||||
@@ -83,10 +83,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content2.tab-content
|
||||
.macros-form
|
||||
@@ -114,11 +111,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content3.tab-content
|
||||
.macros-form
|
||||
@@ -146,11 +139,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content4.tab-content
|
||||
.macros-form
|
||||
@@ -178,11 +167,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content5.tab-content
|
||||
.macros-form
|
||||
@@ -210,11 +195,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content6.tab-content
|
||||
.macros-form
|
||||
@@ -242,11 +223,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content7.tab-content
|
||||
.macros-form
|
||||
@@ -274,11 +251,7 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
section#content8.tab-content
|
||||
.macros-form
|
||||
@@ -306,15 +279,11 @@ script#macros-template(type="text/x-template")
|
||||
.fa.fa-trash
|
||||
br
|
||||
.gcodeContainer
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",
|
||||
style="height:50px;width:140px;font-weight:normal;background-color:#add1ad;color:#fff;border:0;margin-top:30px") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Cancel
|
||||
textarea.new-gcode( :value='newGcode[tab-1]' @input="updateNewGcode")
|
||||
|
||||
button.submit-macros(title="Cancel Macros",@click="printState",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Print State
|
||||
button.submit-macros(title="Cancel Macros",@click="printConfig",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Print Config
|
||||
button.submit-macros(title="Cancel Macros",@click="resetMacrosList",
|
||||
style="height:50px;width:140px;font-weight:normal;margin-left:5px;background-color:#f6f6f6;color:#000;border:0;margin-top:30px") Reset Macros List
|
||||
button.submit-macros(title="Save Macros",@click="confirmSave=true",:disabled="!edited") Save
|
||||
button.submit-macros(title="Cancel Macros",@click="cancelMacros",style="margin-left:5px") Cancel
|
||||
|
||||
button.submit-macros(title="Cancel Macros",@click="printState",style="margin-left:5px") Print State
|
||||
button.submit-macros(title="Cancel Macros",@click="printConfig",style="margin-left:5px") Print Config
|
||||
button.submit-macros(title="Cancel Macros",@click="resetMacrosList",style="margin-left:5px") Reset Macros List
|
||||
|
||||
Reference in New Issue
Block a user