added export tests feature

This commit is contained in:
2026-07-29 11:26:54 -04:00
parent b07b36cccf
commit 9f141ccc8b
6 changed files with 155 additions and 14 deletions
+14
View File
@@ -39,6 +39,20 @@ export const api = {
return request('GET', `/schedule/week?${params.toString()}`)
},
getRerunTests: () => request('GET', '/tests/rerun'),
exportWindow: async (windowId) => {
const params = new URLSearchParams({ window_id: windowId })
const res = await fetch(`${BASE}/schedule/export?${params}`)
if (!res.ok) {
const err = await res.json().catch(() => ({ detail: res.statusText }))
throw new Error(err.detail || `HTTP ${res.status}`)
}
const blob = await res.blob()
const disposition = res.headers.get('Content-Disposition') ?? ''
const match = disposition.match(/filename="([^"]+)"/)
const filename = match ? match[1] : 'tests.zip'
return { blob, filename }
},
}
// Transform the flat items array from GET /api/schedule/week into the