fix(ui): normalize screenshot field names in run detail load function

API returns 'screenshot_paths' but frontend template reads 'screenshots'.
Without field mapping, screenshots are never displayed.

Fix: map screenshot_paths -> screenshots and logs_sent_to_llm -> logs_sent
in the +page.js load function.

Also verifies that /api/storage/file endpoint exists (mounted at /api/storage)
and the frontend API_BASE_URL='/api' correctly prefixes /storage/file.
This commit is contained in:
2026-06-01 08:44:28 +03:00
parent f388961b9f
commit 79d8d5f7bb

View File

@@ -19,7 +19,13 @@ export async function load({ params }) {
// Normalise shape: merge records into run as dashboards for the report page
const run = runDetail.run || runDetail;
const records = runDetail.records || [];
run.dashboards = records;
// Normalise field names from backend API shape to frontend template keys
run.dashboards = records.map((rec) => ({
...rec,
screenshots: rec.screenshots || rec.screenshot_paths || rec.tab_screenshots || [],
logs_sent: rec.logs_sent || rec.logs_sent_to_llm || [],
}));
return { run };
}