Exemplo n.º 1
0
func DrawPool(graph *ggv.Graph, name string, p Pool) {
	fpath := poolPath + "/" + name
	attr := map[string]string{}
	lbl := " | <f1> HealthCheckEvery : " + p.HealthCheckEvery + " | <f2> Degraded : " + p.Degraded +
		" | <f3> Critical : " + p.Critical + " | <f4> Healthz : " + p.Healthz + " | <f5> Request : " + p.Request

	attr["shape"] = "record"
	attr["label"] = "\"{ <f0>" + name + lbl + "} \""
	attr["color"], attr["fillcolor"], attr["fontcolor"] = GetColorAttr(fpath)
	attr["fontname"] = font
	attr["style"] = "\"filled\""
	graph.AddNode(graphName, "\""+fpath+"\"", attr)
}
Exemplo n.º 2
0
func DrawTrie(graph *ggv.Graph, name string, t Trie) {
	fpath := triePath + "/" + name
	attr := map[string]string{}
	lbl := " | <f1> Rules : "
	for _, v := range t.Rules {
		lbl = lbl + v + ", "
	}
	lbl = lbl[0 : len(lbl)-2]
	attr["shape"] = "record"
	attr["label"] = "\"{ <f0>" + name + lbl + "} \""
	attr["color"], attr["fillcolor"], attr["fontcolor"] = GetColorAttr(fpath)
	attr["fontname"] = font
	attr["style"] = "\"filled\""
	graph.AddNode(graphName, "\""+fpath+"\"", attr)
}
Exemplo n.º 3
0
func DrawHosts(graph *ggv.Graph, parentName string, hosts []string) {
	fpath := poolPath + "/" + parentName + "/hosts"
	attr := map[string]string{}
	lbl := ""
	i := 1
	for _, v := range hosts {
		lbl = lbl + "| <f" + strconv.FormatInt(int64(i), 10) + "> " + v + " "
	}
	attr["shape"] = "record"
	attr["label"] = "\"{ <f0> Hosts " + lbl + "} \""
	attr["color"], attr["fillcolor"], attr["fontcolor"] = GetColorAttr(fpath)
	attr["fontname"] = font
	attr["style"] = "\"filled\""
	graph.AddNode(graphName, "\""+fpath+"\"", attr)
	graph.AddEdge("\""+poolPath+"/"+parentName+"\"", "\""+fpath+"\"", true, PoolEdgeAttr)
}
Exemplo n.º 4
0
func DrawRule(graph *ggv.Graph, name string, r Rule) {
	fpath := rulePath + "/" + name
	attr := map[string]string{}
	lbl := " | <f1> Type : " + r.Type + " | <f2> Value : " + r.Value
	if r.Pool != "" {
		lbl = lbl + "| <f3> " + StrikethroughString("Next : "+r.Next) + " | <f4> Pool : " + r.Pool
	} else {
		lbl = lbl + "| <f3> Next : " + r.Next + " | <f4> " + StrikethroughString("Pool : "+r.Pool)
	}
	attr["shape"] = "record"
	attr["label"] = "\"{ <f0>" + name + lbl + "} \""
	attr["color"], attr["fillcolor"], attr["fontcolor"] = GetColorAttr(fpath)
	attr["fontname"] = font
	attr["style"] = "\"filled\""
	graph.AddNode(graphName, "\""+fpath+"\"", attr)
}