mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-10 08:40:28 +00:00
Improve formatting of dot: dashed grey for unknown nodes, sans-serif text
This commit is contained in:
parent
dc841c550b
commit
bc37d4fb76
@ -583,10 +583,10 @@ func (a *admin) getResponse_dot() []byte {
|
|||||||
infos[info.key] = info
|
infos[info.key] = info
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addInfo(dht, "fillcolor=\"#ffffff\" style=filled", "Known in DHT") // white
|
addInfo(dht, "fillcolor=\"#ffffff\" style=filled fontname=\"sans serif\"", "Known in DHT") // white
|
||||||
addInfo(sessions, "fillcolor=\"#acf3fd\" style=filled", "Open session") // blue
|
addInfo(sessions, "fillcolor=\"#acf3fd\" style=filled fontname=\"sans serif\"", "Open session") // blue
|
||||||
addInfo(peers, "fillcolor=\"#ffffb5\" style=filled", "Connected peer") // yellow
|
addInfo(peers, "fillcolor=\"#ffffb5\" style=filled fontname=\"sans serif\"", "Connected peer") // yellow
|
||||||
addInfo(append([]admin_nodeInfo(nil), *self), "fillcolor=\"#a5ff8a\" style=filled", "This node") // green
|
addInfo(append([]admin_nodeInfo(nil), *self), "fillcolor=\"#a5ff8a\" style=filled fontname=\"sans serif\"", "This node") // green
|
||||||
// Get coords as a slice of strings, FIXME? this looks very fragile
|
// Get coords as a slice of strings, FIXME? this looks very fragile
|
||||||
coordSlice := func(coords string) []string {
|
coordSlice := func(coords string) []string {
|
||||||
tmp := strings.Replace(coords, "[", "", -1)
|
tmp := strings.Replace(coords, "[", "", -1)
|
||||||
@ -605,7 +605,7 @@ func (a *admin) getResponse_dot() []byte {
|
|||||||
}
|
}
|
||||||
newInfo.name = "?"
|
newInfo.name = "?"
|
||||||
newInfo.key = key
|
newInfo.key = key
|
||||||
newInfo.options = "style=dashed"
|
newInfo.options = "fontname=\"sans serif\" style=dashed color=\"#999999\" fontcolor=\"#999999\""
|
||||||
infos[key] = newInfo
|
infos[key] = newInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -650,7 +650,11 @@ func (a *admin) getResponse_dot() []byte {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
port := coordsSplit[len(coordsSplit)-1]
|
port := coordsSplit[len(coordsSplit)-1]
|
||||||
put(fmt.Sprintf(" \"%+v\" -> \"%+v\" [ label = \"%v\" ];\n", info.parent, info.key, port))
|
style := "fontname=\"sans serif\""
|
||||||
|
if infos[info.parent].name == "?" || infos[info.key].name == "?" {
|
||||||
|
style = "fontname=\"sans serif\" style=dashed color=\"#999999\" fontcolor=\"#999999\""
|
||||||
|
}
|
||||||
|
put(fmt.Sprintf(" \"%+v\" -> \"%+v\" [ label = \"%v\" %s ];\n", info.parent, info.key, port, style))
|
||||||
}
|
}
|
||||||
put("}\n")
|
put("}\n")
|
||||||
return out
|
return out
|
||||||
|
Loading…
Reference in New Issue
Block a user