mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 10:41:14 +00:00
Review feedback
This commit is contained in:
@@ -153,25 +153,28 @@ func OriginTable(r report.Report, originID string) (Table, bool) {
|
||||
|
||||
func connectionDetailsRows(topology report.Topology, originID string) []Row {
|
||||
rows := []Row{}
|
||||
|
||||
labeler := func(nodeID string) string {
|
||||
labeler := func(nodeID string) (string, bool) {
|
||||
if _, addr, port, ok := report.ParseEndpointNodeID(nodeID); ok {
|
||||
return fmt.Sprintf("%s:%s", addr, port)
|
||||
return fmt.Sprintf("%s:%s", addr, port), true
|
||||
}
|
||||
if _, addr, ok := report.ParseAddressNodeID(nodeID); ok {
|
||||
return addr
|
||||
return addr, true
|
||||
}
|
||||
return ""
|
||||
return "", false
|
||||
}
|
||||
local, ok := labeler(originID)
|
||||
if !ok {
|
||||
return rows
|
||||
}
|
||||
|
||||
local := labeler(originID)
|
||||
adjacencies := topology.Adjacency[report.MakeAdjacencyID(originID)]
|
||||
sort.Strings(adjacencies)
|
||||
for _, nodeID := range adjacencies {
|
||||
rows = append(rows, Row{
|
||||
Key: local,
|
||||
ValueMajor: labeler(nodeID),
|
||||
})
|
||||
if remote, ok := labeler(nodeID); ok {
|
||||
rows = append(rows, Row{
|
||||
Key: local,
|
||||
ValueMajor: remote,
|
||||
})
|
||||
}
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user