From 0ead728fdec753ddbaa1145baa55797fa2b897aa Mon Sep 17 00:00:00 2001 From: gilesb Date: Sun, 11 Jan 2026 23:15:52 +0000 Subject: [PATCH] Fix dag_elements undefined in run detail template Add dag_elements to the get_run endpoint render call to match what the detail.html template expects. Co-Authored-By: Claude Opus 4.5 --- app/routers/runs.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/app/routers/runs.py b/app/routers/runs.py index 8a4030d..7341f70 100644 --- a/app/routers/runs.py +++ b/app/routers/runs.py @@ -171,11 +171,42 @@ async def get_run( "media_type": media_type or "application/octet-stream", }) + # Build DAG elements for visualization + dag_elements = [] + if plan and plan.get("steps"): + node_colors = { + "input": "#3b82f6", + "effect": "#8b5cf6", + "analyze": "#ec4899", + "transform": "#10b981", + "output": "#f59e0b", + "SOURCE": "#3b82f6", + "EFFECT": "#8b5cf6", + "SEQUENCE": "#ec4899", + } + for i, step in enumerate(plan["steps"]): + step_id = step.get("id", f"step-{i}") + dag_elements.append({ + "data": { + "id": step_id, + "label": step.get("name", f"Step {i+1}"), + "color": node_colors.get(step.get("type", "effect"), "#6b7280"), + } + }) + for inp in step.get("inputs", []): + dag_elements.append({ + "data": { + "source": inp, + "target": step_id, + } + }) + templates = get_templates(request) return render(templates, "runs/detail.html", request, run=run, plan=plan, artifacts=artifacts, + dag_elements=dag_elements, active_tab="runs", )