@@ -4,6 +4,7 @@
margin
>
<device-dashboard
+ ref="dashboard"
class="l-flex__none c-sibling-item--v"
@group-change="onGroupChange"
@status-change="onStatusChange"
@@ -53,6 +54,9 @@ export default {
},
onLoaded (total) {
this.total = total
+ },
+ onDeviceStatusChanged (val) {
+ this.$refs.dashboard.onDeviceStatusChanged(val)
}
@@ -165,6 +165,12 @@ export default {
).finally(() => {
options.loading = false
})
+ if (this.options.loaded) {
+ this.options.online += val
+ this.options.offline -= val
+ }
@@ -34,7 +34,6 @@ export default {
VolumeDialog
mixins: [groupMixin],
- inject: ['dashboard'],
props: {
path: {
type: String,
@@ -32,7 +32,6 @@ import groupListMixin from './mixins/group-list.js'
export default {
name: 'DeviceGroupTile',
mixins: [groupMixin, groupListMixin],
@@ -5,6 +5,7 @@ import {
} from '@/utils/mqtt'
+ inject: ['dashboard'],
data () {
return {
groupOptions: this.createGroupOptions({ ignore: true })
@@ -88,8 +89,7 @@ export default {
onStatusChanged (topicKey) {
- // todo
- console.log(topicKey)
+ this.dashboard?.onDeviceStatusChanged(topicKey === 'online' ? 1 : -1)
transformDevice ({ id, name, productId, onlineStatus, lastOnline, address }) {