macrosList changes,
This commit is contained in:
@@ -71,7 +71,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
"state.selected_time": function () {
|
"state.selected_time": function () {
|
||||||
this.loadGCode();
|
this.load();
|
||||||
},
|
},
|
||||||
|
|
||||||
jog_step: function () {
|
jog_step: function () {
|
||||||
@@ -237,7 +237,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
ready: function () {
|
ready: function () {
|
||||||
this.loadGCode();
|
this.load();
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.current_time = new Date().toLocaleTimeString();
|
this.current_time = new Date().toLocaleTimeString();
|
||||||
@@ -280,7 +280,7 @@ module.exports = {
|
|||||||
this.$dispatch("send", msg);
|
this.$dispatch("send", msg);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadGCode: function () {
|
load: function () {
|
||||||
const file_time = this.state.selected_time;
|
const file_time = this.state.selected_time;
|
||||||
const file = this.state.selected;
|
const file = this.state.selected;
|
||||||
if (this.last_file == file && this.last_file_time == file_time) {
|
if (this.last_file == file && this.last_file_time == file_time) {
|
||||||
@@ -357,7 +357,7 @@ module.exports = {
|
|||||||
utils.clickFileInput("gcode-file-input");
|
utils.clickFileInput("gcode-file-input");
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadGCode: 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;
|
||||||
@@ -394,7 +394,6 @@ module.exports = {
|
|||||||
|
|
||||||
if (this.config.macrosList.some(obj => obj.file_name == file.name)) {
|
if (this.config.macrosList.some(obj => obj.file_name == file.name)) {
|
||||||
console.log("It is also a macros");
|
console.log("It is also a macros");
|
||||||
// this.config.gcodeList.push(file.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SvelteComponents.showDialog("Upload", {
|
SvelteComponents.showDialog("Upload", {
|
||||||
@@ -553,7 +552,7 @@ module.exports = {
|
|||||||
this.state.selected = this.config.macros[id].file_name; //TODO :get file
|
this.state.selected = this.config.macros[id].file_name; //TODO :get file
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.loadGCode();
|
this.load();
|
||||||
this.start_pause();
|
this.start_pause();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("Error running program: ", error);
|
console.warn("Error running program: ", error);
|
||||||
|
|||||||
@@ -15,32 +15,6 @@ module.exports = {
|
|||||||
deleteGCode: false,
|
deleteGCode: false,
|
||||||
selectedValues: ["default", "default", "default", "default", "default", "default", "default", "default"],
|
selectedValues: ["default", "default", "default", "default", "default", "default", "default", "default"],
|
||||||
newGcode: ["", "", "", "", "", "", "", ""],
|
newGcode: ["", "", "", "", "", "", "", ""],
|
||||||
defaultMacrosList: [
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file_name: "",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -85,7 +59,7 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
this.$set("newGcode[this.tab-1]", "");
|
this.$set("newGcode[this.tab-1]", "");
|
||||||
}
|
}
|
||||||
console.log("newGcode: ", this.newGcode[this.tab - 1]);
|
console.log("loaded GCode: ", this.newGcode[this.tab - 1]);
|
||||||
},
|
},
|
||||||
uploadMacrosGcode: async function (e) {
|
uploadMacrosGcode: async function (e) {
|
||||||
const files = e.target.files || e.dataTransfer.files;
|
const files = e.target.files || e.dataTransfer.files;
|
||||||
@@ -111,7 +85,7 @@ 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");
|
console.log("new gcode file for macros");
|
||||||
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);
|
||||||
@@ -163,7 +137,7 @@ 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 item");
|
console.log("new gcode uploaded for macros");
|
||||||
this.config.macrosList.push(gcodeData);
|
this.config.macrosList.push(gcodeData);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -209,10 +183,10 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
api.delete(`file/${this.selectedValues[this.tab - 1]}`);
|
api.delete(`file/${this.selectedValues[this.tab - 1]}`);
|
||||||
this.$set("newGcode[this.tab-1]", "");
|
this.$set("newGcode[this.tab-1]", "");
|
||||||
|
this.$set("this.selectedValues[this.tab - 1]", "default");
|
||||||
this.config.macrosList = this.config.macrosList.filter(
|
this.config.macrosList = this.config.macrosList.filter(
|
||||||
item => item.file_name !== this.selectedValues[this.tab - 1],
|
item => item.file_name !== this.selectedValues[this.tab - 1],
|
||||||
);
|
);
|
||||||
this.$set("this.selectedValues[this.tab - 1]", "default");
|
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
@@ -226,7 +200,7 @@ module.exports = {
|
|||||||
delete_all_macros: async function () {
|
delete_all_macros: async function () {
|
||||||
const macrosList = this.config.macrosList.map(item => item.file_name).toString();
|
const macrosList = this.config.macrosList.map(item => item.file_name).toString();
|
||||||
api.delete(`file/DINCAIQABiDARixAxiABDIHCAMQABiABDIHCAQQABiABDIH${macrosList}`);
|
api.delete(`file/DINCAIQABiDARixAxiABDIHCAMQABiABDIHCAQQABiABDIH${macrosList}`);
|
||||||
this.config.macrosList = this.defaultMacrosList;
|
this.config.macrosList = [];
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
@@ -286,6 +260,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
this.delete_all_macros();
|
this.delete_all_macros();
|
||||||
|
this.cancelMacros();
|
||||||
this.confirmReset = false;
|
this.confirmReset = false;
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
@@ -302,7 +277,7 @@ module.exports = {
|
|||||||
console.log(this.config);
|
console.log(this.config);
|
||||||
},
|
},
|
||||||
resetMacrosList: async function () {
|
resetMacrosList: async function () {
|
||||||
this.config.macrosList = this.defaultMacrosList;
|
this.config.macrosList = [];
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ script#control-view-template(type="text/x-template")
|
|||||||
.fa.fa-folder-open
|
.fa.fa-folder-open
|
||||||
|
|
||||||
form.gcode-file-input.file-upload
|
form.gcode-file-input.file-upload
|
||||||
input(type="file", @change="uploadGCode", :disabled="!is_ready",
|
input(type="file", @change="upload", :disabled="!is_ready",
|
||||||
accept=".nc,.ngc,.gcode,.gc")
|
accept=".nc,.ngc,.gcode,.gc")
|
||||||
|
|
||||||
a(:disabled="!state.selected", download,
|
a(:disabled="!state.selected", download,
|
||||||
@@ -303,7 +303,7 @@ script#control-view-template(type="text/x-template")
|
|||||||
| Selected
|
| Selected
|
||||||
|
|
||||||
select(title="Select previously uploaded GCode programs.",
|
select(title="Select previously uploaded GCode programs.",
|
||||||
v-model="state.selected", @change="loadGCode", :disabled="!is_ready",
|
v-model="state.selected", @change="load", :disabled="!is_ready",
|
||||||
style="max-width:100%")
|
style="max-width:100%")
|
||||||
option(v-for="file in gcodeFiles", :value="file") {{file}}
|
option(v-for="file in gcodeFiles", :value="file") {{file}}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ script#macros-template(type="text/x-template")
|
|||||||
| Selected
|
| Selected
|
||||||
|
|
||||||
h1 Macros Configuration
|
h1 Macros Configuration
|
||||||
button.pure-button(title="Reset Macros", @click="confirmReset=true",
|
button.delete-all-button(title="Reset Macros", @click="confirmReset=true") Delete All Macros
|
||||||
style="height:50px;width:170px;font-weight:normal;color:#fff;background-color:#5a9ad7;display:flex;align-items:center;justify-content:space-around") Delete All Macros
|
|
||||||
.fa.fa-rotate-right
|
.fa.fa-rotate-right
|
||||||
|
|
||||||
.tabs
|
.tabs
|
||||||
|
|||||||
@@ -644,6 +644,17 @@ span.unit
|
|||||||
border-radius 10px
|
border-radius 10px
|
||||||
border-color #424242
|
border-color #424242
|
||||||
border-style solid
|
border-style solid
|
||||||
|
|
||||||
|
.delete-all-button
|
||||||
|
height 50px
|
||||||
|
margin-bottom 1rem
|
||||||
|
width 190px
|
||||||
|
font-weight normal
|
||||||
|
color #fff
|
||||||
|
background-color #5a9ad7
|
||||||
|
display flex
|
||||||
|
align-items center
|
||||||
|
justify-content space-around
|
||||||
|
|
||||||
.new-gcode
|
.new-gcode
|
||||||
height 13rem
|
height 13rem
|
||||||
|
|||||||
Reference in New Issue
Block a user