|
|
@@ -161,20 +161,9 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
onMessage (topic) {
|
|
|
- if (this.deviceOptions.loaded && !this.deviceOptions.list.length) {
|
|
|
- return
|
|
|
- }
|
|
|
- const result = /^[^/]+\/(.+)\/(online|offline)$/.exec(topic)
|
|
|
- if (result) {
|
|
|
- if (!this.deviceOptions.loaded) {
|
|
|
- this.refreshDevices()
|
|
|
- return
|
|
|
- }
|
|
|
- const deviceId = result[1]
|
|
|
- const device = this.deviceOptions.list.find(({ id }) => id === deviceId)
|
|
|
- if (device && (result[2] === 'online' && device.onlineStatus !== 1 || result[2] === 'offline' && device.onlineStatus === 1)) {
|
|
|
- this.refreshDevices()
|
|
|
- }
|
|
|
+ const result = /^(\d+)\/\d+\/(online|offline)$/.exec(topic)
|
|
|
+ if (result && (!this.product || this.product === result[1])) {
|
|
|
+ this.refreshDevices(true)
|
|
|
}
|
|
|
},
|
|
|
_getProducts () {
|
|
|
@@ -225,9 +214,12 @@ export default {
|
|
|
monitor.online = onLineTotal
|
|
|
monitor.offline = offLineTotal
|
|
|
monitor.inactive = notEnabledTotal
|
|
|
- this._getDevices(total)
|
|
|
}).finally(() => {
|
|
|
monitor.loading = false
|
|
|
+ }).then(() => {
|
|
|
+ if (!this.monitor.loading) {
|
|
|
+ this._getDevices(this.monitor.total)
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
sort (a, b) {
|