11<template >
2- <div class =" mmu-unit-footer zindex-4 d-flex flex-row align-center px-4 pb-1" >
2+ <div class =" mmu-unit-footer zindex-4 d-flex flex-row align-center px-2 pb-1" >
33 <v-icon
4- v-if =" showLogos"
4+ v-if =" showFooter && showLogos"
55 class =" mr-4 flex-grow-0 flex-shrink-0 opacity-70"
66 :class =" logoClasses"
77 :size =" logoHeight" >
88 {{ logo }}
99 </v-icon >
10- <div class =" flex-grow-1 flex-shrink-1 min-width-0 text-caption" >
10+ <div v-if = " showFooter " class =" flex-grow-1 flex-shrink-1 min-width-0 text-caption" >
1111 <div v-if =" showName" class =" text-truncate" >{{ unitDisplayName }}</div >
12- <div v-if =" unitClimateInfo " class = " text-truncate " >{{ unitClimateInfo }}</ div >
12+ <mmu-unit-footer-climate v-if =" showDetails && showClimate " :mmu-machine-unit = " mmuMachineUnit " / >
1313 </div >
1414 </div >
1515</template >
1616<script lang="ts">
1717import { Component , Mixins , Prop } from ' vue-property-decorator'
1818import BaseMixin from ' @/components/mixins/base'
1919import MmuMixin , { MmuMachineUnit } from ' @/components/mixins/mmu'
20+ import MmuUnitFooterClimate from ' @/components/panels/Mmu/MmuUnitFooterClimate.vue'
2021import {
2122 mmuIcon3MS ,
2223 mmuIconAngryBeaver ,
@@ -32,14 +33,17 @@ import {
3233 mmuIconVvd ,
3334 mmuThemeIcons ,
3435} from ' @/plugins/mmuIcons'
35- import { additionalSensors } from ' @/store/variables'
3636
3737const squareLogoVendors = [' 3MS' , ' AngryBeaver' , ' EMU' , ' ERCF' , ' KMS' ]
3838
39- @Component
39+ @Component ({
40+ components: { MmuUnitFooterClimate },
41+ })
4042export default class MmuUnitFooter extends Mixins (BaseMixin , MmuMixin ) {
4143 @Prop ({ required: true }) readonly unitIndex! : number
4244 @Prop ({ required: true }) readonly mmuMachineUnit! : MmuMachineUnit
45+ @Prop ({ default: true }) readonly showDetails! : boolean
46+ @Prop ({ default: true }) readonly showFooter! : boolean
4347
4448 get unitDisplayName(): string {
4549 const name = this .mmuMachineUnit ?.name
@@ -55,43 +59,8 @@ export default class MmuUnitFooter extends Mixins(BaseMixin, MmuMixin) {
5559 return this .$store .state .gui .view .mmu .showName ?? true
5660 }
5761
58- get unitClimateSensorName() {
59- const name = this .mmuMachineUnit ?.environment_sensor ?.replace (/ ^ "(. * )"$ / , ' $1' ) ?? undefined
60- if (! name ) return undefined
61-
62- const parts = name .split (' ' )
63- if (parts .length !== 2 ) return undefined
64-
65- return parts [1 ]
66- }
67-
68- get unitClimateSensor() {
69- if (! this .unitClimateSensorName ) return undefined
70-
71- for (const key of additionalSensors ) {
72- const objectName: string = ` ${key } ${this .unitClimateSensorName } `
73- if (! (objectName in this .$store .state .printer )) continue
74-
75- return this .$store .state .printer [objectName ]
76- }
77-
78- return undefined
79- }
80-
81- get unitClimateInfo() {
82- if (! this .unitClimateSensor ) return undefined
83-
84- const values: string [] = []
85-
86- if (' temperature' in this .unitClimateSensor && this .unitClimateSensor .temperature !== null ) {
87- values .push (` ${this .unitClimateSensor .temperature .toFixed (0 )}°C ` )
88- }
89-
90- if (' humidity' in this .unitClimateSensor && this .unitClimateSensor .humidity !== null ) {
91- values .push (` ${this .unitClimateSensor .humidity .toFixed (0 )}% ` )
92- }
93-
94- return values .length > 0 ? values .join (' / ' ) : undefined
62+ get showClimate(): boolean {
63+ return this .$store .state .gui .view .mmu .showClimate ?? true
9564 }
9665
9766 get mmuVendor() {
0 commit comments