saving folderdata in config
This commit is contained in:
@@ -384,6 +384,10 @@ module.exports = {
|
|||||||
const isAlreadyPresent = this.config.non_macros_list.find(element => element.file_name == file.name);
|
const isAlreadyPresent = this.config.non_macros_list.find(element => element.file_name == file.name);
|
||||||
if (isAlreadyPresent == undefined) {
|
if (isAlreadyPresent == undefined) {
|
||||||
this.config.non_macros_list.push({ file_name: file.name });
|
this.config.non_macros_list.push({ file_name: file.name });
|
||||||
|
}
|
||||||
|
if (this.config.gcode_list.find(item => item.name == file.name && item.type == "file") == undefined) {
|
||||||
|
this.config.gcode_list.push({ name: file.name, type: "file", files: [] });
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
@@ -391,7 +395,6 @@ module.exports = {
|
|||||||
console.error("Restore Failed: ", error);
|
console.error("Restore Failed: ", error);
|
||||||
alert("Restore failed");
|
alert("Restore failed");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SvelteComponents.showDialog("Upload", {
|
SvelteComponents.showDialog("Upload", {
|
||||||
file,
|
file,
|
||||||
@@ -427,6 +430,21 @@ module.exports = {
|
|||||||
const isAlreadyPresent = this.config.non_macros_list.find(element => element.file_name == file.name);
|
const isAlreadyPresent = this.config.non_macros_list.find(element => element.file_name == file.name);
|
||||||
if (isAlreadyPresent == undefined) {
|
if (isAlreadyPresent == undefined) {
|
||||||
this.config.non_macros_list.push({ file_name: file.name });
|
this.config.non_macros_list.push({ file_name: file.name });
|
||||||
|
}
|
||||||
|
const folder = this.config.gcode_list.find(item => item.type == "folder" && item.name == folderName);
|
||||||
|
if (folder) {
|
||||||
|
folder.files.push({ file_name: file.name });
|
||||||
|
} else {
|
||||||
|
this.config.gcode_list.push({
|
||||||
|
name: folderName,
|
||||||
|
type: "folder",
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
file_name: file.name,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await api.put("config/save", this.config);
|
await api.put("config/save", this.config);
|
||||||
this.$dispatch("update");
|
this.$dispatch("update");
|
||||||
@@ -434,7 +452,6 @@ module.exports = {
|
|||||||
console.error("Restore Failed: ", error);
|
console.error("Restore Failed: ", error);
|
||||||
alert("Restore failed");
|
alert("Restore failed");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SvelteComponents.showDialog("Upload", {
|
SvelteComponents.showDialog("Upload", {
|
||||||
file,
|
file,
|
||||||
|
|||||||
@@ -627,6 +627,32 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"gcode_list": {
|
||||||
|
"type": "list",
|
||||||
|
"default": [],
|
||||||
|
"template": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "enum",
|
||||||
|
"values": ["file", "folder"],
|
||||||
|
"default": "folder"
|
||||||
|
},
|
||||||
|
"files": {
|
||||||
|
"type": "list",
|
||||||
|
"default": [],
|
||||||
|
"template": {
|
||||||
|
"file_name": {
|
||||||
|
"type": "string",
|
||||||
|
"default": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"admin": {
|
"admin": {
|
||||||
"auto-check-upgrade": {
|
"auto-check-upgrade": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|||||||
Reference in New Issue
Block a user