From d937f06164283f111002367825fe1ae9c24ac814 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Fri, 3 Jun 2022 08:56:02 +0100 Subject: [PATCH] feat: moves MCU info to separate panel (#706) Signed-off-by: Pedro Lamas Co-authored-by: Mathis Mensing --- src/components/widgets/system/McuCard.vue | 63 +++++++++++++++++++ .../widgets/system/McuConstantsDialog.vue | 47 ++++++++++++++ .../widgets/system/SystemOverviewCard.vue | 11 ---- src/globals.ts | 8 ++- src/locales/de.yaml | 4 ++ src/locales/en.yaml | 4 ++ src/plugins/filters.ts | 13 ++++ src/store/printer/types.ts | 1 + src/views/System.vue | 26 ++++---- 9 files changed, 152 insertions(+), 25 deletions(-) create mode 100644 src/components/widgets/system/McuCard.vue create mode 100644 src/components/widgets/system/McuConstantsDialog.vue diff --git a/src/components/widgets/system/McuCard.vue b/src/components/widgets/system/McuCard.vue new file mode 100644 index 0000000000..0a10af0b93 --- /dev/null +++ b/src/components/widgets/system/McuCard.vue @@ -0,0 +1,63 @@ + + + diff --git a/src/components/widgets/system/McuConstantsDialog.vue b/src/components/widgets/system/McuConstantsDialog.vue new file mode 100644 index 0000000000..240c5d0d7d --- /dev/null +++ b/src/components/widgets/system/McuConstantsDialog.vue @@ -0,0 +1,47 @@ + + + diff --git a/src/components/widgets/system/SystemOverviewCard.vue b/src/components/widgets/system/SystemOverviewCard.vue index 94cb9c8903..aaa3eba102 100644 --- a/src/components/widgets/system/SystemOverviewCard.vue +++ b/src/components/widgets/system/SystemOverviewCard.vue @@ -43,13 +43,6 @@ {{ $t('app.system_info.label.distribution_like') }} {{ distribution.like }} - - {{ mcu.name }} - {{ mcu.mcu_version }} - @@ -72,10 +65,6 @@ import { Component, Vue } from 'vue-property-decorator' @Component({}) export default class PrinterStatsCard extends Vue { - get mcus () { - return this.$store.getters['printer/getMcus'] - } - get cpuInfo () { const info = this.$store.getters['server/getSystemInfo'] return info?.cpu_info || {} diff --git a/src/globals.ts b/src/globals.ts index dda2d3ab42..650aa7f50f 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -117,7 +117,9 @@ import { mdiStop, mdiPlay, mdiFileVideoOutline, - mdiBellSleep + mdiBellSleep, + mdiChip, + mdiViewHeadline } from '@mdi/js' /** @@ -303,7 +305,9 @@ export const Icons = Object.freeze({ message: mdiMessageTextOutline, fullScreen: mdiFullscreen, video: mdiFileVideoOutline, - snooze: mdiBellSleep + snooze: mdiBellSleep, + chip: mdiChip, + viewHeadline: mdiViewHeadline }) export const Waits = Object.freeze({ diff --git a/src/locales/de.yaml b/src/locales/de.yaml index 3a55d2b9c7..a8cc8e6c33 100644 --- a/src/locales/de.yaml +++ b/src/locales/de.yaml @@ -462,6 +462,7 @@ app: distribution_codename: Codename distribution_like: Distribution wie distribution_name: Distribution + frequency: Frequenz hardware_desc: Hardwarebeschreibung hostname: Hostname klipper_load: Klipper-Last @@ -469,7 +470,9 @@ app: manufacturer: Hersteller mcu_awake: '{mcu} Zeit im Wachzustand' mcu_bandwidth: '{mcu}-Bandbreite' + mcu_information: '{mcu}-Informationen' mcu_load: '{mcu}-Last' + micro_controller: Mikrocontroller model: CPU-Modell moonraker_load: Moonraker-Last processor_desc: Prozessor @@ -479,6 +482,7 @@ app: system_memory: Systemspeicher system_utilization: Auslastung total_memory: Gesamtspeicherplatz + version: Version tool: btn: home_x: X diff --git a/src/locales/en.yaml b/src/locales/en.yaml index 235e65831e..39cf5fdd0d 100644 --- a/src/locales/en.yaml +++ b/src/locales/en.yaml @@ -466,6 +466,7 @@ app: distribution_codename: Codename distribution_like: Distribution Like distribution_name: Distribution + frequency: Frequency hardware_desc: Hardware Description hostname: Hostname klipper_load: Klipper Load @@ -473,7 +474,9 @@ app: manufacturer: Manufacturer mcu_awake: '{mcu} Awake Time' mcu_bandwidth: '{mcu} Bandwidth' + mcu_information: '{mcu} Information' mcu_load: '{mcu} Load' + micro_controller: Micro-Controller model: CPU Model moonraker_load: Moonraker Load processor_desc: Processor @@ -483,6 +486,7 @@ app: system_memory: System Memory system_utilization: System Utilization total_memory: Total Memory + version: Version tool: btn: home_x: X diff --git a/src/plugins/filters.ts b/src/plugins/filters.ts index d03623a1d7..d470e5ebb9 100644 --- a/src/plugins/filters.ts +++ b/src/plugins/filters.ts @@ -149,6 +149,19 @@ export const Filters = { return weightInG.toFixed(2) + ' g' }, + /** + * Formats a number representing mm to human readable distance. + */ + getReadableFrequencyString (frequencyInHz: number) { + let i = 0 + const frequencyUnits = [' Hz', ' KHz', ' MHz', ' GHz'] + while (frequencyInHz >= 1000) { + frequencyInHz = frequencyInHz / 1000 + i++ + } + return frequencyInHz.toFixed() + frequencyUnits[i] + }, + /** * The filesystem sorter. This is copied from vuetify, and modified to ensure our directories * are always sorted to the top. diff --git a/src/store/printer/types.ts b/src/store/printer/types.ts index 7bd8c02720..e1009f120c 100644 --- a/src/store/printer/types.ts +++ b/src/store/printer/types.ts @@ -12,6 +12,7 @@ export interface Extruder { } export interface MCU { + name: string; last_stats: MCUData; mcu_build_versions: string; mcu_constants: MCUData; diff --git a/src/views/System.vue b/src/views/System.vue index 11d0586097..c0a7231a9e 100644 --- a/src/views/System.vue +++ b/src/views/System.vue @@ -9,11 +9,19 @@ - + + @@ -25,6 +33,7 @@ import FileSystem from '@/components/widgets/filesystem/FileSystem.vue' import SystemControl from '@/components/common/SystemControl.vue' import SystemOverviewCard from '@/components/widgets/system/SystemOverviewCard.vue' +import McuCard from '@/components/widgets/system/McuCard.vue' import SystemUsageCard from '@/components/widgets/system/SystemUsageCard.vue' import DiskUsageCard from '@/components/widgets/system/DiskUsageCard.vue' @@ -33,19 +42,12 @@ import DiskUsageCard from '@/components/widgets/system/DiskUsageCard.vue' FileSystem, SystemControl, SystemOverviewCard, + McuCard, SystemUsageCard, DiskUsageCard } }) export default class Configure extends Mixins(StateMixin) { - get hasGraphData () { - return ( - this.$store.state.charts.klipper !== undefined || - this.$store.state.charts.moonraker !== undefined || - this.$store.state.charts.memory !== undefined - ) - } - get breakpoint () { if (this.$vuetify.breakpoint.mdAndDown) { return 12 @@ -53,8 +55,8 @@ export default class Configure extends Mixins(StateMixin) { return 6 } - get supportsHistory () { - return this.$store.getters['server/componentSupport']('history') + get mcus () { + return this.$store.getters['printer/getMcus'] } }