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(explore): retain chart ownership on query context update #16419

Merged
merged 1 commit into from
Aug 24, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Aug 24, 2021

SUMMARY

A feature was recently introduced to automatically populate query_context in the chart metadata if it was missing. This was necessary to be able to render V1 chart reports, which require the frontend-rendered query request (not possible by the backend). However, if a non-owner triggered the chart update command, the original ownership data was lost due to the update payload not containing the owners property. This was due to the self.populate_owners method setting the owners to whichever value was passed in the request, which in this case was always None.

This PR changes the chart update command to not modify the owners property when calling the chart update command with query_context_generation. In addition, an integration test is added to ensure that a non-owner can update the query context payload without changing the owners property (test fails on master).

TESTING INSTRUCTIONS

  1. Start a fresh installation of Superset with a newly initiated metadata database and examples data populated
  2. Login as Admin
  3. Go to the Charts page and change one of the Examples chart owners from empty to "Admin"
  4. Open the chart into Explore view
  5. Go back to Charts page and check the chart owners - notice how the owners are empty again. Set the chart owner back to Admin.
  6. Reopen the chart in Explore, go to the Charts page and notice that now Admin is still an owner.

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

@codecov
Copy link

codecov bot commented Aug 24, 2021

Codecov Report

Merging #16419 (affdd3a) into master (486ef6b) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16419      +/-   ##
==========================================
- Coverage   76.55%   76.55%   -0.01%     
==========================================
  Files        1000     1000              
  Lines       53487    53486       -1     
  Branches     6818     6818              
==========================================
- Hits        40948    40947       -1     
  Misses      12301    12301              
  Partials      238      238              
Flag Coverage Δ
hive 81.26% <50.00%> (+0.03%) ⬆️
mysql 81.52% <50.00%> (-0.01%) ⬇️
postgres 81.55% <50.00%> (-0.01%) ⬇️
presto 81.33% <50.00%> (-0.01%) ⬇️
python 82.06% <50.00%> (-0.01%) ⬇️
sqlite 81.19% <50.00%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
superset/charts/commands/update.py 88.73% <50.00%> (-0.16%) ⬇️

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 486ef6b...affdd3a. Read the comment docs.

@rusackas
Copy link
Member

Fixies issues that will reappear after merging #16408

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM, BTW, the detailed test case saves lots of review time.

@villebro villebro merged commit 3586474 into apache:master Aug 24, 2021
@villebro villebro deleted the villebro/qc-update branch August 24, 2021 15:37
henryyeh pushed a commit to preset-io/superset that referenced this pull request Aug 24, 2021
amitmiran137 pushed a commit to nielsen-oss/superset that referenced this pull request Aug 26, 2021
* upstream/master: (25 commits)
  chore(ci): bump pylint to 2.10.2 (apache#16463)
  fix: prevent page crash when chart can't render (apache#16464)
  chore: fixed slack invite link (apache#16466)
  fix(native-filters): handle null values in value filter (apache#16460)
  feat: add function list to auto-complete to Clickhouse datasource (apache#16234)
  refactor(explore): improve typing for Dnd controls (apache#16362)
  fix(explore): update overwrite button on perm change (apache#16437)
  feat: Draggable and Resizable Modal (apache#16394)
  refactor: sql_json view endpoint (apache#16441)
  fix(dashboard): undo and redo buttons weird alignment  (apache#16417)
  fix: setupPlugin in chart list page (apache#16413)
  fix: Disable Slack notification method if no api token (apache#16367)
  feat: add Shillelagh DB engine spec (apache#16416)
  fix: copy to Clipboard order (apache#16299)
  docs: make FEATURE_FLAGS.md reference a link (apache#16415)
  chore(viz): bump superset-ui to 0.17.87 (apache#16420)
  feat: add activate command (apache#16404)
  Revert "fix(explore): let admin overwrite slice (apache#16290)" (apache#16408)
  fix(explore): retain chart ownership on query context update (apache#16419)
  chore: Removes the TODOs and uses the default page size (apache#16422)
  ...
@rosemarie-chiu
Copy link
Contributor

🏷 2021.31

opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.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 preset:2021.31 preset-io size/M 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants