Fixed mainaining state while deleting, removed time from config
This commit is contained in:
@@ -22,18 +22,18 @@ module.exports = {
|
||||
speed_override: 1,
|
||||
feed_override: 1,
|
||||
jog_incr_amounts: {
|
||||
"METRIC": {
|
||||
METRIC: {
|
||||
fine: 0.1,
|
||||
small: 1.0,
|
||||
medium: 10,
|
||||
large: 100,
|
||||
},
|
||||
"IMPERIAL": {
|
||||
IMPERIAL: {
|
||||
fine: 0.005,
|
||||
small: 0.05,
|
||||
medium: 0.5,
|
||||
large: 5,
|
||||
}
|
||||
},
|
||||
},
|
||||
jog_incr: localStorage.getItem("jog_incr") || "small",
|
||||
jog_step: cookie.get_bool("jog-step"),
|
||||
@@ -48,7 +48,7 @@ module.exports = {
|
||||
components: {
|
||||
"axis-control": require("./axis-control"),
|
||||
"path-viewer": require("./path-viewer"),
|
||||
"gcode-viewer": require("./gcode-viewer")
|
||||
"gcode-viewer": require("./gcode-viewer"),
|
||||
},
|
||||
|
||||
watch: {
|
||||
@@ -58,11 +58,9 @@ module.exports = {
|
||||
|
||||
"state.metric": {
|
||||
handler: function (metric) {
|
||||
this.mach_units = metric
|
||||
? "METRIC"
|
||||
: "IMPERIAL";
|
||||
this.mach_units = metric ? "METRIC" : "IMPERIAL";
|
||||
},
|
||||
immediate: true
|
||||
immediate: true,
|
||||
},
|
||||
|
||||
"state.line": function () {
|
||||
@@ -81,7 +79,7 @@ module.exports = {
|
||||
|
||||
jog_adjust: function () {
|
||||
cookie.set("jog-adjust", this.jog_adjust);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -94,7 +92,7 @@ module.exports = {
|
||||
this.config.settings.units = value;
|
||||
this.$root.display_units = value;
|
||||
this.$dispatch("config-changed");
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
metric: function () {
|
||||
@@ -203,14 +201,16 @@ module.exports = {
|
||||
return Math.min(1, p);
|
||||
},
|
||||
gcodeFiles: function () {
|
||||
const filesWithNoMacros=this.state.files.filter(item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name == item));
|
||||
console.log('filesWithNoMacros: ',filesWithNoMacros);
|
||||
console.log("this.state.GCodeList",this.state.GCodeList)
|
||||
const filesWithNoMacros = this.state.files.filter(
|
||||
item => !this.config.macrosList.some(compareItem => compareItem.gcode_file_name == item),
|
||||
);
|
||||
console.log("filesWithNoMacros: ", filesWithNoMacros);
|
||||
console.log("this.state.GCodeList", this.state.GCodeList);
|
||||
const unionSet = new Set([...filesWithNoMacros, ...this.state.GCodeList]);
|
||||
const files = [...unionSet];
|
||||
console.log("files: ", files);
|
||||
return files;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
events: {
|
||||
@@ -244,10 +244,10 @@ module.exports = {
|
||||
SvelteComponents.registerControllerMethods({
|
||||
stop: (...args) => this.stop(...args),
|
||||
send: (...args) => this.send(...args),
|
||||
isAxisHomed: (axis) => this[axis].homed,
|
||||
isAxisHomed: axis => this[axis].homed,
|
||||
unhome: (...args) => this.unhome(...args),
|
||||
set_position: (...args) => this.set_position(...args),
|
||||
set_home: (...args) => this.set_home(...args)
|
||||
set_home: (...args) => this.set_home(...args),
|
||||
});
|
||||
},
|
||||
|
||||
@@ -375,9 +375,9 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
|
||||
const isAlreadyPresent = this.state.GCodeList.find((element) => element == file.name);
|
||||
const isAlreadyPresent = this.state.GCodeList.find(element => element == file.name);
|
||||
if (isAlreadyPresent == undefined) {
|
||||
console.log('new gcode file');
|
||||
console.log("new gcode file");
|
||||
this.state.GCodeList.push(file.name);
|
||||
try {
|
||||
await api.put("config/save", this.config);
|
||||
@@ -387,11 +387,11 @@ module.exports = {
|
||||
alert("Restore failed");
|
||||
}
|
||||
} else {
|
||||
console.log('Already exists');
|
||||
console.log("Already exists");
|
||||
}
|
||||
|
||||
if (this.config.macrosList.some(obj => obj.gcode_file_name == file.name)) {
|
||||
console.log("It is a macros, remove it from macrosList")
|
||||
console.log("It is a macros, remove it from macrosList");
|
||||
// this.config.GCodeList.push(file.name);
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ module.exports = {
|
||||
onComplete: () => {
|
||||
this.last_file_time = undefined; // Force reload
|
||||
this.$broadcast("gcode-reload", file.name);
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@@ -410,7 +410,7 @@ module.exports = {
|
||||
api.delete(`file/${this.state.selected}`);
|
||||
}
|
||||
} else {
|
||||
this.state.GCodeList.filter(item=>item!=this.state.selected);
|
||||
this.state.GCodeList = this.state.GCodeList.filter(item => item != this.state.selected);
|
||||
}
|
||||
|
||||
this.deleteGCode = false;
|
||||
@@ -461,7 +461,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
set_position: function (axis, position) {
|
||||
api.put(`position/${axis}`, { "position": parseFloat(position) });
|
||||
api.put(`position/${axis}`, { position: parseFloat(position) });
|
||||
},
|
||||
|
||||
zero_all: function () {
|
||||
@@ -537,9 +537,12 @@ module.exports = {
|
||||
SvelteComponents.showDialog("Probe", { probeType });
|
||||
},
|
||||
runMacros: function (id) {
|
||||
if( this.config.macros[id].gcode_file_name != this.state.selected || this.config.macros[id].gcode_file_time != this.state.selected_time ){
|
||||
if (
|
||||
this.config.macros[id].gcode_file_name != this.state.selected ||
|
||||
this.config.macros[id].gcode_file_time != this.state.selected_time
|
||||
) {
|
||||
this.state.selected = this.config.macros[id].gcode_file_name;
|
||||
this.state.selected_time=this.config.macros[id].gcode_file_time
|
||||
this.state.selected_time = this.config.macros[id].gcode_file_time;
|
||||
}
|
||||
try {
|
||||
this.loadGCode();
|
||||
@@ -550,5 +553,5 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
|
||||
mixins: [ require("./axis-vars") ]
|
||||
mixins: [require("./axis-vars")],
|
||||
};
|
||||
|
||||
@@ -145,9 +145,9 @@ module.exports = {
|
||||
file,
|
||||
onComplete: () => {
|
||||
this.last_file_time = undefined; // Force reload
|
||||
this.loadMacrosGcode();
|
||||
},
|
||||
});
|
||||
this.loadMacrosGcode();
|
||||
},
|
||||
uploadGCode: async function (filename, file) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
@@ -681,13 +681,7 @@
|
||||
"gcode_file_name": "TurnOffVac.ngc",
|
||||
"gcode_file_time": 1705008395.476232
|
||||
}
|
||||
],
|
||||
"template": {
|
||||
"gcode_file_time": {
|
||||
"type": "int",
|
||||
"default": 1705008395
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"admin": {
|
||||
|
||||
Reference in New Issue
Block a user