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

fix: new alert should have force_screenshot be true #18182

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Jan 26, 2022

SUMMARY

From feature #17853, when a chart alert condition is matched, Superset will do force_refresh query and generate a screenshot. We also had db migration to set all chart alerts' force_refresh attribute be true.
But when user create new chart alert, its force_refresh is false. This PR is to fix this issue, and set force_refresh default be true when creating new chart alert.

TESTING INSTRUCTIONS

CI and manual test:

  1. create a new alert
  2. check its force_refresh value from report_scedule table.

ADDITIONAL INFORMATION

  • Has associated issue: feat: add force option to report screenshots #17853
  • 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

@codecov
Copy link

codecov bot commented Jan 26, 2022

Codecov Report

Merging #18182 (4bb4ccb) into master (fa11a97) will increase coverage by 0.23%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18182      +/-   ##
==========================================
+ Coverage   66.04%   66.27%   +0.23%     
==========================================
  Files        1591     1594       +3     
  Lines       62409    62485      +76     
  Branches     6283     6312      +29     
==========================================
+ Hits        41221    41415     +194     
+ Misses      19567    19421     -146     
- Partials     1621     1649      +28     
Flag Coverage Δ
javascript 51.34% <0.00%> (+0.48%) ⬆️

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

Impacted Files Coverage Δ
...frontend/src/views/CRUD/alert/AlertReportModal.tsx 52.23% <0.00%> (-0.30%) ⬇️
...rontend/src/explore/components/EmbedCodeButton.jsx 66.66% <0.00%> (-12.29%) ⬇️
...dashboard/components/menu/ShareMenuItems/index.tsx 65.38% <0.00%> (-8.53%) ⬇️
.../src/dashboard/components/gridComponents/Chart.jsx 58.88% <0.00%> (-4.21%) ⬇️
...uperset-frontend/src/explore/exploreUtils/index.js 63.90% <0.00%> (-3.00%) ⬇️
...nd/src/explore/components/ExploreActionButtons.tsx 57.14% <0.00%> (-2.32%) ⬇️
...et-frontend/src/explore/reducers/exploreReducer.js 33.33% <0.00%> (-1.97%) ⬇️
...tend/src/views/CRUD/data/database/DatabaseList.tsx 65.47% <0.00%> (-0.79%) ⬇️
.../src/views/CRUD/data/savedquery/SavedQueryList.tsx 63.88% <0.00%> (-0.60%) ⬇️
...c/filters/components/Select/SelectFilterPlugin.tsx 68.42% <0.00%> (-0.60%) ⬇️
... and 50 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 fa11a97...4bb4ccb. Read the comment docs.

@graceguo-supercat
Copy link
Author

ping @betodealmeida and @eschutho for code review. thanks!

const data: any = {
...currentAlert,
type: isReport ? 'Report' : 'Alert',
force_screenshot: forceScreenshot ? 'true' : 'false',
force_screenshot:
shouldEnableForceScreenshot || forceScreenshot ? 'true' : 'false',
Copy link
Member

Choose a reason for hiding this comment

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

Can we change this to boolean and update line 520 to const data: AlertObject while we are here?

cc @betodealmeida @lyndsiWilliams

Copy link
Author

Choose a reason for hiding this comment

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

i fixed force_screenshot to be boolean type. But data is not AlertObject, see line 553 ~ 559, it is temporary object carried a lot of extra fields.

@graceguo-supercat graceguo-supercat merged commit a80efa6 into apache:master Feb 3, 2022
shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
* fix: new alert should have force_screenshot be true

* fix comments
ofekisr pushed a commit to nielsen-oss/superset that referenced this pull request Feb 8, 2022
* fix: new alert should have force_screenshot be true

* fix comments
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
* fix: new alert should have force_screenshot be true

* fix comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.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/XS 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants