delete selected GCode macros
This commit is contained in:
@@ -138,8 +138,10 @@ module.exports = {
|
|||||||
gcode_file_name: filename,
|
gcode_file_name: filename,
|
||||||
gcode_file_time: this.state.selected_time,
|
gcode_file_time: this.state.selected_time,
|
||||||
};
|
};
|
||||||
|
if(this.config.macrosList.some(item => item[gcode_file_name] !== filename)){
|
||||||
|
this.config.macrosList.push(gcodeData);
|
||||||
|
}
|
||||||
|
|
||||||
this.config.macrosList.push(gcodeData);
|
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
@@ -176,14 +178,21 @@ module.exports = {
|
|||||||
alert("Restore failed");
|
alert("Restore failed");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delete_current: function () {
|
delete_current: async function () {
|
||||||
console.log("delete a gcode");
|
console.log("delete a gcode");
|
||||||
// if(this.config.macrosList.find(item=>item.gcode_file_name==this.state.selected)==undefined){
|
if(this.selectedValues[this.tab - 1] == "default"){
|
||||||
// if (this.state.selected) {
|
this.$set("newGcode[this.tab-1]", "");
|
||||||
// api.delete(`file/${this.state.selected}`);
|
}else{
|
||||||
// }
|
api.delete(`file/${this.selectedValues[this.tab - 1]}`);
|
||||||
// }
|
this.config.macrosList = this.config.macrosList.filter(item=> item.gcode_file_name !== this.selectedValues[this.tab - 1])
|
||||||
|
try {
|
||||||
|
await api.put("config/save", this.config);
|
||||||
|
this.$dispatch("update");
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Restore Failed: ", error);
|
||||||
|
alert("Restore failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
this.deleteGCode = false;
|
this.deleteGCode = false;
|
||||||
},
|
},
|
||||||
delete_all_macros: async function () {
|
delete_all_macros: async function () {
|
||||||
|
|||||||
@@ -31,13 +31,9 @@ script#macros-template(type="text/x-template")
|
|||||||
| Selected
|
| Selected
|
||||||
|
|
||||||
h1 Macros Configuration
|
h1 Macros Configuration
|
||||||
.select-upload-gcode
|
button.pure-button(title="Reset Macros", @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
|
|
||||||
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
|
||||||
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around:margin-left:") Delete GCode
|
|
||||||
.fa.fa-trash
|
|
||||||
.warning-box
|
.warning-box
|
||||||
p
|
p
|
||||||
u Note:
|
u Note:
|
||||||
@@ -88,6 +84,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",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;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -118,6 +117,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -148,6 +150,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -178,6 +183,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -208,6 +216,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -238,6 +249,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -268,6 +282,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
@@ -298,6 +315,9 @@ script#macros-template(type="text/x-template")
|
|||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
button.pure-button(title="Delete Macros GCodes",@click="deleteGCode = true",
|
||||||
|
:disabled="!state.selected",style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around;margin-left:1rem") Delete GCode
|
||||||
|
.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")
|
||||||
|
|||||||
Reference in New Issue
Block a user