feat(graph): pipeline graph improvements — on_failure, tooltips, bus-bar connectors, skipped colouring, HTML and Mermaid output
- when: on_failure visual distinction: red circle (#d9534f), X-mark icon, dashed chip border, and Mermaid classDef; legend entry added - Job tooltip / detail panel: each chip wrapped in <g data-job="…"><title>…</title> <desc>…</desc> so SVG viewers and the HTML sidebar show stage, when, image, needs - Multi-job connector accuracy: classic mode now uses a bus-bar pattern (vertical rail at midpoint + per-job stubs) instead of one center-to-center line per stage pair - Blocked/skipped state colouring: RenderPipeline and pipelineSVG accept *cicontext.Context; skipped jobs rendered in grey (#868686) with dimmed text - Interactive HTML output (--format html): self-contained .html with inline SVG, mouse-wheel zoom, drag-to-pan, double-click reset, and a click-to-open sidebar - Mermaid pipeline output (--format mermaid): prints existing Pipeline() flowchart to stdout; suitable for mermaid.live or Markdown embedding - imageString() helper to extract image name from string or map form - 100% statement coverage maintained; 809 tests pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -105,10 +105,23 @@ func TestSanitizeID(t *testing.T) {
|
||||
func TestJobClass(t *testing.T) {
|
||||
if jobClass(model.Job{When: "manual"}) != "manual" { t.Error("manual") }
|
||||
if jobClass(model.Job{When: "delayed"}) != "delayed" { t.Error("delayed") }
|
||||
if jobClass(model.Job{When: "on_failure"}) != "on_failure" { t.Error("on_failure") }
|
||||
if jobClass(model.Job{Trigger: "x"}) != "trigger" { t.Error("trigger") }
|
||||
if jobClass(model.Job{}) != "regular" { t.Error("regular") }
|
||||
}
|
||||
|
||||
func TestPipeline_OnFailureClass(t *testing.T) {
|
||||
p := &model.Pipeline{
|
||||
Stages: []string{"cleanup"},
|
||||
Jobs: map[string]model.Job{
|
||||
"cleanup-job": {Name: "cleanup-job", Stage: "cleanup", When: "on_failure"},
|
||||
},
|
||||
}
|
||||
out := Pipeline(p)
|
||||
if !strings.Contains(out, "on_failure") { t.Error("expected on_failure class") }
|
||||
if !strings.Contains(out, "#d9534f") { t.Error("expected on_failure color in classDef") }
|
||||
}
|
||||
|
||||
// ── needsJobName ──────────────────────────────────────────────────────────────
|
||||
|
||||
func TestNeedsJobName(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user