fix some issues on connect
This commit is contained in:
parent
9fbdd5a798
commit
58d843ae7e
|
@ -66,8 +66,8 @@ table.nodes tbody tr:nth-child(odd) {
|
||||||
table.nodes tbody tr:hover {
|
table.nodes tbody tr:hover {
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
}
|
}
|
||||||
table.nodes tbody tr.offline:first-child,
|
table.nodes tbody tr.offline td:first-child,
|
||||||
table.nodes tbody tr.offline:hover:first-child{
|
table.nodes tbody tr.offline:hover td:first-child{
|
||||||
background: #dc0067;
|
background: #dc0067;
|
||||||
}
|
}
|
||||||
table.nodes tbody tr.unseen:first-child{
|
table.nodes tbody tr.unseen:first-child{
|
||||||
|
|
|
@ -44,6 +44,8 @@ function onerror (err) {
|
||||||
|
|
||||||
function onopen () {
|
function onopen () {
|
||||||
connectionEstablished = true;
|
connectionEstablished = true;
|
||||||
|
sendjson({'subject': 'auth_status'});
|
||||||
|
sendjson({'subject': 'connect'});
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +125,6 @@ function connect () {
|
||||||
socket.onerror = onerror;
|
socket.onerror = onerror;
|
||||||
socket.onmessage = onmessage;
|
socket.onmessage = onmessage;
|
||||||
socket.onclose = onclose;
|
socket.onclose = onclose;
|
||||||
sendjson({'subject': 'auth_status'});
|
|
||||||
sendjson({'subject': 'connect'});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.setInterval(() => {
|
window.setInterval(() => {
|
||||||
|
|
|
@ -21,7 +21,12 @@ func (ws *WebsocketServer) connectHandler(logger *log.Entry, msg *wsLib.Message)
|
||||||
ws.nodes.Lock()
|
ws.nodes.Lock()
|
||||||
i := 0
|
i := 0
|
||||||
for _, node := range ws.nodes.List {
|
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++
|
i++
|
||||||
}
|
}
|
||||||
ws.nodes.Unlock()
|
ws.nodes.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue