removed logs and test buttons
This commit is contained in:
@@ -206,12 +206,9 @@ module.exports = {
|
|||||||
const filesWithNoMacros = this.state.files.filter(
|
const filesWithNoMacros = this.state.files.filter(
|
||||||
item => !this.config.macrosList.some(compareItem => compareItem.file_name == item),
|
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 gcodelist = this.config.gcodeList.map(item => item.file_name);
|
||||||
const unionSet = new Set([...filesWithNoMacros, ...gcodelist]);
|
const unionSet = new Set([...filesWithNoMacros, ...gcodelist]);
|
||||||
const files = [...unionSet].sort();
|
const files = [...unionSet].sort();
|
||||||
console.log("final files: ", files);
|
|
||||||
return files;
|
return files;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -288,13 +285,9 @@ module.exports = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("file: ", file, " time: ", file_time);
|
|
||||||
|
|
||||||
this.last_file = file;
|
this.last_file = file;
|
||||||
this.last_file_time = file_time;
|
this.last_file_time = file_time;
|
||||||
|
|
||||||
console.log("loading file: ", file);
|
|
||||||
|
|
||||||
this.$broadcast("gcode-load", file);
|
this.$broadcast("gcode-load", file);
|
||||||
this.$broadcast("gcode-line", this.state.line);
|
this.$broadcast("gcode-line", this.state.line);
|
||||||
this.toolpath_progress = 0;
|
this.toolpath_progress = 0;
|
||||||
@@ -382,7 +375,6 @@ module.exports = {
|
|||||||
|
|
||||||
const isAlreadyPresent = this.config.gcodeList.find(element => element.file_name == file.name);
|
const isAlreadyPresent = this.config.gcodeList.find(element => element.file_name == file.name);
|
||||||
if (isAlreadyPresent == undefined) {
|
if (isAlreadyPresent == undefined) {
|
||||||
console.log("new gcode file");
|
|
||||||
this.config.gcodeList.push({ file_name: file.name });
|
this.config.gcodeList.push({ file_name: file.name });
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
@@ -392,11 +384,7 @@ module.exports = {
|
|||||||
alert("Restore failed");
|
alert("Restore failed");
|
||||||
}
|
}
|
||||||
} else {
|
} 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", {
|
SvelteComponents.showDialog("Upload", {
|
||||||
@@ -549,7 +537,6 @@ module.exports = {
|
|||||||
SvelteComponents.showDialog("Probe", { probeType });
|
SvelteComponents.showDialog("Probe", { probeType });
|
||||||
},
|
},
|
||||||
runMacros: function (id) {
|
runMacros: function (id) {
|
||||||
console.log("index", id);
|
|
||||||
if (this.config.macros[id].file_name == "default") {
|
if (this.config.macros[id].file_name == "default") {
|
||||||
this.showNoGcodeMessage = true;
|
this.showNoGcodeMessage = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -559,7 +546,6 @@ module.exports = {
|
|||||||
try {
|
try {
|
||||||
this.load();
|
this.load();
|
||||||
this.macrosLoading = true;
|
this.macrosLoading = true;
|
||||||
// this.start_pause();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("Error running program: ", error);
|
console.warn("Error running program: ", error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,19 +87,16 @@ module.exports = {
|
|||||||
const response = await fetch(`/api/file/EgZjaHJvbWUqCggBEAAYsQMYgAQyBggAEEUYOTIKCAE${file}`, {
|
const response = await fetch(`/api/file/EgZjaHJvbWUqCggBEAAYsQMYgAQyBggAEEUYOTIKCAE${file}`, {
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
});
|
});
|
||||||
console.log("response status: ", response.status);
|
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
const text = (await response.text()).split(" ").join("\n");
|
const text = (await response.text()).split(" ").join("\n");
|
||||||
console.log("text: ", text);
|
|
||||||
this.newGcode = text;
|
this.newGcode = text;
|
||||||
} else {
|
} else {
|
||||||
console.log("error loading");
|
console.error("error loading");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.newGcode = "";
|
this.newGcode = "";
|
||||||
}
|
}
|
||||||
this.$dispatch("macros-edited");
|
this.$dispatch("macros-edited");
|
||||||
console.log("loaded GCode: ", this.newGcode);
|
|
||||||
},
|
},
|
||||||
uploadMacrosGcode: async function (e) {
|
uploadMacrosGcode: async function (e) {
|
||||||
const files = e.target.files || e.dataTransfer.files;
|
const files = e.target.files || e.dataTransfer.files;
|
||||||
@@ -125,7 +122,6 @@ module.exports = {
|
|||||||
file_name: file.name,
|
file_name: file.name,
|
||||||
};
|
};
|
||||||
if (!this.config.macrosList.some(item => item.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.fileName = file.name;
|
||||||
this.config.macrosList.push(gcodeData);
|
this.config.macrosList.push(gcodeData);
|
||||||
try {
|
try {
|
||||||
@@ -136,10 +132,9 @@ module.exports = {
|
|||||||
alert("Restore failed");
|
alert("Restore failed");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("Already exists");
|
//
|
||||||
}
|
}
|
||||||
this.$dispatch("macros-edited");
|
this.$dispatch("macros-edited");
|
||||||
console.log("file.name", file.name);
|
|
||||||
try {
|
try {
|
||||||
await this.showDialogAsync("Upload", file);
|
await this.showDialogAsync("Upload", file);
|
||||||
this.loadMacrosGcode();
|
this.loadMacrosGcode();
|
||||||
@@ -176,7 +171,6 @@ module.exports = {
|
|||||||
file_name: filename,
|
file_name: filename,
|
||||||
};
|
};
|
||||||
if (!this.config.macrosList.some(item => item.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);
|
this.config.macrosList.push(gcodeData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -189,7 +183,6 @@ module.exports = {
|
|||||||
macros.splice(this.tab - 1, 1);
|
macros.splice(this.tab - 1, 1);
|
||||||
const macrosList = macros.map(item => item.name);
|
const macrosList = macros.map(item => item.name);
|
||||||
var macrosName = document.getElementById("macros-name").value;
|
var macrosName = document.getElementById("macros-name").value;
|
||||||
console.log("Macros Name: ", this.macrosName);
|
|
||||||
var macrosColor = document.getElementById("macros-color").value;
|
var macrosColor = document.getElementById("macros-color").value;
|
||||||
if (macrosList.includes(macrosName)) {
|
if (macrosList.includes(macrosName)) {
|
||||||
this.sameName = true;
|
this.sameName = true;
|
||||||
@@ -197,9 +190,6 @@ module.exports = {
|
|||||||
return;
|
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_name = this.fileName == "default" ? macrosName + ".ngc" : this.fileName;
|
||||||
var file = this.newGcode;
|
var file = this.newGcode;
|
||||||
|
|
||||||
@@ -208,7 +198,6 @@ module.exports = {
|
|||||||
this.config.macros[this.tab - 1].name = macrosName;
|
this.config.macros[this.tab - 1].name = macrosName;
|
||||||
this.config.macros[this.tab - 1].color = macrosColor;
|
this.config.macros[this.tab - 1].color = macrosColor;
|
||||||
this.config.macros[this.tab - 1].file_name = file_name;
|
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;
|
this.confirmSave = false;
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
@@ -219,11 +208,9 @@ module.exports = {
|
|||||||
alert("Restore failed");
|
alert("Restore failed");
|
||||||
}
|
}
|
||||||
this.edited = false;
|
this.edited = false;
|
||||||
console.log("tab in saveMacros:", this.tab);
|
|
||||||
},
|
},
|
||||||
delete_current: async function () {
|
delete_current: async function () {
|
||||||
const filename = this.fileName;
|
const filename = this.fileName;
|
||||||
console.log("delete a gcode");
|
|
||||||
if (filename == "default") {
|
if (filename == "default") {
|
||||||
this.newGcode = "";
|
this.newGcode = "";
|
||||||
} else {
|
} else {
|
||||||
@@ -318,23 +305,6 @@ module.exports = {
|
|||||||
alert("Restore failed");
|
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 () {
|
addNewMacros: async function () {
|
||||||
const length = this.config.macros.length;
|
const length = this.config.macros.length;
|
||||||
if (length >= 20) {
|
if (length >= 20) {
|
||||||
|
|||||||
@@ -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.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="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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user