fix: dont polling printer.info in klipper state disconnected

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej 2021-11-09 21:49:49 +01:00
parent d161cf875c
commit f12d0dd89b
4 changed files with 20 additions and 16 deletions

View File

@ -13,6 +13,7 @@
</v-btn> </v-btn>
</template> </template>
<v-list dense> <v-list dense>
<template v-if="klipperState !== 'disconnected'">
<v-subheader class="" style="height: auto;">{{ $t("App.TopCornerMenu.KlipperControl") }}</v-subheader> <v-subheader class="" style="height: auto;">{{ $t("App.TopCornerMenu.KlipperControl") }}</v-subheader>
<v-list-item class="minheight30 pr-2" link @click="klipperRestart()"> <v-list-item class="minheight30 pr-2" link @click="klipperRestart()">
<v-list-item-title>{{ $t("App.TopCornerMenu.KlipperRestart") }}</v-list-item-title> <v-list-item-title>{{ $t("App.TopCornerMenu.KlipperRestart") }}</v-list-item-title>
@ -26,8 +27,9 @@
<v-icon class="mr-2" small>mdi-restart</v-icon> <v-icon class="mr-2" small>mdi-restart</v-icon>
</v-list-item-action> </v-list-item-action>
</v-list-item> </v-list-item>
</template>
<template v-if="services.length"> <template v-if="services.length">
<v-divider class="mt-0"></v-divider> <v-divider class="mt-0" v-if="klipperState !== 'disconnected'"></v-divider>
<v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.ServiceControl") }}</v-subheader> <v-subheader class="pt-2" style="height: auto;">{{ $t("App.TopCornerMenu.ServiceControl") }}</v-subheader>
<v-list-item class="minheight30 pr-2" v-for="service in services" v-bind:key="service"> <v-list-item class="minheight30 pr-2" v-for="service in services" v-bind:key="service">
<v-list-item-title> <v-list-item-title>

View File

@ -58,7 +58,7 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) {
@Watch('klipperState') @Watch('klipperState')
klipperStateChanged(newVal: string) { klipperStateChanged(newVal: string) {
if (newVal === 'ready') { if (['ready', 'disconnected'].includes(newVal)) {
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null

View File

@ -11,7 +11,7 @@
<template> <template>
<panel <panel
v-if="socketIsConnected" v-if="socketIsConnected && klipperState !== 'disconnected'"
icon="mdi-console-line" icon="mdi-console-line"
:title="$t('Panels.MiniconsolePanel.Headline')" :title="$t('Panels.MiniconsolePanel.Headline')"
:collapsible="true" :collapsible="true"

View File

@ -57,10 +57,12 @@ export const actions: ActionTree<SocketState, RootState> = {
break break
case 'notify_klippy_disconnected': case 'notify_klippy_disconnected':
window.console.log('notify disconnected')
commit('server/setKlippyDisconnected', null, { root: true }) commit('server/setKlippyDisconnected', null, { root: true })
break break
case 'notify_klippy_shutdown': case 'notify_klippy_shutdown':
window.console.log('notify shutdown')
commit('server/setKlippyShutdown', null, { root: true }) commit('server/setKlippyShutdown', null, { root: true })
break break