Skip to content

Commit 8b6bd70

Browse files
committed
feat: adds Kalico non_critical_disconnected support
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
1 parent 5ee3637 commit 8b6bd70

File tree

6 files changed

+51
-16
lines changed

6 files changed

+51
-16
lines changed

src/components/widgets/system/McuCard.vue

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<collapsable-card
3-
:title="$t('app.system_info.label.mcu_information', {mcu: mcu.name})"
3+
:title="$t('app.system_info.label.mcu_information', {mcu: mcu.prettyName})"
44
icon="$chip"
55
>
66
<template #menu>
@@ -28,6 +28,32 @@
2828
<th>{{ $t('app.system_info.label.version') }}</th>
2929
<td>{{ mcu.mcu_version }}</td>
3030
</tr>
31+
<tr v-if="mcu.app">
32+
<th>{{ $t('app.system_info.label.application') }}</th>
33+
<td>{{ mcu.app }}</td>
34+
</tr>
35+
<tr v-if="mcu.non_critical_disconnected != null">
36+
<th>{{ $t('app.system_info.label.non_critical_connection') }}</th>
37+
<td>
38+
<v-chip
39+
:color="mcu.non_critical_disconnected ? 'error' : 'success'"
40+
small
41+
label
42+
>
43+
<v-icon
44+
small
45+
left
46+
>
47+
{{ mcu.non_critical_disconnected ? '$blankCircle' : '$markedCircle' }}
48+
</v-icon>
49+
{{
50+
mcu.non_critical_disconnected
51+
? $t('app.system_info.label.disconnected')
52+
: $t('app.system_info.label.connected')
53+
}}
54+
</v-chip>
55+
</td>
56+
</tr>
3157
</tbody>
3258
</v-simple-table>
3359

src/components/widgets/system/McuLoadChart.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
<div class="chart-label-wrapper">
1414
<div class="chart-label">
15-
<span>{{ $t('app.system_info.label.mcu_load', { mcu: mcu.toUpperCase() }) }}</span>
15+
<span>{{ $t('app.system_info.label.mcu_load', { mcu: mcu.prettyName }) }}</span>
1616
<span v-if="chartData.length">{{ chartData[chartData.length - 1].load }}%</span>
1717
</div>
1818

1919
<div class="chart-label">
20-
<span>{{ $t('app.system_info.label.mcu_awake', { mcu: mcu.toUpperCase() }) }}</span>
20+
<span>{{ $t('app.system_info.label.mcu_awake', { mcu: mcu.prettyName }) }}</span>
2121
<span v-if="chartData.length">{{ chartData[chartData.length - 1].awake }}%</span>
2222
</div>
2323

@@ -31,16 +31,17 @@
3131

3232
<script lang="ts">
3333
import { Component, Vue, Prop, Watch } from 'vue-property-decorator'
34+
import type { MCU } from '@/store/printer/types'
3435
3536
@Component({})
3637
export default class McuLoadChart extends Vue {
3738
ready = false
3839
39-
@Prop({ type: String, required: true })
40-
readonly mcu!: string
40+
@Prop({ type: Object, required: true })
41+
readonly mcu!: MCU
4142
4243
get chartData () {
43-
return this.$store.state.charts[this.mcu] || []
44+
return this.$store.state.charts[this.mcu.name] || []
4445
}
4546
4647
get options () {

src/components/widgets/system/SystemUsageCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
>
1515
<mcu-load-chart
1616
:key="i"
17-
:mcu="mcu.name"
17+
:mcu="mcu"
1818
/>
1919
</template>
2020
</v-row>

src/locales/en.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,14 @@ app:
701701
no_connection: No moonraker connection. Please check moonraker status and / or refresh.
702702
system_info:
703703
label:
704+
application: Application
704705
awake_time: awake time
705706
capacity: Capacity
707+
connected: Connected
706708
constants: Constants
707709
cpu_desc: CPU Description
708710
devices: Devices
711+
disconnected: Disconnected
709712
distribution_codename: Codename
710713
distribution_like: Distribution Like
711714
distribution_name: Distribution
@@ -726,6 +729,7 @@ app:
726729
moonraker_load: Moonraker Load
727730
last_stats: Last Stats
728731
network: Network
732+
non_critical_connection: Non-critical connection
729733
processor_desc: Processor
730734
product_name: Product Name
731735
serial_number: Serial Number

src/store/printer/getters.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,17 @@ export const getters: GetterTree<PrinterState, RootState> = {
286286
/**
287287
* Return MCU's and their state
288288
*/
289-
getMcus: (state) => {
290-
const mcus: MCU[] = []
291-
Object.keys(state.printer)
289+
getMcus: (state, getters) => {
290+
const mcus = Object.keys(state.printer)
292291
.filter(key => key.startsWith('mcu'))
293292
.sort()
294-
.forEach(key => {
295-
mcus.push({
296-
name: key,
297-
...state.printer[key]
298-
})
299-
})
293+
.map((key): MCU => ({
294+
name: key,
295+
prettyName: Vue.$filters.prettyCase(key),
296+
...state.printer[key],
297+
config: getters.getPrinterSettings(key)
298+
}))
299+
300300
return mcus
301301
},
302302

src/store/printer/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,14 @@ export type StepperType<T = Record<string, any>> = {
7575

7676
export interface MCU {
7777
name: string;
78+
prettyName: string;
7879
last_stats?: Record<string, string | number>;
7980
mcu_build_versions?: string;
8081
mcu_constants?: Record<string, string | number>;
8182
mcu_version?: string;
83+
app?: string;
84+
non_critical_disconnected?: boolean;
85+
config: Record<string, any>;
8286
}
8387

8488
export type OutputType<T = Record<string, any>> = {

0 commit comments

Comments
 (0)