fix some issues on connect

This commit is contained in:
Martin/Geno 2018-07-27 14:09:31 +02:00
parent 9fbdd5a798
commit 58d843ae7e
No known key found for this signature in database
GPG Key ID: 9D7D3C6BFF600C6A
3 changed files with 10 additions and 5 deletions

View File

@ -66,8 +66,8 @@ table.nodes tbody tr:nth-child(odd) {
table.nodes tbody tr:hover {
background: #ccc;
}
table.nodes tbody tr.offline:first-child,
table.nodes tbody tr.offline:hover:first-child{
table.nodes tbody tr.offline td:first-child,
table.nodes tbody tr.offline:hover td:first-child{
background: #dc0067;
}
table.nodes tbody tr.unseen:first-child{

View File

@ -44,6 +44,8 @@ function onerror (err) {
function onopen () {
connectionEstablished = true;
sendjson({'subject': 'auth_status'});
sendjson({'subject': 'connect'});
render();
}
@ -123,8 +125,6 @@ function connect () {
socket.onerror = onerror;
socket.onmessage = onmessage;
socket.onclose = onclose;
sendjson({'subject': 'auth_status'});
sendjson({'subject': 'connect'});
}
window.setInterval(() => {

View File

@ -21,7 +21,12 @@ func (ws *WebsocketServer) connectHandler(logger *log.Entry, msg *wsLib.Message)
ws.nodes.Lock()
i := 0
for _, node := range ws.nodes.List {
msg.From.Write(&wsLib.Message{Subject: MessageTypeCurrentNode, Body: node})
n := runtime.NewNode(node, "")
if n == nil {
continue
}
n.Lastseen = node.Lastseen
msg.From.Write(&wsLib.Message{Subject: MessageTypeCurrentNode, Body: n})
i++
}
ws.nodes.Unlock()