Show teams in the workflow mermaid graph
This commit is contained in:
@@ -15,12 +15,19 @@ private let stateColors: [RunStage.StatePayload: NodeColors] = [
|
||||
.discarded: NodeColors(fill: Palette.dangerTint, stroke: Palette.danger, text: Palette.text),
|
||||
]
|
||||
|
||||
private func stageSteps(_ steps: [WorkflowStep]) -> [WorkflowStep] {
|
||||
steps.flatMap { s in s.order.map(stageSteps) ?? s.parallel.map(stageSteps) ?? [s] }
|
||||
}
|
||||
|
||||
private func stageGraph(_ run: WorkflowRun) -> Flowchart {
|
||||
var chart = Flowchart(direction: .td)
|
||||
let steps = Dictionary(stageSteps(run.definition.steps).map { ($0.stage ?? "", $0) }, uniquingKeysWith: { a, _ in a })
|
||||
for (i, s) in run.stages.enumerated() {
|
||||
let id = "s\(i)"
|
||||
let colors = stateColors[s.state]!
|
||||
chart.node(id, label: s.name, shape: .box)
|
||||
chart.nodes[id]!.style = stateColors[s.state]!
|
||||
chart.nodes[id]!.style = colors
|
||||
chart.nodes[id]!.members = teamNodes(id, steps[s.name]?.agents, stroke: colors.stroke)
|
||||
}
|
||||
let ids = Dictionary(run.stages.enumerated().map { ($0.element.name, "s\($0.offset)") }, uniquingKeysWith: { a, _ in a })
|
||||
for s in run.stages {
|
||||
|
||||
Reference in New Issue
Block a user