feat: add report_export widget and enhance report generation capabilities
Deploy Development / deploy (push) Successful in 1m4s
Build Test / pytest-backend (push) Successful in 5s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 19s

- Introduced the `report_export` widget to the dashboard, allowing users to generate structured PDF reports.
- Updated widget configuration to include `report_export` in the allowed widgets and added validation for its configuration.
- Enhanced the widget catalog with details for the new `report_export` entry.
- Implemented API endpoints for managing report profiles and generating PDFs.
- Added frontend components for configuring and displaying report settings.
- Updated tests to ensure proper validation and functionality of the new report generation features.
- Bumped application version to reflect the addition of the new widget and related functionalities.
This commit is contained in:
Lars committed 2026-04-29 11:28:04 +02:00
1 parent 141df021c1
commit 62729d0648
22 files changed
+1389 -7

No files matched your search

+32
View File
@@ -266,6 +266,38 @@ export const api = {
window.URL.revokeObjectURL(url)
},
// Strukturierter PDF-Bericht (Profil v1, unabhängig vom Dashboard)
getReportsCatalog: () => req('/reports/catalog'),
getReportProfile: () => req('/reports/profile'),
putReportProfile: (profile) => req('/reports/profile', jput(profile)),
resetReportProfile: () => req('/reports/profile', { method: 'DELETE' }),
generateStructuredReportPdf: async () => {
const res = await fetch(`${BASE}/reports/generate-pdf`, { method: 'POST', headers: hdrs() })
if (!res.ok) {
let msg = `HTTP ${res.status}`
try {
const d = await res.json()
msg = formatFastApiDetail(d.detail, msg)
} catch {
const t = await res.text()
if (t) msg = t
}
throw new Error(msg)
}
const cd = res.headers.get('Content-Disposition') || ''
const m = /filename="([^"]+)"/.exec(cd)
const filename = m ? m[1] : `mitai-bericht-${new Date().toISOString().split('T')[0]}.pdf`
const blob = await res.blob()
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = filename
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
},
// Admin
adminListProfiles: () => req('/admin/profiles'),
adminCreateProfile: (d) => req('/admin/profiles',json(d)),