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): Filters with custom SQL disappearing #21114

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Aug 17, 2022

SUMMARY

When user added more than 1 filter with custom SQL and saved the chart, all filters with custom SQL except for the first one disappeared. This PR fixes that issue.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2022-08-17.at.18.24.45.mov

After:

Screen.Recording.2022-08-17.at.18.22.55.mov

TESTING INSTRUCTIONS

  1. Open explore and add a few filters with custom sql

  2. Save chart

  3. All added filters should still be there

  4. Open a mixed chart

  5. Add adhoc filters for both queries

  6. Save chart

  7. Make sure that adhoc filters for both queries are still there

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

@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 17, 2022
...Object.keys(filterBoxData),
...Object.keys(nativeFiltersData),
]
.filter(key => key.match(/adhoc_filter.*/))
Copy link
Member Author

Choose a reason for hiding this comment

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

handles the case of fields like adhoc_filters_b in mixed chart. Logic similar to superset/utils/core.py, line 1121

@geido
Copy link
Member

geido commented Aug 17, 2022

/testenv up

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

LGTM!

('comparator' in existingFilter &&
'comparator' in adhocFilter &&
isEqual(existingFilter.comparator, adhocFilter.comparator))),
(existingFilter: AdhocFilter) =>
Copy link
Member

@michael-s-molina michael-s-molina Aug 17, 2022

Choose a reason for hiding this comment

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

Can we split this code into equality functions for each filter type to improve readability? You can do it in a follow-up PR.

Copy link
Member

@codyml codyml left a comment

Choose a reason for hiding this comment

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

Code looks good and fix works locally for me!

@github-actions
Copy link
Contributor

@geido Container image not yet published for this PR. Please try again when build is complete.

@github-actions
Copy link
Contributor

@geido Ephemeral environment creation failed. Please check the Actions logs for details.

@kgabryje
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

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

Copy link
Member

@jinghua-qa jinghua-qa left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #21114 (74835d6) into master (94e8fd3) will increase coverage by 0.03%.
The diff coverage is 67.56%.

❗ Current head 74835d6 differs from pull request most recent head 567bd02. Consider uploading reports for the commit 567bd02 to get more accurate results

@@            Coverage Diff             @@
##           master   #21114      +/-   ##
==========================================
+ Coverage   66.27%   66.30%   +0.03%     
==========================================
  Files        1770     1772       +2     
  Lines       67543    67612      +69     
  Branches     7185     7204      +19     
==========================================
+ Hits        44764    44832      +68     
+ Misses      20940    20938       -2     
- Partials     1839     1842       +3     
Flag Coverage Δ
javascript 52.08% <90.90%> (+0.08%) ⬆️

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

Impacted Files Coverage Δ
...dashboard/components/AddSliceCard/AddSliceCard.tsx 65.90% <0.00%> (ø)
superset/config.py 91.47% <ø> (ø)
superset/examples/bart_lines.py 0.00% <0.00%> (ø)
superset/examples/birth_names.py 71.42% <0.00%> (-0.65%) ⬇️
superset/examples/country_map.py 0.00% <0.00%> (ø)
superset/examples/energy.py 0.00% <0.00%> (ø)
superset/examples/flights.py 0.00% <0.00%> (ø)
superset/examples/long_lat.py 0.00% <0.00%> (ø)
superset/examples/multiformat_time_series.py 0.00% <0.00%> (ø)
superset/examples/paris.py 0.00% <0.00%> (ø)
... and 11 more

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

@kgabryje kgabryje merged commit 55304b0 into apache:master Aug 17, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Aug 17, 2022
* fix(explore): Filters with custom SQL disappearing

* Fix adhoc filter for query b disappearing

* Improve test coverage

(cherry picked from commit 55304b0)
AnushaErrabelli pushed a commit to preset-io/superset that referenced this pull request Aug 18, 2022
* fix(explore): Filters with custom SQL disappearing

* Fix adhoc filter for query b disappearing

* Improve test coverage

(cherry picked from commit 55304b0)
@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 need:qa-review Requires QA review preset:2022.31 preset:2022.33 size/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants