- export_xlsx: use request.get_json(silent=True) so a POST with no JSON
content-type no longer raises 415/500 (returns 400/404/501 as intended).
- api_tests: register the FAB-generated can_export_xlsx permission in
test_info_security_dashboard; replace the gamma test (Gamma has can_export)
with a deterministic 404-for-inaccessible-dashboard check.
- type-annotate dict literals in the filter-context tests (mypy var-annotated).
- move MenuWrapperWithProps above first use (oxlint no-use-before-define).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the async task that exports a dashboard's chart data to a multi-sheet xlsx.
Running as the requesting user, it walks charts in layout order, re-runs each
saved query context with the live filter state applied, streams results into a
constant-memory workbook, uploads to S3, and emails a pre-signed link. Charts
with no/invalid query context or a failing query are skipped and listed in the
email; all-skipped dashboards get a summary sheet. On failure (incl. soft
timeout) it emails the user and always cleans up the temp file. Registers the
task in CeleryConfig.imports. Adds unit tests for happy path, skips, summary,
upload failure, and timeout.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add email rendering/delivery for dashboard Excel exports: success and failure
HTML bodies (inline styles only, no logo, matching report-notification emails),
subject lines prefixed with EMAIL_REPORTS_SUBJECT_PREFIX, and a send wrapper
over send_email_smtp. Dashboard titles and chart names are HTML-escaped to
prevent injection. Adds unit tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add superset.utils.s3 with upload_file_to_s3() (boto3 managed multipart) and
generate_presigned_url(). Credentials/region come from the standard boto3 chain;
operators can override client construction via EXCEL_EXPORT_S3_CLIENT_KWARGS
(e.g. endpoint_url for MinIO/LocalStack). Adds unit tests with mocked boto3.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add get_charts_in_layout_order(), a depth-first walk of a dashboard's
position_json that returns its charts in visual order including tab-nested
charts. De-duplicates charts placed more than once, skips stale layout entries
with no backing chart, and appends charts absent from the layout at the end
ordered by id. Guards against cyclic layouts. Adds unit tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add StreamingXlsxWriter, a constant-memory xlsxwriter wrapper that writes one
sheet per chart row-by-row, so multi-chart dashboard exports never hold more
than one row per sheet in memory. Includes sheet-name sanitization (forbidden
chars, 31-char cap, reserved 'History', case-insensitive de-duplication) and
per-cell sanitization (formula-injection quoting mirroring excel.quote_formulas,
Excel int/float precision limits, ISO temporal rendering). Reuses the neutral
document properties from utils.excel. Adds unit tests with an openpyxl
round-trip.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extend get_dashboard_filter_context with an optional active_data_mask kwarg so
callers can resolve each in-scope native filter against live dashboard filter
state instead of saved defaults. A non-empty active extraFormData is applied,
an empty one clears the filter (no fallback to default), and filters absent
from the mask keep their defaults. Backward compatible: omitting the kwarg
reproduces initial-load behavior. Adds unit tests covering override, clear,
fallback, defaultToFirstItem, and out-of-scope cases.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extract the extra_form_data merge block from the chart data GET endpoint
into apply_extra_form_data_to_query_context_json() in dashboard_filter_context,
so it can be reused by the upcoming dashboard Excel export task. No behavior
change; adds unit tests for the extracted helper.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>