+ mdi-downloadKlipper Log
+ mdi-downloadMoonraker Log
mdi-cachedRestart
- mdi-cachedFW Restart
- mdi-cachedHost Restart
- mdi-powerHost Shutdown
+ mdi-cachedFW Restart
+ mdi-cachedHost Restart
+ mdi-powerHost Shutdown
diff --git a/src/components/panels/ZOffsetPanel.vue b/src/components/panels/ZOffsetPanel.vue
index 1e44329a..f34ec5ec 100644
--- a/src/components/panels/ZOffsetPanel.vue
+++ b/src/components/panels/ZOffsetPanel.vue
@@ -54,13 +54,13 @@
let gcode = "SET_GCODE_OFFSET Z_ADJUST=-0.05 MOVE=1";
this.$store.commit('setLoading', { name: 'babySteppingDown' });
this.$store.commit('addGcodeResponse', gcode);
- Vue.prototype.$socket.sendObj('post_printer_gcode', { script: gcode }, "respondeBabySteppingDown");
+ Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "respondeBabySteppingDown");
},
sendBabySteppingUp() {
let gcode = "SET_GCODE_OFFSET Z_ADJUST=0.05 MOVE=1";
this.$store.commit('setLoading', { name: 'babySteppingUp' });
this.$store.commit('addGcodeResponse', gcode);
- Vue.prototype.$socket.sendObj('post_printer_gcode', { script: gcode }, "respondeBabySteppingUp");
+ Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: gcode }, "respondeBabySteppingUp");
},
},
watch: {
diff --git a/src/inputs/SettingsRunoutSwitch.vue b/src/inputs/SettingsRunoutSwitch.vue
index 2ace6ed4..c7530179 100644
--- a/src/inputs/SettingsRunoutSwitch.vue
+++ b/src/inputs/SettingsRunoutSwitch.vue
@@ -42,7 +42,7 @@
},
methods: {
changeSensor() {
- this.$socket.sendObj('post_printer_gcode', { script: 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.enabled ? 0 : 1) });
+ this.$socket.sendObj('post_printer_gcode_script', { script: 'SET_FILAMENT_SENSOR SENSOR='+this.name+' ENABLE='+(this.enabled ? 0 : 1) });
}
},
watch: {
diff --git a/src/inputs/ToolInput.vue b/src/inputs/ToolInput.vue
index e5653715..fbe97a6d 100644
--- a/src/inputs/ToolInput.vue
+++ b/src/inputs/ToolInput.vue
@@ -33,7 +33,7 @@
},
methods: {
setTemps() {
- this.$socket.sendObj('post_printer_gcode', {script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value});
+ this.$socket.sendObj('post_printer_gcode_script', {script: this.command+' '+this.attributeName+'='+this.name+' TARGET='+this.value});
}
},
watch: {
diff --git a/src/inputs/ToolSlider.vue b/src/inputs/ToolSlider.vue
index 2140202c..e5fb389e 100644
--- a/src/inputs/ToolSlider.vue
+++ b/src/inputs/ToolSlider.vue
@@ -69,7 +69,7 @@
},
methods: {
sendCmd() {
- this.$socket.sendObj('post_printer_gcode', { script: this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0) });
+ this.$socket.sendObj('post_printer_gcode_script', { script: this.command+' '+this.attributeName+(this.value*this.attributeScale).toFixed(0) });
},
decrement() {
this.value--;
diff --git a/src/pages/Console.vue b/src/pages/Console.vue
index 9b231e7c..bb454e69 100644
--- a/src/pages/Console.vue
+++ b/src/pages/Console.vue
@@ -134,7 +134,7 @@
doSend() {
this.loadingSendGcode = true;
this.$store.commit('addGcodeResponse', this.gcode);
- Vue.prototype.$socket.sendObj('post_printer_gcode', { script: this.gcode }, "sendGcode");
+ Vue.prototype.$socket.sendObj('post_printer_gcode_script', { script: this.gcode }, "sendGcode");
this.lastCommands.push(this.gcode);
this.gcode = "";
this.lastCommandNumber = null;
diff --git a/src/pages/Files.vue b/src/pages/Files.vue
index 5f2e8fec..55889092 100644
--- a/src/pages/Files.vue
+++ b/src/pages/Files.vue
@@ -220,7 +220,7 @@
formData.append('file', file);
this.$store.commit('setLoadingGcodeUpload', true);
- axios.post('http://' + this.hostname + ':' + this.port + '/printer/files/upload',
+ axios.post('http://' + this.hostname + ':' + this.port + '/server/files/upload',
formData, {
headers: { 'Content-Type': 'multipart/form-data' }
}
@@ -238,7 +238,7 @@
},
refreshFileList: function() {
this.$store.commit('setLoadingGcodeRefresh', true);
- this.$socket.sendObj('get_printer_files', {}, 'getFileList');
+ this.$socket.sendObj('get_file_list', {}, 'getFileList');
},
formatDate(date) {
let tmp2 = new Date(date);
@@ -292,7 +292,7 @@
},
removeFile() {
axios.delete(
- 'http://'+ this.hostname + ':' + this.port +'/printer/files/'+this.contextMenu.item.filename
+ 'http://'+ this.hostname + ':' + this.port +'/server/files/'+this.contextMenu.item.filename
).then((result) => {
this.$toast.success(result.data.result+" successfully deleted.");
}).catch(() => {
diff --git a/src/plugins/wsClient.js b/src/plugins/wsClient.js
index 2d766c0d..1249bb6c 100644
--- a/src/plugins/wsClient.js
+++ b/src/plugins/wsClient.js
@@ -59,10 +59,14 @@ export default class WebSocketClient {
if (this.store) {
if (this.wsData.filter(item => item.id === data.id).length > 0 &&
this.wsData.filter(item => item.id === data.id)[0].action !== "") {
- this.store.dispatch(
- this.wsData.filter(item => item.id === data.id)[0].action,
- data.result
- )
+ if (data.error && data.error.message) {
+ window.console.error("Response Error: "+this.wsData.filter(item => item.id === data.id)[0].action+" > "+data.error.message);
+ } else {
+ this.store.dispatch(
+ this.wsData.filter(item => item.id === data.id)[0].action,
+ data.result
+ )
+ }
} else this.passToStore('socket_on_message', data)
}
};
diff --git a/src/store/actions.js b/src/store/actions.js
index b778e111..f7de4c3a 100644
--- a/src/store/actions.js
+++ b/src/store/actions.js
@@ -7,25 +7,16 @@ import axios from "axios";
export default {
socket_on_open ({ commit }) {
commit('setConnected');
- Vue.prototype.$socket.sendObj('get_printer_status', { }, 'getHelpData');
-
- fetch('http://'+store.state.socket.hostname+':'+store.state.socket.port+'/printer/files/gui.json')
- .then(res => res.json()).then(file => {
- store.commit('setSettings', file);
- }).catch(function() {
- window.console.warn('No mainsail config file found.');
- });
-
+ Vue.prototype.$socket.sendObj('get_printer_objects_status', { }, 'getHelpData');
+ Vue.prototype.$socket.sendObj('get_directory', { path: 'gcodes' }, 'getDirectoryRoot');
Vue.prototype.$socket.sendObj('get_printer_info', {}, 'getKlipperInfo');
},
socket_on_close ({ commit }, event) {
commit('setDisconnected');
- if (event.wasClean) {
- window.console.log('Socket closed clear')
- } else {
- window.console.error('Connection failure')
- }
+ if (event.wasClean) window.console.log('Socket closed clear')
+ else window.console.error('Connection failure')
+
window.console.error('Code: ' + event.code)
},
@@ -58,13 +49,20 @@ export default {
default:
if (data.result !== "ok") {
- window.console.log("Default return");
if (data.error) window.console.error("JSON-RPC: " + data.error.message);
- else window.console.log(data);
}
}
},
+ getDirectoryRoot({ commit }, data) {
+ if (data.files && data.files.filter((file) => file.filename === "gui.json")) {
+ fetch('http://'+store.state.socket.hostname+':'+store.state.socket.port+'/server/files/gcodes/gui.json')
+ .then(res => res.json()).then(file => {
+ commit('setSettings', file);
+ });
+ }
+ },
+
saveGuiSettings({ commit, state }) {
commit('setLoadingSaveGuiConfige', true);
let file = new File([JSON.stringify({ webcam: state.webcam, gui: state.gui })], 'gui.json');
@@ -92,10 +90,10 @@ export default {
commit('setPrinterStatus', 'ready');
- Vue.prototype.$socket.sendObj('get_printer_objects', {}, 'getObjectInfo');
- Vue.prototype.$socket.sendObj('get_printer_status', { heaters: [] }, 'getHeatersInfo');
- Vue.prototype.$socket.sendObj('get_printer_status', { configfile: ['config'] }, 'getPrinterConfig');
- Vue.prototype.$socket.sendObj('post_printer_subscriptions', {
+ Vue.prototype.$socket.sendObj('get_printer_objects_list', {}, 'getObjectInfo');
+ Vue.prototype.$socket.sendObj('get_printer_objects_status', { heaters: [] }, 'getHeatersInfo');
+ Vue.prototype.$socket.sendObj('get_printer_objects_status', { configfile: ['config'] }, 'getPrinterConfig');
+ Vue.prototype.$socket.sendObj('post_printer_objects_subscription', {
gcode: [],
toolhead: [],
virtual_sdcard: [],
@@ -105,7 +103,7 @@ export default {
idle_timeout: [],
display_status: [],
});
- Vue.prototype.$socket.sendObj('get_printer_files', {}, 'getFileList');
+ Vue.prototype.$socket.sendObj('get_file_list', {}, 'getFileList');
Vue.prototype.$socket.sendObj('get_printer_gcode_help', {}, 'getHelpList');
} else {
commit('setPrinterStatus', 'disconnected');
@@ -125,7 +123,7 @@ export default {
if (data.heaters.available_heaters.length) {
data.heaters.available_heaters.forEach(function(heater) {
- Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [heater]: [] });
+ Vue.prototype.$socket.sendObj('post_printer_objects_subscription', { [heater]: [] });
})
}
diff --git a/src/store/getters.js b/src/store/getters.js
index e1b44de5..a7d2d5dd 100644
--- a/src/store/getters.js
+++ b/src/store/getters.js
@@ -98,7 +98,7 @@ export default {
},
current_file_size: state => {
- let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
+ let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.filename);
if (file.length) return file[0]['size'];
@@ -106,7 +106,7 @@ export default {
},
current_file_metadata: state => {
- let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
+ let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.filename);
if (file.length) return file[0];
@@ -114,7 +114,7 @@ export default {
},
current_file_estimated_time: state => {
- let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
+ let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.filename);
if (file.length) return file[0]['estimated_time'];
@@ -122,7 +122,7 @@ export default {
},
current_file_filament_total: state => {
- let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.current_file);
+ let file = state.files.filter((file) => file.filename === state.printer.virtual_sdcard.filename);
if (file.length) return file[0]['filament_total'];
@@ -134,7 +134,7 @@ export default {
},
is_printing: state => {
- return (state.printer.virtual_sdcard.current_file !== "");
+ return (state.printer.virtual_sdcard.filename !== "");
},
getMacros: state => {
@@ -247,7 +247,7 @@ export default {
getTitle: state => {
if (state.socket.isConnected) {
if (state.printer.pause_resume.is_paused) return "Pause Print";
- else if (state.printer.virtual_sdcard.is_active) return (state.printer.virtual_sdcard.progress * 100).toFixed(0)+"% Printing - "+state.printer.virtual_sdcard.current_file;
+ else if (state.printer.virtual_sdcard.is_active) return (state.printer.virtual_sdcard.progress * 100).toFixed(0)+"% Printing - "+state.printer.virtual_sdcard.filename;
return state.gui.general.printername ? state.gui.general.printername : state.printer.hostname;
} else return "Mainsail";
diff --git a/src/store/mutations.js b/src/store/mutations.js
index 19fc5c3b..cf0c7842 100644
--- a/src/store/mutations.js
+++ b/src/store/mutations.js
@@ -156,7 +156,7 @@ export default {
nameSplit[0] === "temperature_probe" ||
nameSplit[0] === "temperature_sensors" ||
nameSplit[0] === "filament_switch_sensor"
- ) Vue.prototype.$socket.sendObj('post_printer_subscriptions', { [key]: [] });
+ ) Vue.prototype.$socket.sendObj('post_printer_objects_subscription', { [key]: [] });
}
},
@@ -166,7 +166,7 @@ export default {
setFileList(state, data) {
state.files = [];
- window.console.log(data);
+ //window.console.log(data);
let array = Object.entries(data);
for (let [key, file] of array) {