diff --git a/src/components/panels/Settings/ConfigFilesPanel.vue b/src/components/panels/Settings/ConfigFilesPanel.vue
index 5f818664..daf56270 100644
--- a/src/components/panels/Settings/ConfigFilesPanel.vue
+++ b/src/components/panels/Settings/ConfigFilesPanel.vue
@@ -30,9 +30,13 @@
Config Files
- mdi-file-plus
- mdi-folder-plus
- mdi-refresh
+
+
+ mdi-file-upload
+ mdi-file-plus
+ mdi-folder-plus
+ mdi-refresh
+
Current path: {{ this.currentPath === "" ? "/" : this.currentPath }}
empty
-
+
@@ -230,10 +234,18 @@
computed: {
...mapState({
filetree: state => state.files.filetree,
- countPerPage: state => state.gui.settings.configfiles.countPerPage,
hostname: state => state.socket.hostname,
port: state => state.socket.port,
- })
+ loadings: state => state.socket.loadings,
+ }),
+ countPerPage: {
+ get: function() {
+ return this.$store.state.gui.settings.configfiles.countPerPage
+ },
+ set: function(newVal) {
+ return this.$store.dispatch("gui/setSettings", { settings: { configfiles: { countPerPage: newVal } } });
+ }
+ },
},
created() {
this.loadPath();
@@ -427,6 +439,34 @@
deleteDirectoryAction: function() {
this.$socket.sendObj('server.files.delete_directory', { path: this.currentPath+"/"+this.contextMenu.item.filename }, 'files/getDeleteDir');
},
+ uploadFileButton: function() {
+ this.$refs.fileUpload.click()
+ },
+ uploadFile: function() {
+ if (this.$refs.fileUpload.files.length) {
+ this.doUploadFile(this.$refs.fileUpload.files[0]).finally(() => {
+ this.$refs.fileUpload.value = ''
+ })
+ }
+ },
+ doUploadFile: function(file) {
+ let toast = this.$toast;
+ let formData = new FormData();
+ let filename = file.name.replace(" ", "_");
+ formData.append('root', 'config');
+ formData.append('file', file, (this.currentPath+"/"+filename).substring(7));
+ this.$store.commit('socket/addLoading', { name: 'configFileUpload' });
+
+ return axios.post('//' + this.hostname + ':' + this.port + '/server/files/upload',
+ formData, { headers: { 'Content-Type': 'multipart/form-data' } }
+ ).then((result) => {
+ this.$store.commit('socket/removeLoading', { name: 'configFileUpload' });
+ toast.success("Upload of "+result.data.result+" successful!");
+ }).catch(() => {
+ this.$store.commit('socket/removeLoading', { name: 'configFileUpload' });
+ toast.error("Cannot upload the file!");
+ });
+ },
},
watch: {
config: {
@@ -445,7 +485,7 @@
handler() {
this.loadPath();
}
- },
+ }
}
}
diff --git a/src/pages/Files.vue b/src/pages/Files.vue
index 21787233..731a140d 100644
--- a/src/pages/Files.vue
+++ b/src/pages/Files.vue
@@ -53,24 +53,26 @@
G-Code Files
- mdi-folder-plus new Directory
- mdi-refresh Refresh
- mdi-uploadUpload
-
-
- mdi-cog
-
-
-
-
-
-
-
-
-
-
-
+
+ mdi-upload
+ mdi-folder-plus
+ mdi-refresh
+
+
+ mdi-cog
+
+
+
+
+
+
+
+
+
+
+
+
Current path: {{ this.currentPath !== 'gcodes' ? "/"+this.currentPath.substring(7) : "/" }}
@@ -90,7 +92,7 @@
:custom-sort="sortFiles"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
- :items-per-page="countPerPage"
+ :items-per-page.sync="countPerPage"
item-key="name"
:search="search"
:custom-filter="advancedSearch"
@@ -298,7 +300,6 @@
computed: {
...mapState({
filetree: state => state.files.filetree,
- countPerPage: state => state.gui.gcodefiles.countPerPage,
hostname: state => state.socket.hostname,
port: state => state.socket.port,
loadings: state => state.socket.loadings,
@@ -319,9 +320,17 @@
return this.$store.state.gui.gcodefiles.showHiddenFiles;
},
set: function(newVal) {
- return this.$store.dispatch("gui/setGcodefilesShowHiddenFiles", newVal);
+ return this.$store.dispatch("gui/setSettings", { gcodefiles: { showHiddenFiles: newVal } });
}
- }
+ },
+ countPerPage: {
+ get: function() {
+ return this.$store.state.gui.gcodefiles.countPerPage
+ },
+ set: function(newVal) {
+ return this.$store.dispatch("gui/setSettings", { gcodefiles: { countPerPage: newVal } });
+ }
+ },
},
created() {
this.loadPath()
diff --git a/src/store/files/actions.js b/src/store/files/actions.js
index 595a6302..041960f5 100644
--- a/src/store/files/actions.js
+++ b/src/store/files/actions.js
@@ -12,7 +12,8 @@ export default {
getMetadata({ commit, rootState }, payload) {
if (payload !== undefined && payload.filename !== "") {
if (payload.filename === rootState.printer.print_stats.filename) {
- this.commit('getMetadataCurrentFile', payload);
+ commit('printer/clearCurrentFile', null, { root: true });
+ commit('printer/setData', { current_file: payload }, { root: true });
}
commit('setMetadata', payload);
diff --git a/src/store/gui/mutations.js b/src/store/gui/mutations.js
index 21d590cc..18d20945 100644
--- a/src/store/gui/mutations.js
+++ b/src/store/gui/mutations.js
@@ -33,7 +33,6 @@ export default {
Vue.set(state.gcodefiles.showMetadata, data.name, data.value)
},
-
setGcodefilesShowHiddenFiles(state, value) {
Vue.set(state.gcodefiles, "showHiddenFiles", value)
},