From 5e818a5e7a3f70327eada677b5f886468c528022 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 21 Mar 2024 19:09:49 +0100 Subject: [PATCH] refactor: refactor KlippyStatePanel Signed-off-by: Stefan Dej --- src/components/panels/KlippyStatePanel.vue | 186 ++++++++++----------- src/locales/en.json | 2 + 2 files changed, 92 insertions(+), 96 deletions(-) diff --git a/src/components/panels/KlippyStatePanel.vue b/src/components/panels/KlippyStatePanel.vue index 58f1f8e50..48607c811 100644 --- a/src/components/panels/KlippyStatePanel.vue +++ b/src/components/panels/KlippyStatePanel.vue @@ -1,105 +1,83 @@ @@ -129,7 +107,7 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) { mdiDownload = mdiDownload mdiPower = mdiPower - get klippy_message() { + get klippy_message(): string | null { return this.$store.state.server.klippy_message ?? null } @@ -148,6 +126,22 @@ export default class KlippyStatePanel extends Mixins(BaseMixin) { } } + get buttonClasses() { + return [this.messageType.color + '--text', 'my-1', 'w-100'] + } + + get serviceReportsKlipper() { + return `${this.$t('Panels.KlippyStatePanel.ServiceReports', { + service: 'Klipper', + })}: ${this.klipperState.toUpperCase()}` + } + + get serviceReportsMoonraker() { + return `${this.$t('Panels.KlippyStatePanel.ServiceReports', { + service: 'Moonraker', + })}: ${this.klipperState.toUpperCase()}` + } + restart() { this.$socket.emit('printer.restart', {}, { loading: 'restart' }) } diff --git a/src/locales/en.json b/src/locales/en.json index 4b25e5eb0..58c5c6aab 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -599,7 +599,9 @@ "KlippyStatePanel": { "CheckKlippyAndUdsAddress": "Please check if the Klipper service is running and klippy_uds_address is correctly configured in the moonraker.conf.", "FirmwareRestart": "Firmware Restart", + "KlipperLog": "Klipper Log", "MoonrakerCannotConnect": "Moonraker can't connect to Klipper!", + "MoonrakerLog": "Moonraker Log", "PowerOn": "Power on", "PrinterSwitchedOff": "Printer is powered off", "PrinterSwitchedOffDescription": "The printer is currently powered off and Klipper cannot connect. To power on the printer, click the button below:",