Skip to content

Allow selecting which report sections to keep on export#1922

Merged
ahuang11 merged 7 commits into
holoviz:mainfrom
ghostiee-11:feat/report-export-selection
Jul 17, 2026
Merged

Allow selecting which report sections to keep on export#1922
ahuang11 merged 7 commits into
holoviz:mainfrom
ghostiee-11:feat/report-export-selection

Conversation

@ghostiee-11

@ghostiee-11 ghostiee-11 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Adds a checkbox to each report section card so users can pick which sections to keep, and the Notebook/HTML export includes only the checked ones. Default keeps every section, so existing exports are unchanged, and selection affects the export only, not the live report. Closes #1911.

Untitled.-.09.July.2026.at.15.36.06.1.mp4

Add a Section.include_in_export flag and route to_notebook/to_html
through _export_views/_export_view so a report can be exported with a
subset of its sections. Defaults keep every section included, so
existing exports are unchanged.
Render each report accordion card header as a checkbox bound to the
section include_in_export flag next to its title, so users can pick
which sections to keep before exporting. The checkbox appears once the
report has outputs and leaves the rendered report unchanged.
@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.31461% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.39%. Comparing base (eaf1c6d) to head (7471b15).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
lumen/ai/report.py 97.53% 2 Missing ⚠️
lumen/tests/ai/test_report.py 98.96% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1922      +/-   ##
==========================================
+ Coverage   71.22%   71.39%   +0.17%     
==========================================
  Files         198      198              
  Lines       34163    34403     +240     
==========================================
+ Hits        24332    24562     +230     
- Misses       9831     9841      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Apply the HoloViz cleanup review: replace the list-building loop in
Report._export_views with a comprehension. No behavior change.
@ghostiee-11
ghostiee-11 marked this pull request as ready for review July 9, 2026 10:55
@ghostiee-11
ghostiee-11 requested a review from ahuang11 July 9, 2026 10:55
@ahuang11

ahuang11 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks! A few thoughts:

  1. is left / right side a better location for check box?
  2. should we allow reordering?
  3. maybe we can not keep the Report section as is, but append a story section and utilize https://panel.holoviz.org/reference/widgets/JSONEditor.html separately for the story portion... imagine you want multiple, nested headings, and reordering the tables based on what you want to present first. JSONEditor is the only widget I know that allows you to reorder

@ghostiee-11

ghostiee-11 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review Andrew,

  1. As a user, I would like to see the checkbox on the left as it is easily visible with the section properly

  2. reordering would be nice, but Accordion doesn't do it natively so it needs custom drag. it also overlaps with the dashboard export i'm adding where EditableTemplate already gives drag reorder. want it in the report view too, or is the dashboard enough?

  3. checked out JSONEditor and yeah it fits, tree mode lets you nest headings and reorder (drag + the sort/transform menu), and value is bidirectional so we can read the arranged structure back and render it. So the idea is a separate story section arranged in a JSONEditor, replacing the inline story ( As done in Annotate reports with an AI-written story #1923)?

@ghostiee-11

Copy link
Copy Markdown
Collaborator Author

I guess this pr is only about the checkbox selction thing, if everything clean can merge this @ahuang11, the #1923 PR where i addressed the reordering and JSON thing

Comment thread lumen/ai/report.py Outdated
Comment on lines +628 to +642
@property
def _export_views(self):
"""
The flat list of views to include when exporting. Overridden by
subclasses that support selecting which parts to export.
"""
return self.views

def _export_view(self):
"""
The renderable view to save when exporting to HTML. Overridden by
subclasses that support selecting which parts to export.
"""
return self._view

@ahuang11 ahuang11 Jul 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these necessary? Seems like unnecessary wrappers?

@ahuang11

ahuang11 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

I guess if you have the JSONEditor, is the checkboxes still necessary because you can remove nodes

image

@ghostiee-11

Copy link
Copy Markdown
Collaborator Author

Yes, using the JSON editor, we can remove the nodes. While making the video, I also considered this, and for the ease of the UI/UX, we should have checkboxes imo.

Only Report is ever exported, so the base TaskGroup _export_views /
_export_view wrappers (which just returned self.views / self._view) were
dead code. Drop them and move to_notebook / to_html onto Report next to
its _export_views / _export_view overrides.
@ghostiee-11
ghostiee-11 requested a review from ahuang11 July 10, 2026 10:30
@ahuang11

Copy link
Copy Markdown
Contributor

Really close to merge! While testing, I noticed nested sections are not selectable.

image

Nested sections rendered without a checkbox because only the report drew section headers, and the export read each top level section's aggregated views, so a nested section's selection was ignored. Render a heading and checkbox for nested sections, and walk the tasks when collecting the views so a discarded section is left out of the notebook and the HTML at any depth.
Selection only reached whole sections, so two charts made in one session could not be kept or dropped separately. Move include_in_export onto Task and give every task its own checkbox, and walk the tasks when collecting the views so discarding one chart leaves the rest of its section intact. The report explains the checkboxes at the top rather than on a per-checkbox info icon.
@ghostiee-11

Copy link
Copy Markdown
Collaborator Author
Screenshot 2026-07-17 at 9 35 39 PM

@ghostiee-11

Copy link
Copy Markdown
Collaborator Author

@ahuang11, you can review it..

@ahuang11
ahuang11 merged commit 77536c1 into holoviz:main Jul 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow users to select charts to keep / discard in exported Report

2 participants