feat: scheduled canvas PDF export - #9770
Conversation
Adds scheduled PDF exports for canvas dashboards, reusing the Report resource end-to-end. A canvas PDF report has export format 'pdf', a 'canvas' annotation, and no query; the reconciler emails the usual link-only report email, and the export page renders the canvas in the recipient's browser (via magic token) and generates the PDF with the existing client-side pipeline. Canvas filter/time state captured at scheduling time is stored in web_open_state and replayed on the export and open pages.
Shows the canvas filter bar (time range, comparison, and filter pills) in the canvas variant of the scheduled report dialog, matching the filters section in explore scheduled reports. The bar is backed by the live canvas store, which edits the page URL: the dialog snapshots the URL when it opens (replaying the report's stored state in edit mode), captures the edited state into web_open_state on submit, and restores the original URL when it closes so the dashboard behind the dialog is left unchanged.
|
@codex: review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0673f3588
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
I believe this is done? |
Yes, I tested it manually. |
- Bake the canvas's filters into the report's security rules: the dialog captures per-metrics-view filter expressions (metrics_view_filters in ReportOptions), the admin server stores them in a report annotation, and the report reconciler converts them to row-filter rules so magic-token recipients cannot query data beyond the report's filters. - Remove the pdf_include_filters/pdf_all_tabs proto fields and annotations; the PDF options are now stored as extra params in web_open_state, which is only read by the UI. - GenerateReportYAML: emit canvas/explore annotations and canvas state so generated canvas PDF report YAML passes parser validation. - Report/canvas reconcilers: use the controller directly instead of re-fetching it; propagate canvas lookup errors other than not-found. - Rename the share popover button to "Create scheduled export..." since scheduled exports deliver to Slack as well as email.
…ion time - The canvas filter bar in the scheduled report dialog is now read-only (report forms must not change the underlying dashboard view); editing returns once unified filters support in-memory editing. - Anchor relative time ranges at the report's execution time on the export page: TimeManager gains an executionTimeStore that TimeState passes through deriveInterval to MetricsViewTimeRanges' execution_time, which replaces now/latest/watermark server-side. This keeps the rendered data consistent with the scheduled run for every range format, across all of the canvas's metrics views.
|
AI review - P0 — fix before merge
P1 — should fix in this PR
P2 — small correctness/consistency
|
…et config
Canvas reports have no query and their queryArgsJson is an empty string
(the proto default), which nullish coalescing does not catch, so editing
threw on JSON.parse(""). Skip the parse for canvas reports and use || so
empty strings fall through to "{}" in getDashboardNameFromReport too.
Also removes .superset/config.json (local tooling config, committed by
mistake).
- Filter capture no longer fails open: editing falls back to the report's stored metrics_view_filters annotation when the canvas store is unavailable, and creating refuses to submit with a clear error. - Fix alerts time-zone regression: AlertDialogDeliveryTab now passes availableTimeZones to ScheduleForm (it previously passed the removed exploreName prop, reducing options to Local + UTC). - Strip the internal pdf_include_filters/pdf_all_tabs params from user-facing URLs (PDF footer link and report open redirect). - Export page no longer hangs when the canvas never resolves: a wall-clock guard surfaces an error after 60s. - Anchor at execution time from the start: CanvasProvider accepts executionTime and sets it on the store at resolution, before any component fetches a now-anchored interval. - Add pdf to the export.format enum in the project JSON schema. - Gate the metrics_view_filters annotation write on canvas being set and cap serialized filter size at 1024 bytes (mirrors magic auth tokens). - Keep the read-only filter bar in the accessibility tree: force pointer-events off on descendants instead of using inert.
|
All ten items addressed in dff754f: P0
P1 P2 |
|
@AdityaHegde AI flagging this, is this valid |
|
@pjain1 Yes that is a legit issue. @nishantmonu51 worth fixing, since clicking dashboards and going to canvas will also trigger this. This and #9770 (comment) are both P0 IMO |


Adds scheduled PDF exports for canvas dashboards, reusing the scheduled-reports machinery end-to-end. Recipients get the usual link-only report email; clicking "Download PDF file" opens the report export page, which renders the canvas in the browser (authenticated by the report's magic token) and generates the PDF with the existing client-side pipeline.
Reportwithexport.format: pdf, acanvasannotation, and nodata/query(nothing executes server-side at send time). NewEXPORT_FORMAT_PDFenum value; parser and admin server validate the combination.ReportReconciler.ResolveTransitiveAccessnow reuses the canvas transitive-access logic (extracted ascanvasTransitiveConditionResources) so magic-token recipients can query the canvas's components and metrics views.web_open_stateannotation and replayed on the export and open pages; PDF options are persisted aspdf_include_filters/pdf_all_tabsannotations (newReportOptionsfields).ScheduledReportDialog(schedule, recipients, PDF options; no query fields), a canvas-PDF branch on the report export page (CanvasPdfReportExport), and canvas support on the report open/metadata pages.TestReportCanvasResolveTransitiveAccess), and unit tests for the report form utils.