feature: Missing config panel on Dashboard.vue
Signed-off-by: meteyou <meteyou@gmail.com>
This commit is contained in:
1 parent
cf7cb122d1
commit
ce6843cf49
8 files changed
+151
-12
No files matched your search
@@ -177,10 +177,12 @@ export default {
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "SAVE_CONFIG" });
|
||||
},
|
||||
doRestart: function() {
|
||||
this.$store.commit('setPrinterData', { webhooks: { state: "restart", state_message: "Printer is restarting..."}});
|
||||
this.$store.commit('addGcodeResponse', "RESTART");
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "RESTART" });
|
||||
},
|
||||
doFirmwareRestart: function() {
|
||||
this.$store.commit('setPrinterData', { webhooks: { state: "restart", state_message: "Printer is restarting..."}});
|
||||
this.$store.commit('addGcodeResponse', "FIRMWARE_RESTART");
|
||||
this.$socket.sendObj('printer.gcode.script', { script: "FIRMWARE_RESTART" });
|
||||
},
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
</v-row>
|
||||
<v-row class="px-3">
|
||||
<v-col class="col-12 text-center">
|
||||
<v-btn @click="sendRetract()" class="mx-2" :loading="loadingRetract" :disabled="!(config !== undefined && config.extruder !== null && (config.extruder.min_extrude_temp < extruder.temperature || !config.extruder.min_extrude_temp))"><v-icon>mdi-arrow-up-bold</v-icon> Retract</v-btn>
|
||||
<v-btn @click="sendDetract()" class="mx-2" :loading="loadingDetract" :disabled="!(config !== undefined && config.extruder !== null && (config.extruder.min_extrude_temp < extruder.temperature || !config.extruder.min_extrude_temp))"><v-icon>mdi-arrow-down-bold</v-icon> Extrude</v-btn>
|
||||
<v-btn @click="sendRetract()" class="mx-2" :loading="loadingRetract" :disabled="!(config !== undefined && Object.hasOwnProperty(config, 'extruder') && config.extruder !== null && (config.extruder.min_extrude_temp < extruder.temperature || !config.extruder.min_extrude_temp))"><v-icon>mdi-arrow-up-bold</v-icon> Retract</v-btn>
|
||||
<v-btn @click="sendDetract()" class="mx-2" :loading="loadingDetract" :disabled="!(config !== undefined && Object.hasOwnProperty(config, 'extruder') && config.extruder !== null && (config.extruder.min_extrude_temp < extruder.temperature || !config.extruder.min_extrude_temp))"><v-icon>mdi-arrow-down-bold</v-icon> Extrude</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<v-card
|
||||
class="mb-6"
|
||||
v-if="
|
||||
!boolVirtualSdcard ||
|
||||
!boolPauseResume ||
|
||||
!boolDisplayStatus ||
|
||||
!boolMacroPause ||
|
||||
!boolMacroResume ||
|
||||
!boolMacroCancelPrint
|
||||
">
|
||||
<v-list-item>
|
||||
<v-list-item-avatar color="grey">
|
||||
<v-icon dark>mdi-alert-circle</v-icon>
|
||||
</v-list-item-avatar>
|
||||
<v-list-item-content>
|
||||
<v-list-item-title class="headline">Missing configuration</v-list-item-title>
|
||||
</v-list-item-content>
|
||||
</v-list-item>
|
||||
<v-divider class="my-2" ></v-divider>
|
||||
<v-card-text class="px-0 pt-0 pb-2 content">
|
||||
<v-layout wrap class=" text-center">
|
||||
<v-flex col class="text-left">
|
||||
<p v-if="!boolVirtualSdcard"><code>virtual_sdcard</code> is not defined in config.</p>
|
||||
<p v-if="!boolPauseResume"><code>pause_resume</code> is not defined in config.</p>
|
||||
<p v-if="!boolDisplayStatus"><code>display_status</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroPause"><code>gcode_macro PAUSE</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroResume"><code>gcode_macro RESUME</code> is not defined in config.</p>
|
||||
<p v-if="!boolMacroCancelPrint"><code>gcode_macro CANCEL_PRINT</code> is not defined in config.</p>
|
||||
<p class="mb-0"><a href="https://github.com/meteyou/mainsail/wiki/Printer.cfg" target="_blank">Here you will find more information.</a></p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapMutations, mapState, mapGetters } from 'vuex';
|
||||
|
||||
export default {
|
||||
data: () => ({
|
||||
boolVirtualSdcard: false,
|
||||
boolPauseResume: false,
|
||||
boolDisplayStatus: false,
|
||||
boolMacroPause: false,
|
||||
boolMacroResume: false,
|
||||
boolMacroCancelPrint: false,
|
||||
}),
|
||||
computed: {
|
||||
...mapState({
|
||||
state: state => state.printer.webhooks.state,
|
||||
config: state => state.printer.configfile.config,
|
||||
}),
|
||||
...mapMutations([
|
||||
|
||||
]),
|
||||
...mapGetters([
|
||||
'checkConfigVirtualSdcard',
|
||||
'checkConfigPauseResume',
|
||||
'checkConfigDisplayStatus',
|
||||
'checkConfigMacroPause',
|
||||
'checkConfigMacroResume',
|
||||
'checkConfigMacroCancel',
|
||||
]),
|
||||
},
|
||||
created() {
|
||||
this.refreshConfig();
|
||||
},
|
||||
methods: {
|
||||
refreshConfig() {
|
||||
this.boolVirtualSdcard = this.checkConfigVirtualSdcard;
|
||||
this.boolPauseResume = this.checkConfigPauseResume;
|
||||
this.boolDisplayStatus = this.checkConfigDisplayStatus;
|
||||
this.boolMacroPause = this.checkConfigMacroPause;
|
||||
this.boolMacroResume = this.checkConfigMacroResume;
|
||||
this.boolMacroCancelPrint = this.checkConfigMacroCancel;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
config: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.refreshConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.content span,
|
||||
.content strong {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style>
|
||||
@@ -2,6 +2,7 @@ import Vue from 'vue'
|
||||
|
||||
import StatusPanel from './StatusPanel.vue'
|
||||
import KlippyStatePanel from './KlippyStatePanel.vue'
|
||||
import MinSettingsPanel from './MinSettingsPanel.vue'
|
||||
import ToolsPanel from './ToolsPanel.vue'
|
||||
import ControlPanel from "./ControlPanel";
|
||||
import ExtruderPanel from "./ExtruderPanel";
|
||||
@@ -14,6 +15,7 @@ import PowerControlPanel from "./PowerControlPanel.vue";
|
||||
|
||||
Vue.component('status-panel', StatusPanel);
|
||||
Vue.component('klippy-state-panel', KlippyStatePanel);
|
||||
Vue.component('min-settings-panel', MinSettingsPanel);
|
||||
Vue.component('tools-panel', ToolsPanel);
|
||||
Vue.component('control-panel', ControlPanel);
|
||||
Vue.component('extruder-panel', ExtruderPanel);
|
||||
|
||||
+12
-6
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col class="col-sm-12 col-md-7">
|
||||
<min-settings-panel v-if="klippy_state === 'ready' && configExists"></min-settings-panel>
|
||||
<status-panel v-if="klippy_state === 'ready'"></status-panel>
|
||||
<klippy-state-panel v-if="klippy_state !== 'ready'"></klippy-state-panel>
|
||||
<webcam-panel v-if="showDashboardWebcam" class="mt-6"></webcam-panel>
|
||||
@@ -24,25 +25,30 @@
|
||||
export default {
|
||||
components: {ZOffsetPanel},
|
||||
data: () => ({
|
||||
//is_ready: false
|
||||
configExists: false
|
||||
}),
|
||||
computed: {
|
||||
...mapState({
|
||||
showDashboardConsole: state => state.gui.dashboard.boolConsole,
|
||||
klippy_state: state => state.printer.webhooks.state,
|
||||
config: state => state.printer.configfile.config
|
||||
}),
|
||||
...mapGetters([
|
||||
'showDashboardWebcam',
|
||||
'powerDevicesCount'
|
||||
'powerDevicesCount',
|
||||
'existPrinterConfig'
|
||||
])
|
||||
},
|
||||
/*created() {
|
||||
created() {
|
||||
//this.is_ready = (this.klippy_state === "ready") ? true : false;
|
||||
},
|
||||
watch: {
|
||||
klippy_state() {
|
||||
this.is_ready = (this.klippy_state === "ready") ? true : false;
|
||||
config: {
|
||||
deep: true,
|
||||
handler() {
|
||||
this.configExists = this.$store.getters.existPrinterConfig;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -85,7 +85,6 @@ export default {
|
||||
},
|
||||
|
||||
initPrinter() {
|
||||
|
||||
Vue.prototype.$socket.sendObj('printer.info', {}, 'getKlipperInfo');
|
||||
|
||||
// only available with klipper is ready
|
||||
|
||||
@@ -241,6 +241,39 @@ export default {
|
||||
return extruder;
|
||||
},
|
||||
|
||||
existPrinterConfig: state => {
|
||||
if (
|
||||
typeof(state.printer.configfile.config) === "object" &&
|
||||
Object.keys(state.printer.configfile.config).length > 0
|
||||
) return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
checkConfigVirtualSdcard: state => {
|
||||
return 'virtual_sdcard' in state.printer.configfile.config;
|
||||
},
|
||||
|
||||
checkConfigPauseResume: state => {
|
||||
return 'pause_resume' in state.printer.configfile.config;
|
||||
},
|
||||
|
||||
checkConfigDisplayStatus: state => {
|
||||
return 'display_status' in state.printer.configfile.config;
|
||||
},
|
||||
|
||||
checkConfigMacroPause: state => {
|
||||
return Object.keys(state.printer.configfile.config).findIndex(key => key.toLowerCase() === 'gcode_macro pause') !== -1;
|
||||
},
|
||||
|
||||
checkConfigMacroResume: state => {
|
||||
return Object.keys(state.printer.configfile.config).findIndex(key => key.toLowerCase() === 'gcode_macro resume') !== -1;
|
||||
},
|
||||
|
||||
checkConfigMacroCancel: state => {
|
||||
return Object.keys(state.printer.configfile.config).findIndex(key => key.toLowerCase() === 'gcode_macro cancel_print') !== -1;
|
||||
},
|
||||
|
||||
powerDevices: state => {
|
||||
return state.power.devices;
|
||||
},
|
||||
|
||||
@@ -18,6 +18,8 @@ export default {
|
||||
},
|
||||
|
||||
setKlippyDisconnected(state) {
|
||||
Vue.set(state.printer.configfile, 'config', {});
|
||||
|
||||
Vue.set(state, '', {
|
||||
webhooks: {
|
||||
state: 'disconnected',
|
||||
@@ -56,9 +58,7 @@ export default {
|
||||
state.printer.webhooks.state !== "ready" &&
|
||||
state.printer.webhooks.state !== "" &&
|
||||
value.state === "ready"
|
||||
) {
|
||||
this.commit("resetPrinter");
|
||||
}
|
||||
) this.commit("resetPrinter");
|
||||
|
||||
//update printer state
|
||||
if (typeof(value) === "object") {
|
||||
|
||||
Reference in new issue
Block a user