Show teams in the workflow mermaid graph
This commit is contained in:
@@ -92,6 +92,12 @@ private func newStage(_ root: StepNode, _ model: String) -> StepNode {
|
||||
return s
|
||||
}
|
||||
|
||||
func teamNodes(_ id: String, _ agents: [TeamMember]?, stroke: Color?) -> [FlowNode] {
|
||||
(agents ?? []).enumerated().map { i, a in
|
||||
FlowNode(id: "\(id)m\(i)", label: "\(a.name.isEmpty ? " " : a.name)\n\(a.model)", style: NodeColors(fill: Palette.bg, stroke: stroke, text: Palette.text))
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private func stepGraph(_ root: StepNode) -> Flowchart {
|
||||
var chart = Flowchart(direction: .td)
|
||||
@@ -104,6 +110,7 @@ private func stepGraph(_ root: StepNode) -> Flowchart {
|
||||
case .stage:
|
||||
let id = "n\(chart.order.count)"
|
||||
chart.node(id, label: node.name.isEmpty ? " " : node.name, shape: .box)
|
||||
chart.nodes[id]!.members = teamNodes(id, node.agents, stroke: nil)
|
||||
for b in before {
|
||||
chart.edges.append(FlowEdge(from: b, to: id, label: nil, style: .solid, arrow: true))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user