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: send data embedded in report email #15805

Merged
merged 8 commits into from Jul 28, 2021

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Jul 20, 2021

SUMMARY

This PR introduces a new category of reports for charts, "TEXT":

Screen Shot 2021-07-27 at 11 46 00 AM

The option shows up for a small subset of the charts types that present data in textual format: t-test, pivot table and table.

When the report is sent as text the data is embedded directly in the email as an HTML table:

Screen Shot 2021-07-27 at 11 32 56 AM

Finally, I also noticed that we were passing HTML from the description directly to the email without escaping it. This was fixed by using the bleach library.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@codecov
Copy link

codecov bot commented Jul 20, 2021

Codecov Report

Merging #15805 (cedbdbf) into master (2ce676d) will decrease coverage by 0.05%.
The diff coverage is 85.71%.

❗ Current head cedbdbf differs from pull request most recent head 2c58e4d. Consider uploading reports for the commit 2c58e4d to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15805      +/-   ##
==========================================
- Coverage   76.91%   76.85%   -0.06%     
==========================================
  Files         986      986              
  Lines       51993    52008      +15     
  Branches     7090     7090              
==========================================
- Hits        39988    39973      -15     
- Misses      11779    11809      +30     
  Partials      226      226              
Flag Coverage Δ
hive ?
mysql 81.40% <100.00%> (+0.01%) ⬆️
postgres 81.43% <100.00%> (+0.01%) ⬆️
presto 81.16% <100.00%> (?)
python 81.69% <100.00%> (-0.11%) ⬇️
sqlite 81.07% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/views/CRUD/alert/types.ts 100.00% <ø> (ø)
superset/reports/api.py 87.78% <ø> (ø)
...frontend/src/views/CRUD/alert/AlertReportModal.tsx 61.70% <50.00%> (ø)
superset/models/reports.py 100.00% <100.00%> (ø)
superset/reports/commands/execute.py 92.46% <100.00%> (+0.29%) ⬆️
superset/reports/notifications/base.py 95.65% <100.00%> (+0.19%) ⬆️
superset/reports/notifications/email.py 100.00% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 69.80% <0.00%> (-16.87%) ⬇️
superset/utils/core.py 88.15% <0.00%> (-0.13%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2ce676d...2c58e4d. Read the comment docs.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 27, 2021
@@ -74,7 +75,7 @@ export type AlertObject = {
owners?: Array<Owner | MetaObject>;
sql?: string;
recipients?: Array<Recipient>;
report_format?: 'PNG' | 'CSV';
report_format?: 'PNG' | 'CSV' | 'TEXT';
Copy link
Member

Choose a reason for hiding this comment

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

what did you think about calling this 'HTML' instead of TEXT? cc @yousoph

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 for email HTML makes sense, but not for Slack (since it's not technically HTML).

Copy link
Member

Choose a reason for hiding this comment

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

Let's stick with "text" then :)

@@ -770,6 +784,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
};

const onChartChange = (chart: SelectValue) => {
getChartVisualizationType(chart);
Copy link
Member

Choose a reason for hiding this comment

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

would it be easier to update the api that fetches the list of charts to include the chart type?

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my initial attempt, but it seems like the related objects come back only with ID and name, and it seems I would need to change FAB itself.

Copy link
Member

Choose a reason for hiding this comment

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

ok, gotcha. sounds good.

@betodealmeida betodealmeida merged commit 3adf8e8 into apache:master Jul 28, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* feat: send data embedded in report email

* Prettify table

* Change post-processing to use new endpoint

* Show text option only for text viz

* Show TEXT option only to text-based vizs

* Fix test

* Add email test

* Add unit test
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
* feat: send data embedded in report email

* Prettify table

* Change post-processing to use new endpoint

* Show text option only for text viz

* Show TEXT option only to text-based vizs

* Fix test

* Add email test

* Add unit test
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* feat: send data embedded in report email

* Prettify table

* Change post-processing to use new endpoint

* Show text option only for text viz

* Show TEXT option only to text-based vizs

* Fix test

* Add email test

* Add unit test
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* feat: send data embedded in report email

* Prettify table

* Change post-processing to use new endpoint

* Show text option only for text viz

* Show TEXT option only to text-based vizs

* Fix test

* Add email test

* Add unit test
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 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/L 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants