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