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(charts): Time range filters are not being applied to charts that were overwritten #23589

Conversation

Antonio-RiveroMartnez
Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez commented Apr 5, 2023

SUMMARY

When GENERIC_CHART_AXES FF is on and we overwrite a chart, any filter coming from the dashboard is not saved (it gets removed since its marked as isExtra). However, removing such filter doesn't have to mean we delete the original temporal filter if any, otherwise the dashboard wont be able to filter the chart again.

This PR keeps the original adhoc_filters from the slice so when calling the PUT API it doesn't get removed. So any call to api/v1/dashboard/{db_id}/charts is consistent even after you overwrite the chart.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
error

After:
test

TESTING INSTRUCTIONS

  1. Make sure GENERIC_CHART_AXES FF is ON
  2. Create a chart and add it to a dashboard.
  3. Add a time range filter to the dashboard and apply any value.
  4. Click on the chart title to access it in the Chart Builder menu.
  5. Overwrite the chart (no changes are needed).
  6. Go back to the dashboard, and apply any time range filter.
  7. The filter must keep working after overwriting the chart

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: GENERIC_CHART_AXES
  • 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 Apr 5, 2023

Codecov Report

Merging #23589 (ccfc2d1) into master (117360c) will increase coverage by 0.00%.
The diff coverage is 65.75%.

❗ Current head ccfc2d1 differs from pull request most recent head 252ff04. Consider uploading reports for the commit 252ff04 to get more accurate results

@@           Coverage Diff           @@
##           master   #23589   +/-   ##
=======================================
  Coverage   67.72%   67.73%           
=======================================
  Files        1916     1916           
  Lines       74029    74056   +27     
  Branches     8040     8040           
=======================================
+ Hits        50135    50159   +24     
- Misses      21846    21849    +3     
  Partials     2048     2048           
Flag Coverage Δ
javascript 53.97% <68.75%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...t-frontend/src/dashboard/reducers/nativeFilters.ts 39.28% <0.00%> (-1.46%) ⬇️
...et-frontend/src/dashboard/actions/nativeFilters.ts 42.55% <33.33%> (+0.16%) ⬆️
...eFilters/FiltersConfigModal/FiltersConfigModal.tsx 63.81% <33.33%> (+0.18%) ⬆️
superset/db_engine_specs/bigquery.py 69.54% <45.45%> (-0.18%) ⬇️
superset/utils/csv.py 96.66% <50.00%> (-1.61%) ⬇️
superset/views/core.py 74.75% <88.88%> (+0.16%) ⬆️
...t-frontend/src/explore/actions/saveModalActions.js 98.75% <100.00%> (+1.41%) ⬆️
superset/charts/commands/export.py 94.11% <100.00%> (ø)
superset/charts/post_processing.py 90.00% <100.00%> (+0.21%) ⬆️
...erset/dashboards/commands/importers/v1/__init__.py 98.63% <100.00%> (+0.10%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

- Stop deleting the adhoc_filters when overwriting a chart so the dashboards can keep filtering it
- Add tests for the changed function
Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

LGTM!

@geido
Copy link
Member

geido commented Apr 7, 2023

/testenv up FEATURE_GENERIC_CHART_AXES=true

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2023

@geido Ephemeral environment spinning up at http://34.211.159.8:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@Antonio-RiveroMartnez Antonio-RiveroMartnez merged commit 1f3774d into apache:master Apr 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2023

Ephemeral environment shutdown and build artifacts deleted.

jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Apr 10, 2023
john-bodley added a commit to airbnb/superset-fork that referenced this pull request May 12, 2023
john-bodley added a commit to airbnb/superset-fork that referenced this pull request May 16, 2023
@justinpark
Copy link
Member

@Antonio-RiveroMartnez There's a regression from this change.
With this change, user cannot remove the applied adhoc_filters. (Please see the following video. It keeps reverting back the filter option)

adhoc_filters.regression.mov

@Antonio-RiveroMartnez
Copy link
Member Author

Hey @justinpark thanks for letting me know. I will have a look as soon as possible 😎

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

Successfully merging this pull request may close these issues.

None yet

5 participants