Allow customisation of temperature, humidity and luminance badges (#1647)
Signed-off-by: Boris Krivonog <boris.krivonog@inova.si>pull/1653/head
parent
3138dffe94
commit
a82f2b475b
|
@ -28,7 +28,7 @@
|
|||
import { allEquipmentPoints, findPoints } from '../glance-helpers'
|
||||
|
||||
export default {
|
||||
props: ['element', 'type', 'customConfig', 'invertColor', 'store'],
|
||||
props: ['element', 'type', 'badgeOverrides', 'customConfig', 'invertColor', 'store'],
|
||||
data () {
|
||||
return {
|
||||
badgeConfigs: {
|
||||
|
@ -40,6 +40,12 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
config () {
|
||||
if (this.badgeOverrides) {
|
||||
const override = this.badgeOverrides[this.type]
|
||||
if (override && override.badge) {
|
||||
return Object.assign(this.badgeConfigs[this.type], override.badge)
|
||||
}
|
||||
}
|
||||
return this.badgeConfigs[this.type]
|
||||
},
|
||||
query () {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="location-stats margin-top-half" v-if="!config.disableBadges">
|
||||
<span v-for="badgeType in ['temperature', 'humidity', 'luminance']" :key="badgeType">
|
||||
<measurement-badge v-if="!config.badges || !config.badges.length || config.badges.indexOf(badgeType) >= 0"
|
||||
:store="context.store" :element="element" :type="badgeType" :invert-color="config.invertText" />
|
||||
:store="context.store" :element="element" :type="badgeType" :invert-color="config.invertText" :badgeOverrides="badgeOverrides" />
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue