v20260104-14-reports-stats-total-runs-success-rate-fix #28

Merged
ivooskamp merged 22 commits from v20260104-14-reports-stats-total-runs-success-rate-fix into main 2026-01-13 10:59:39 +01:00
4 changed files with 23 additions and 3 deletions
Showing only changes of commit 609364ef2f - Show all commits

View File

@ -1 +1 @@
v20260103-20-reports-export-html-open-new-tab v20260104-01-reports-output-format-save-fix

View File

@ -139,9 +139,12 @@ def api_reports_create():
name = (payload.get("name") or "").strip() or "Report" name = (payload.get("name") or "").strip() or "Report"
description = (payload.get("description") or "").strip() or None description = (payload.get("description") or "").strip() or None
report_type = (payload.get("report_type") or "one-time").strip() or "one-time" report_type = (payload.get("report_type") or "one-time").strip() or "one-time"
output_format = (payload.get("output_format") or "csv").strip() or "csv" output_format = (payload.get("output_format") or "csv").strip().lower() or "csv"
schedule = (payload.get("schedule") or "").strip() or None schedule = (payload.get("schedule") or "").strip() or None
if output_format not in ("csv", "html", "pdf"):
return {"error": "Invalid output_format. Use csv, html, or pdf."}, 400
report_config = payload.get("report_config") report_config = payload.get("report_config")
if report_config is not None and not isinstance(report_config, (dict, list, str)): if report_config is not None and not isinstance(report_config, (dict, list, str)):
report_config = None report_config = None
@ -406,6 +409,7 @@ def api_reports_update(report_id: int):
- name - name
- description - description
- report_config - report_config
- output_format
""" """
err = _require_reporting_role() err = _require_reporting_role()
if err is not None: if err is not None:
@ -420,6 +424,13 @@ def api_reports_update(report_id: int):
desc = (payload.get("description") or "").strip() desc = (payload.get("description") or "").strip()
report.description = desc or None report.description = desc or None
if "output_format" in payload:
fmt = (payload.get("output_format") or "").strip().lower()
if fmt:
if fmt not in ("csv", "html", "pdf"):
return {"error": "Invalid output_format. Use csv, html, or pdf."}, 400
report.output_format = fmt
if "report_config" in payload: if "report_config" in payload:
rc = payload.get("report_config") rc = payload.get("report_config")
if rc is None: if rc is None:

View File

@ -536,7 +536,7 @@ class ReportDefinition(db.Model):
# one-time | scheduled # one-time | scheduled
report_type = db.Column(db.String(32), nullable=False, default="one-time") report_type = db.Column(db.String(32), nullable=False, default="one-time")
# csv | pdf (pdf is future) # csv | html | pdf
output_format = db.Column(db.String(16), nullable=False, default="csv") output_format = db.Column(db.String(16), nullable=False, default="csv")
# customer scope for report generation # customer scope for report generation

View File

@ -181,6 +181,15 @@
- Changed HTML report handling to open in a new browser tab instead of triggering a file download. - Changed HTML report handling to open in a new browser tab instead of triggering a file download.
- Enabled proper inline rendering of HTML reports to support graphical preview and layout validation. - Enabled proper inline rendering of HTML reports to support graphical preview and layout validation.
---
## v20260104-01-reports-output-format-save-fix
- Fixed an issue where the selected report output format (HTML/PDF) was not persisted when saving or editing a report.
- The report update endpoint now correctly stores the chosen output_format instead of always reverting to CSV.
- Added validation and normalization for output_format values during report creation and update.
- Ensured that selecting HTML as output no longer results in CSV being generated or downloaded.
================================================================================================================================================ ================================================================================================================================================
## v0.1.15 ## v0.1.15