Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(report): allow capturing dashboard reports in specific state #20552

Merged
merged 1 commit into from
Jul 27, 2022

Conversation

ktmud
Copy link
Member

@ktmud ktmud commented Jun 29, 2022

SUMMARY

Depends on: #20632 , please review after it is merged. (merged)

We want to allow users to specify which tabs are selected (and potentially which filters has been applied, too) when generating dashboard reports (see #19354 ). This PR is API changes requires for this to be possible.

Previous attempts (#17749) implemented this feature with only 1 tab being selectable (and highlighted), but will generate multiple screenshots in one report.

This isn't ideal---because there would be no way to compose a view where multiple specific tabs are selected (whether nested or not). We want to generate a screenshot where the whole dashboard state is preserved, hence this approach in this PR---the report_schedule.extra saves only one dashboard state at a time (including which tabs are selected, which filters are applied, etc), then we make only one screenshot for each report that corresponds to the specific dashboard state.

If users want reports for multiple dashboard tabs, they can create multiple reports---currently we don't allow multiple reports for each user on each report, which we would need to change. This PR only changes the report schedule schema and screenshot generation process. There will be more PRs to follow to fully enable the desired feature.

Future TODOs:

  • Allow users to select tabs in the UI
  • Allow each user to create multiple reports for a dashboard

#17749 isn't used by the frontend in any way, so it should be safe to just replace it.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

We rely on unit tests.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@ktmud ktmud changed the title [WIP] feat(report): allow capturing dashboard reports in specific states [WIP] feat(report): allow capturing dashboard reports in specific state Jul 7, 2022
@ktmud ktmud force-pushed the dashboard-report-with-tabs branch from 99b7a08 to 2692a98 Compare July 12, 2022 23:13
@ktmud ktmud changed the title [WIP] feat(report): allow capturing dashboard reports in specific state feat(report): allow capturing dashboard reports in specific state Jul 12, 2022
@ktmud ktmud marked this pull request as ready for review July 12, 2022 23:18
@ktmud ktmud requested a review from a team as a code owner July 12, 2022 23:18
@codecov
Copy link

codecov bot commented Jul 12, 2022

Codecov Report

Merging #20552 (78bd489) into master (1b577d1) will decrease coverage by 0.13%.
The diff coverage is 96.34%.

❗ Current head 78bd489 differs from pull request most recent head 3047bdb. Consider uploading reports for the commit 3047bdb to get more accurate results

@@            Coverage Diff             @@
##           master   #20552      +/-   ##
==========================================
- Coverage   66.23%   66.09%   -0.14%     
==========================================
  Files        1757     1758       +1     
  Lines       66978    66987       +9     
  Branches     7117     7117              
==========================================
- Hits        44360    44273      -87     
- Misses      20801    20897      +96     
  Partials     1817     1817              
Flag Coverage Δ
hive ?
mysql 81.07% <96.34%> (+<0.01%) ⬆️
postgres 81.14% <96.34%> (+<0.01%) ⬆️
presto ?
python 81.24% <96.34%> (-0.30%) ⬇️
sqlite 79.76% <96.34%> (?)
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/dashboards/permalink/commands/create.py 92.85% <ø> (ø)
superset/reports/commands/base.py 92.30% <66.66%> (ø)
superset/models/dashboard.py 76.07% <75.00%> (-0.21%) ⬇️
superset/reports/commands/exceptions.py 97.97% <80.00%> (-0.98%) ⬇️
superset/models/helpers.py 40.78% <100.00%> (+0.52%) ⬆️
superset/reports/api.py 90.22% <100.00%> (ø)
superset/reports/commands/alert.py 96.59% <100.00%> (ø)
superset/reports/commands/bulk_delete.py 90.32% <100.00%> (ø)
superset/reports/commands/create.py 89.47% <100.00%> (+0.74%) ⬆️
superset/reports/commands/delete.py 90.32% <100.00%> (ø)
... and 28 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

@ktmud ktmud force-pushed the dashboard-report-with-tabs branch 2 times, most recently from 2df55eb to 5d6ae1d Compare July 14, 2022 00:33
@ktmud ktmud force-pushed the dashboard-report-with-tabs branch 10 times, most recently from f05debb to b04fd2e Compare July 15, 2022 01:12
@ktmud ktmud force-pushed the dashboard-report-with-tabs branch 4 times, most recently from f7adb55 to 723e9d9 Compare July 20, 2022 01:19
Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

Thanks for adding the feature. I few comments, but otherwise LGTM.

anchor = dashboard_state.get("anchor")
invalid_tab_ids = {
tab_id for tab_id in active_tabs if tab_id not in position_data
}
Copy link
Member

Choose a reason for hiding this comment

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

You could inline this as two set comprehensions via { ... } | { ... }.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think | is actually union. What I needed is set(a) - set(b).

superset/reports/commands/execute.py Outdated Show resolved Hide resolved
superset/reports/commands/execute.py Outdated Show resolved Hide resolved
superset/reports/dao.py Show resolved Hide resolved
superset/reports/models.py Show resolved Hide resolved
superset/reports/models.py Outdated Show resolved Hide resolved
tests/integration_tests/reports/utils.py Outdated Show resolved Hide resolved
@ktmud ktmud force-pushed the dashboard-report-with-tabs branch from 605cec6 to aa9e399 Compare July 22, 2022 23:02
@ktmud ktmud closed this Jul 22, 2022
@ktmud ktmud reopened this Jul 22, 2022
@ktmud ktmud force-pushed the dashboard-report-with-tabs branch 3 times, most recently from 8f39f04 to 9377aa5 Compare July 26, 2022 20:42
@ktmud ktmud force-pushed the dashboard-report-with-tabs branch from 9377aa5 to 3047bdb Compare July 26, 2022 22:29
@ktmud ktmud merged commit 4d192e6 into apache:master Jul 27, 2022
@john-bodley john-bodley deleted the dashboard-report-with-tabs branch July 27, 2022 00:04
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants