mirror of
https://github.com/oarkflow/mq.git
synced 2025-11-03 13:40:42 +08:00
update: dependencies
This commit is contained in:
@@ -124,7 +124,7 @@ func (tm *DAG) Handlers(app any) {
|
||||
a.Get("/dot", func(c *fiber.Ctx) error {
|
||||
return c.Type(fiber.MIMETextPlain).SendString(tm.ExportDOT())
|
||||
})
|
||||
a.Get("/ui", func(c *fiber.Ctx) error {
|
||||
a.Get("/", func(c *fiber.Ctx) error {
|
||||
image := fmt.Sprintf("%s.svg", mq.NewID())
|
||||
defer os.Remove(image)
|
||||
|
||||
@@ -140,7 +140,6 @@ func (tm *DAG) Handlers(app any) {
|
||||
return c.Send(svgBytes)
|
||||
})
|
||||
default:
|
||||
http.Handle("/", http.FileServer(http.Dir("webroot")))
|
||||
http.Handle("/notify", tm.SetupWS())
|
||||
http.HandleFunc("/process", tm.render)
|
||||
http.HandleFunc("/request", tm.render)
|
||||
@@ -149,7 +148,7 @@ func (tm *DAG) Handlers(app any) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
fmt.Fprintln(w, tm.ExportDOT())
|
||||
})
|
||||
http.HandleFunc("/ui", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
image := fmt.Sprintf("%s.svg", mq.NewID())
|
||||
err := tm.SaveSVG(image)
|
||||
if err != nil {
|
||||
|
||||
@@ -149,7 +149,7 @@ func (tm *DAG) ExportDOT() string {
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(` node [shape=box, fontname="Helvetica", fillcolor="#B3CDE0", fontcolor="#2C3E50", fontsize=10, margin="0.25,0.15", style="rounded,filled"];`)
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(` edge [fontname="Helvetica", fontsize=12, arrowsize=0.8];`)
|
||||
sb.WriteString(` edge [fontname="Helvetica", fontsize=10, arrowsize=0.8];`)
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(` rankdir=TB;`)
|
||||
sb.WriteString("\n")
|
||||
@@ -186,7 +186,7 @@ func (tm *DAG) ExportDOT() string {
|
||||
sb.WriteString(" }\n")
|
||||
if startNodeKey := subDAG.TopologicalSort()[0]; startNodeKey != "" {
|
||||
sb.WriteString(fmt.Sprintf(
|
||||
` "%s" -> "%s%s" [label=" Connect to %s", color="#93CCEA"];`,
|
||||
` "%s" -> "%s%s" [label=" Connect to %s", color="#93CCEA"];`,
|
||||
nodeKey, subDAG.name+"_", startNodeKey, startNodeKey))
|
||||
sb.WriteString("\n")
|
||||
}
|
||||
@@ -196,7 +196,7 @@ func (tm *DAG) ExportDOT() string {
|
||||
for fromNodeKey, conditions := range tm.conditions {
|
||||
for when, then := range conditions {
|
||||
if toNode, ok := tm.nodes.Get(then); ok {
|
||||
sb.WriteString(fmt.Sprintf(` "%s" -> "%s" [label=" %s", color="purple", style=dotted, fontsize=10, arrowsize=0.6];`, fromNodeKey, toNode.ID, when))
|
||||
sb.WriteString(fmt.Sprintf(` "%s" -> "%s" [label=" %s", color="purple", style=dotted, fontsize=10, arrowsize=0.6];`, fromNodeKey, toNode.ID, when))
|
||||
sb.WriteString("\n")
|
||||
}
|
||||
}
|
||||
@@ -250,7 +250,7 @@ func renderEdges(sb *strings.Builder, node *Node, prefix ...string) {
|
||||
}
|
||||
toPrefixedID := fmt.Sprintf("%s%s", strings.Join(prefix, ""), edge.To.ID)
|
||||
sb.WriteString(fmt.Sprintf(
|
||||
` "%s" -> "%s" [label="%s%s", color="%s", style="%s"];`,
|
||||
` "%s" -> "%s" [label=" %s%s", color="%s", style="%s"];`,
|
||||
prefixedID, toPrefixedID, edge.Label, labelSuffix, edgeColor, edgeStyle))
|
||||
sb.WriteString("\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user