Calculate total clients if necessary

This commit is contained in:
Julian Kornberger 2016-07-13 16:50:59 +02:00
parent 4a9b78367c
commit 6450ae05a5
1 changed files with 8 additions and 2 deletions

View File

@ -111,9 +111,14 @@ func (nodes *Nodes) GetNodesMini() *meshviewer.Nodes {
meshviewerNodes.List[nodeID] = node meshviewerNodes.List[nodeID] = node
} }
// Calculate Total
total := nodeOrigin.Statistics.Clients.Total
if total == 0 {
total = nodeOrigin.Statistics.Clients.Wifi24 + nodeOrigin.Statistics.Clients.Wifi5
}
node.Statistics = &meshviewer.Statistics{ node.Statistics = &meshviewer.Statistics{
NodeId: nodeOrigin.Statistics.NodeId, NodeId: nodeOrigin.Statistics.NodeId,
Clients: nodeOrigin.Statistics.Clients.Total,
Gateway: nodeOrigin.Statistics.Gateway, Gateway: nodeOrigin.Statistics.Gateway,
RootFsUsage: nodeOrigin.Statistics.RootFsUsage, RootFsUsage: nodeOrigin.Statistics.RootFsUsage,
LoadAverage: nodeOrigin.Statistics.LoadAverage, LoadAverage: nodeOrigin.Statistics.LoadAverage,
@ -123,6 +128,7 @@ func (nodes *Nodes) GetNodesMini() *meshviewer.Nodes {
Processes: nodeOrigin.Statistics.Processes, Processes: nodeOrigin.Statistics.Processes,
MeshVpn: nodeOrigin.Statistics.MeshVpn, MeshVpn: nodeOrigin.Statistics.MeshVpn,
Traffic: nodeOrigin.Statistics.Traffic, Traffic: nodeOrigin.Statistics.Traffic,
Clients: total,
} }
} }
return meshviewerNodes return meshviewerNodes