naming conventions

This commit is contained in:
sanjayk03-dev
2024-03-29 01:22:01 +05:30
parent d129c0290c
commit ab186be3ea
2 changed files with 10 additions and 12 deletions

View File

@@ -60,7 +60,7 @@ module.exports = {
open: function () { open: function () {
utils.clickFileInput("gcode-file-input"); utils.clickFileInput("gcode-file-input");
}, },
updateNewGcode: function (event) { update_new_gcode: function (event) {
if (this.tab != 0) { if (this.tab != 0) {
this.newGcode = event.target.value; this.newGcode = event.target.value;
this.$dispatch("macros-edited"); this.$dispatch("macros-edited");
@@ -93,7 +93,7 @@ module.exports = {
}); });
}); });
}, },
loadMacrosGcode: async function () { load: async function () {
if (this.tab == 0) { if (this.tab == 0) {
return; return;
} }
@@ -115,7 +115,7 @@ module.exports = {
this.$dispatch("macros-edited"); this.$dispatch("macros-edited");
} }
}, },
uploadMacrosGcode: async function (e) { upload: async function (e) {
const files = e.target.files || e.dataTransfer.files; const files = e.target.files || e.dataTransfer.files;
if (!files.length) { if (!files.length) {
return; return;
@@ -148,18 +148,16 @@ module.exports = {
console.error("Restore Failed: ", error); console.error("Restore Failed: ", error);
alert("Restore failed"); alert("Restore failed");
} }
} else {
//
} }
this.$dispatch("macros-edited"); this.$dispatch("macros-edited");
try { try {
await this.showDialogAsync("Upload", file); await this.showDialogAsync("Upload", file);
this.loadMacrosGcode(); this.load();
} catch (error) { } catch (error) {
console.error("Error uploading: ", error); console.error("Error uploading: ", error);
} }
}, },
uploadGCode: async function (filename, file) { upload_gcode: async function (filename, file) {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.onload = function () { xhr.onload = function () {
@@ -217,7 +215,7 @@ module.exports = {
var file = this.newGcode; var file = this.newGcode;
if (file.trim() != "") { if (file.trim() != "") {
this.uploadGCode(file_name, file); this.upload_gcode(file_name, file);
} }
this.config.macros[this.tab - 1].name = this.macrosName; this.config.macros[this.tab - 1].name = this.macrosName;
@@ -269,7 +267,7 @@ module.exports = {
document.getElementById("macros-color").value = defaultValue.color; document.getElementById("macros-color").value = defaultValue.color;
this.isChecked = defaultValue.alert; this.isChecked = defaultValue.alert;
this.fileName = defaultValue.file_name; this.fileName = defaultValue.file_name;
this.loadMacrosGcode(); this.load();
} }
this.edited = false; this.edited = false;
}, },

View File

@@ -88,7 +88,7 @@ script#macros-template(type="text/x-template")
p.title Macro G-Code p.title Macro G-Code
.flex-row-container .flex-row-container
select(id="gcode-select",title="Select previously uploaded GCode programs.",selected select(id="gcode-select",title="Select previously uploaded GCode programs.",selected
v-model="fileName",@change="loadMacrosGcode", :disabled="!is_ready", v-model="fileName",@change="load", :disabled="!is_ready",
style="max-width:100%;height:40px;border-radius:5px") style="max-width:100%;height:40px;border-radius:5px")
option( selected='' value='default') Create G-Code option( selected='' value='default') Create G-Code
option(v-for="file in macros_gcode_list", :value="file") {{file}} option(v-for="file in macros_gcode_list", :value="file") {{file}}
@@ -98,14 +98,14 @@ script#macros-template(type="text/x-template")
.fa.fa-upload .fa.fa-upload
form.gcode-file-input.file-upload form.gcode-file-input.file-upload
input(type="file", @change="uploadMacrosGcode", :disabled="!is_ready", input(type="file", @change="upload", :disabled="!is_ready",
accept=".nc,.ngc,.gcode,.gc") accept=".nc,.ngc,.gcode,.gc")
button.config-button.button-blue(title="Delete Macro GCode",@click="deleteGCode = true", button.config-button.button-blue(title="Delete Macro GCode",@click="deleteGCode = true",
:disabled="!fileName =='default'") Delete :disabled="!fileName =='default'") Delete
.fa.fa-trash .fa.fa-trash
br br
.gcodeContainer .gcodeContainer
textarea.new-gcode(id="gcode-field", v-model="newGcode" ,@keypress="updateNewGcode") textarea.new-gcode(id="gcode-field", v-model="newGcode" ,@keypress="update_new_gcode")
button.submit-macros.button-success(title="Save Macro",@click="confirmSave=true",:disabled="!edited") Save button.submit-macros.button-success(title="Save Macro",@click="confirmSave=true",:disabled="!edited") Save
button.submit-macros(title="Cancel Macro",@click="clear_macro",style="margin-left:5px;background-color:#fafafa;",:disabled="initial_tab") Cancel button.submit-macros(title="Cancel Macro",@click="clear_macro",style="margin-left:5px;background-color:#fafafa;",:disabled="initial_tab") Cancel