Skip to content

Commit

Permalink
update: dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Oarkflow committed Nov 24, 2024
1 parent 9e334d7 commit e87803c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions dag/fiber_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand All @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions dag/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
}
Expand All @@ -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")
}
}
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit e87803c

Please sign in to comment.