removed logs and test buttons

This commit is contained in:
sanjayk03-dev
2024-01-30 15:01:48 +05:30
parent b2be2310d8
commit 5d28903aca
3 changed files with 3 additions and 51 deletions

View File

@@ -206,12 +206,9 @@ module.exports = {
const filesWithNoMacros = this.state.files.filter(
item => !this.config.macrosList.some(compareItem => compareItem.file_name == item),
);
console.log("filesWithNoMacros: ", filesWithNoMacros);
console.log("this.config.gcodeList", this.config.gcodeList);
const gcodelist = this.config.gcodeList.map(item => item.file_name);
const unionSet = new Set([...filesWithNoMacros, ...gcodelist]);
const files = [...unionSet].sort();
console.log("final files: ", files);
return files;
},
},
@@ -288,13 +285,9 @@ module.exports = {
return;
}
console.log("file: ", file, " time: ", file_time);
this.last_file = file;
this.last_file_time = file_time;
console.log("loading file: ", file);
this.$broadcast("gcode-load", file);
this.$broadcast("gcode-line", this.state.line);
this.toolpath_progress = 0;
@@ -382,7 +375,6 @@ module.exports = {
const isAlreadyPresent = this.config.gcodeList.find(element => element.file_name == file.name);
if (isAlreadyPresent == undefined) {
console.log("new gcode file");
this.config.gcodeList.push({ file_name: file.name });
try {
await api.put("config/save", this.config);
@@ -392,11 +384,7 @@ module.exports = {
alert("Restore failed");
}
} else {
console.log("Already exists");
}
if (this.config.macrosList.some(obj => obj.file_name == file.name)) {
console.log("It is also a macros");
//
}
SvelteComponents.showDialog("Upload", {
@@ -549,7 +537,6 @@ module.exports = {
SvelteComponents.showDialog("Probe", { probeType });
},
runMacros: function (id) {
console.log("index", id);
if (this.config.macros[id].file_name == "default") {
this.showNoGcodeMessage = true;
} else {
@@ -559,7 +546,6 @@ module.exports = {
try {
this.load();
this.macrosLoading = true;
// this.start_pause();
} catch (error) {
console.warn("Error running program: ", error);
}

View File

@@ -87,19 +87,16 @@ module.exports = {
const response = await fetch(`/api/file/EgZjaHJvbWUqCggBEAAYsQMYgAQyBggAEEUYOTIKCAE${file}`, {
cache: "no-cache",
});
console.log("response status: ", response.status);
if (response.status == 200) {
const text = (await response.text()).split(" ").join("\n");
console.log("text: ", text);
this.newGcode = text;
} else {
console.log("error loading");
console.error("error loading");
}
} else {
this.newGcode = "";
}
this.$dispatch("macros-edited");
console.log("loaded GCode: ", this.newGcode);
},
uploadMacrosGcode: async function (e) {
const files = e.target.files || e.dataTransfer.files;
@@ -125,7 +122,6 @@ module.exports = {
file_name: file.name,
};
if (!this.config.macrosList.some(item => item.file_name == file.name)) {
console.log("new gcode file for macros");
this.fileName = file.name;
this.config.macrosList.push(gcodeData);
try {
@@ -136,10 +132,9 @@ module.exports = {
alert("Restore failed");
}
} else {
console.log("Already exists");
//
}
this.$dispatch("macros-edited");
console.log("file.name", file.name);
try {
await this.showDialogAsync("Upload", file);
this.loadMacrosGcode();
@@ -176,7 +171,6 @@ module.exports = {
file_name: filename,
};
if (!this.config.macrosList.some(item => item.file_name == filename)) {
console.log("new gcode uploaded for macros");
this.config.macrosList.push(gcodeData);
}
},
@@ -189,7 +183,6 @@ module.exports = {
macros.splice(this.tab - 1, 1);
const macrosList = macros.map(item => item.name);
var macrosName = document.getElementById("macros-name").value;
console.log("Macros Name: ", this.macrosName);
var macrosColor = document.getElementById("macros-color").value;
if (macrosList.includes(macrosName)) {
this.sameName = true;
@@ -197,9 +190,6 @@ module.exports = {
return;
}
console.log(" this.state.selected && time: ", this.state.selected, this.state.selected_time);
console.log("selectedValues: ", this.config.macros[this.tab - 1].file_name);
var file_name = this.fileName == "default" ? macrosName + ".ngc" : this.fileName;
var file = this.newGcode;
@@ -208,7 +198,6 @@ module.exports = {
this.config.macros[this.tab - 1].name = macrosName;
this.config.macros[this.tab - 1].color = macrosColor;
this.config.macros[this.tab - 1].file_name = file_name;
console.log("config.macros[this.tab - 1].file_name", this.config.macros[this.tab - 1].file_name);
this.confirmSave = false;
try {
await api.put("config/save", this.config);
@@ -219,11 +208,9 @@ module.exports = {
alert("Restore failed");
}
this.edited = false;
console.log("tab in saveMacros:", this.tab);
},
delete_current: async function () {
const filename = this.fileName;
console.log("delete a gcode");
if (filename == "default") {
this.newGcode = "";
} else {
@@ -318,23 +305,6 @@ module.exports = {
alert("Restore failed");
}
},
printState: function () {
console.log(this.state);
},
printConfig: function () {
console.log(this.config);
console.log(this.newGcode);
},
resetMacrosList: async function () {
this.config.macrosList = [];
try {
await api.put("config/save", this.config);
this.$dispatch("update");
} catch (error) {
console.error("Restore Failed: ", error);
alert("Restore failed");
}
},
addNewMacros: async function () {
const length = this.config.macros.length;
if (length >= 20) {

View File

@@ -106,7 +106,3 @@ script#macros-template(type="text/x-template")
button.submit-macros.button-submit(title="Save Macros",@click="confirmSave=true",:disabled="!edited") Save
button.submit-macros(title="Cancel Macros",@click="clearMacros",style="margin-left:5px;background-color:#fafafa;",:disabled="initial_tab") 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