dashboard
dashboard copied to clipboard
network doesn't display icons for devices on first load
Requires to refresh page to display.
I would like to contribute here. Would appreciate if you could help with a few more details.
I setup the project and tried the bulb-padjs example successfully. For a device to appear in the network, will I actually need a physical device? or is there a way to simulate?
Thanks.
Hi @ankitkhedekar, sounds great. It must work with simulated devices also.
This is the file on the frontend where the magic happens https://github.com/netbeast/dashboard/blob/master/public/components/devices/index.jsx
This is by the way, where the bug probably lays. If you know something about react it should be easy. Below here I would explain the Dashboard logic for the task, that may not be needed. If you have any doubts about front-end building, please ask on this issue :)
The devices rendered are the ones that are last emitted on the network/devices
MQTT channel:
componentWillMount () {
window.addEventListener('resize', this.handleResize)
this.mqtt.subscribe('netbeast/network')
this.mqtt.on('message', (topic, message) => {
if (topic !== 'netbeast/network') return
const devices = JSON.parse(message)
Session.save('devices', devices)
this.setState({ devices })
})
}
The scanner on the backend is this file: https://github.com/netbeast/dashboard/blob/master/src/services/scanner.js. The logic is the following: installed plugins that detect devices connected are pushed to the SQLite database, then retrieved via Resources
.
It can happen that the resources are not correctly set up – in that case we must debug the SQLite database and test with plugins to see if the error is out there.
Thanks for your interest, count on us for anything!
My initial thoughts:
The scanner initially emits devices list on network/devices
on the first interval even when the Devices component might not have been yet mounted. After it mounts, it subscribes to the channel, but here scanner will no longer emit device list as it checks for cached result until a new device is added.
Please advice if I am going in the right direction.
Sounds a 100% right hypothesis, we can test it out.
We can go to the scanner https://github.com/netbeast/dashboard/blob/master/src/services/scanner.js and make it subscribe to the network topic broker.client.subscribe('network/devices/request')
. When the view is mounted we can emit a request so the scanner re-emits its cachedResult
variable.
@jsdario , I have tried implementing the solution which you can check in #159
I have not been able to run test successfully as I have been getting 2 issues
- 'should install get-started from github' keeps timing out
- Error: App already exists
Would need a bit of help. Thanks.