File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,13 +16,13 @@ import (
1616type DashboardData struct {
1717 AccountCount int
1818 ActiveAccountCount int
19- // PublicKeyCount int
20- // GlobalKeyCount int
21- // AlgoCounts map[string]int
22- HostsUpToDate int
23- HostsOutdated int
24- SystemKeySerial int
25- RecentLogs []model.AuditLogEntry
19+ PublicKeyCount int
20+ GlobalKeyCount int
21+ AlgoCounts map [string ]int
22+ HostsUpToDate int
23+ HostsOutdated int
24+ SystemKeySerial int
25+ RecentLogs []model.AuditLogEntry
2626}
2727
2828// BuildDashboardData collects accounts, keys, system key and recent audit logs,
@@ -70,6 +70,14 @@ func BuildDashboardData(reader DashboardReader) (DashboardData, error) {
7070 for _ , k := range keys {
7171 keysByID [k .ID ] = k
7272 }
73+ out .PublicKeyCount = len (keys )
74+ out .AlgoCounts = make (map [string ]int )
75+ for _ , k := range keys {
76+ if k .IsGlobal {
77+ out .GlobalKeyCount ++
78+ }
79+ out .AlgoCounts [k .Algorithm ]++
80+ }
7381 }
7482 }
7583
@@ -87,15 +95,6 @@ func BuildDashboardData(reader DashboardReader) (DashboardData, error) {
8795 }
8896 }
8997
90- // out.PublicKeyCount = len(klist)
91- // out.AlgoCounts = make(map[string]int)
92- // for _, k := range klist {
93- // if k.IsGlobal {
94- // out.GlobalKeyCount++
95- // }
96- // out.AlgoCounts[k.Algorithm]++
97- // }
98-
9998 if sysKey != nil {
10099 out .SystemKeySerial = sysKey .Serial
101100 }
You can’t perform that action at this time.
0 commit comments