refactor join

also removes server node
suspect there may be issues with proxy
and UI interactions with nodes
This commit is contained in:
Matthew R. Kasun
2022-12-20 15:29:09 -05:00
parent c086e9499d
commit 38cd4d7700
100 changed files with 1027 additions and 8833 deletions

View File

@@ -84,7 +84,7 @@ func fetchTelemetryData() (telemetryData, error) {
data.Users = getDBLength(database.USERS_TABLE_NAME)
data.Networks = getDBLength(database.NETWORKS_TABLE_NAME)
data.Version = servercfg.GetVersion()
data.Servers = GetServerCount()
//data.Servers = GetServerCount()
nodes, err := GetAllNodes()
if err == nil {
data.Nodes = len(nodes)
@@ -111,10 +111,14 @@ func setTelemetryTimestamp(telRecord *models.Telemetry) error {
}
// getClientCount - returns counts of nodes with various OS types and conditions
func getClientCount(nodes []models.LegacyNode) clientCount {
func getClientCount(nodes []models.Node) clientCount {
var count clientCount
for _, node := range nodes {
switch node.OS {
host, err := GetHost(node.HostID.String())
if err != nil {
continue
}
switch host.OS {
case "darwin":
count.MacOS += 1
case "windows":
@@ -124,9 +128,6 @@ func getClientCount(nodes []models.LegacyNode) clientCount {
case "freebsd":
count.FreeBSD += 1
}
if !(node.IsServer == "yes") {
count.NonServer += 1
}
}
return count
}