Link to activity instead of asset in "View on L2"

After publishing, link to /activities/{activity_id} instead of
/assets/{asset_name} so user sees the published run.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-10 18:38:07 +00:00
parent 837f9a6442
commit 3d45efa90b

View File

@@ -4064,10 +4064,14 @@ async def ui_publish_run(run_id: str, request: Request):
l2_https = l2_server.replace("http://", "https://")
asset_name = result["asset"]["name"]
short_name = asset_name[:16] + "..." if len(asset_name) > 20 else asset_name
# Link to activity (the published run) rather than just the asset
activity = result.get("activity")
activity_id = activity.get("activity_id") if activity else None
l2_link = f"{l2_https}/activities/{activity_id}" if activity_id else f"{l2_https}/assets/{asset_name}"
return HTMLResponse(f'''
<div class="bg-green-900/50 border border-green-700 text-green-300 px-4 py-3 rounded-lg mb-4">
Published to L2 as <strong>{short_name}</strong>!
<a href="{l2_https}/assets/{asset_name}" target="_blank" class="underline">View on L2</a>
<a href="{l2_link}" target="_blank" class="underline">View on L2</a>
</div>
''')
except http_requests.exceptions.HTTPError as e: