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(native-filters): Default value not shown in native filters #18963

Merged
merged 2 commits into from
Mar 1, 2022

Conversation

kgabryje
Copy link
Member

SUMMARY

When user created a new filter with a default value, that value wasn't displayed in the filter in filters panel, but could be applied to charts. This PR fixes this issue.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2022-02-28.at.14.29.23.mov

After:

Screen.Recording.2022-02-28.at.14.27.36.mov

TESTING INSTRUCTIONS

  1. Create a native filter with default value and save
  2. Verify that selected default value is displayed in the filter in filters panel
  3. Reload the page
  4. Verify that after reload the default value is still applied and visible in filter

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

@@ -288,6 +288,10 @@ const FilterBar: React.FC<FiltersBarProps> = ({
}
}, [JSON.stringify(filters), JSON.stringify(previousFilters)]);

useEffect(() => {
setDataMaskSelected(() => dataMaskApplied);
}, [JSON.stringify(dataMaskApplied), setDataMaskSelected]);
Copy link
Member

Choose a reason for hiding this comment

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

Can you use dataMaskAppliedText? It's already converting the JSON to string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! Done

@codecov
Copy link

codecov bot commented Feb 28, 2022

Codecov Report

Merging #18963 (d968fe8) into master (2bacedd) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #18963   +/-   ##
=======================================
  Coverage   66.39%   66.39%           
=======================================
  Files        1641     1641           
  Lines       63511    63512    +1     
  Branches     6421     6421           
=======================================
+ Hits        42168    42169    +1     
  Misses      19682    19682           
  Partials     1661     1661           
Flag Coverage Δ
javascript 51.00% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...board/components/nativeFilters/FilterBar/index.tsx 64.22% <100.00%> (+0.59%) ⬆️
...acy-preset-chart-deckgl/src/utilities/controls.jsx 11.11% <0.00%> (-8.89%) ⬇️
...perset-ui-chart-controls/src/utils/D3Formatting.ts 100.00% <0.00%> (ø)
...reset-chart-deckgl/src/utilities/Shared_DeckGL.jsx 84.21% <0.00%> (ø)

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 2bacedd...d968fe8. Read the comment docs.

@jinghua-qa
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

@jinghua-qa Ephemeral environment spinning up at http://52.43.101.200:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@jinghua-qa jinghua-qa added the need:qa-review Requires QA review label Feb 28, 2022
@jinghua-qa
Copy link
Member

I found an issue that in number filter, when user choose minimum or maximum for single value, the default chosen value will be off

Screen.Recording.2022-02-28.at.10.21.59.AM.mov

@michael-s-molina
Copy link
Member

@jinghua-qa @kgabryje Let's tackle the number filter problem in another PR since this is already happening on master.

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.

@kgabryje kgabryje merged commit 2072225 into apache:master Mar 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

Ephemeral environment shutdown and build artifacts deleted.

@sadpandajoe
Copy link
Contributor

🏷️ preset:2022.9

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Mar 2, 2022
…e#18963)

* fix(native-filters): Default value not shown in native filters

* Reuse stringified datamask

(cherry picked from commit 2072225)
villebro pushed a commit that referenced this pull request Apr 3, 2022
* fix(native-filters): Default value not shown in native filters

* Reuse stringified datamask

(cherry picked from commit 2072225)
@mistercrunch mistercrunch added 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.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 lts-v1 need:qa-review Requires QA review preset:2022.9 size/XS 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants