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

feat(native-filters): add markers and number formatter to range filter #14981

Merged
merged 1 commit into from Jun 4, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Jun 4, 2021

SUMMARY

Small improvements to range filter:

  • Add smart number formatter to make ranges more legible.
  • When lower and upper bounds are at min/max, assume no filter should be emitted. Also when either lower or upper bound is greater/smaller than min/max, only emit single filter.
  • Add custom label using formatter.
  • Add markers that indicate when lower/upper bound is being applied (also using number formatter).

Also:

  • Added story book entry
  • Added simple test case

(both story and test cases can be expanded later)

BEFORE

range_v1.mp4

AFTER

range.mp4

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@villebro villebro changed the title feat(native-filters): add markers and number formatter + simple tests feat(native-filters): add markers and number formatter to range + simple tests Jun 4, 2021
@villebro villebro changed the title feat(native-filters): add markers and number formatter to range + simple tests feat(native-filters): add markers and number formatter to range filter Jun 4, 2021
Comment on lines -67 to -72
useEffect(() => {
handleAfterChange(defaultValue ?? [min, max]);
// I think after Config Modal update some filter it re-creates default value for all other filters
// so we can process it like this `JSON.stringify` or start to use `Immer`
}, [JSON.stringify(defaultValue)]);

Copy link
Member Author

@villebro villebro Jun 4, 2021

Choose a reason for hiding this comment

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

defaultValue is now converted into filterState by the application, hence it doesn't need to be handled here

@codecov
Copy link

codecov bot commented Jun 4, 2021

Codecov Report

Merging #14981 (be13da5) into master (61a438a) will increase coverage by 0.06%.
The diff coverage is 87.09%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14981      +/-   ##
==========================================
+ Coverage   77.53%   77.60%   +0.06%     
==========================================
  Files         965      965              
  Lines       49504    49530      +26     
  Branches     6259     6267       +8     
==========================================
+ Hits        38384    38438      +54     
+ Misses      10920    10891      -29     
- Partials      200      201       +1     
Flag Coverage Δ
javascript 72.63% <87.09%> (+0.15%) ⬆️

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

Impacted Files Coverage Δ
...src/filters/components/Range/RangeFilterPlugin.tsx 88.67% <87.09%> (+88.67%) ⬆️
...end/src/filters/components/Range/transformProps.ts 100.00% <0.00%> (+87.50%) ⬆️

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 61a438a...be13da5. Read the comment docs.

@villebro villebro requested a review from kgabryje June 4, 2021 12:20
@kgabryje
Copy link
Member

kgabryje commented Jun 4, 2021

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2021

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

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM!

@villebro villebro merged commit 355223d into apache:master Jun 4, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jun 4, 2021

Ephemeral environment shutdown and build artifacts deleted.

@villebro villebro deleted the villebro/range-fixes branch June 4, 2021 13:23
@junlincc junlincc added the dashboard:native-filters Related to the native filters of the Dashboard label Jun 4, 2021
amitmiran137 added a commit to nielsen-oss/superset that referenced this pull request Jun 6, 2021
* upstream/master: (68 commits)
  fix typos (apache#14950)
  docs: fix custom oauth config (apache#14997)
  fix: apply template_params on external_metadata (apache#14996)
  fix: toggle fullscreen on the dashboard (apache#14979)
  feat(native-filters): add markers and number formatter + simple tests (apache#14981)
  fix(native-filters): Fix "undefined" error after editing a filter (apache#14984)
  fix(native-filters): remove implied fetch predicate (apache#14982)
  fix(native-filters): update cascaded filter state on change (apache#14980)
  fix(filter box): replace freeform where clause with ilike (apache#14900)
  refactor: Convert TableElement.jsx component from class to functional with hooks (apache#14830)
  fix: renamed sqllab filters to _filters (apache#14971)
  feat(native-filters): apply cascading without instant filtering (apache#14966)
  chore: bump superset-ui to 0.17.53 (apache#14968)
  fix(native-filters): cascading filters not rendering in tab (apache#14964)
  feat: add type_generic and is_dttm to table metadata (apache#14863)
  additional safeguard (apache#14953)
  feat: Adding FORCE_SSL as feature flag in config.py (apache#14934)
  feat(dashboard/native-filters): Hide filters out of scope of current tab (apache#14933)
  fix: time parser truncate to first day of year/month (apache#14945)
  fix: is_temporal should overwrite is_dttm (apache#14894)
  ...
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 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 dashboard:native-filters Related to the native filters of the Dashboard preset-io size/L 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants