Skip to content

feat(native-filters): add option to create value in select filter#14314

Merged
villebro merged 2 commits into
apache:masterfrom
preset-io:villebro/native-select-creatable
Apr 24, 2021
Merged

feat(native-filters): add option to create value in select filter#14314
villebro merged 2 commits into
apache:masterfrom
preset-io:villebro/native-select-creatable

Conversation

@villebro
Copy link
Copy Markdown
Member

@villebro villebro commented Apr 23, 2021

SUMMARY

This is a port of #13029 to native filters to make it possible to add select filters that are not contained in the input data.

SCREENSHOTS

Single select filter:
native-select-single

Multiselect filter:
native-select-multi

TEST PLAN

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 force-pushed the villebro/native-select-creatable branch from 8f43595 to 6f268c6 Compare April 23, 2021 12:40
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2021

Codecov Report

Merging #14314 (0690c68) into master (b963624) will decrease coverage by 0.00%.
The diff coverage is 70.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14314      +/-   ##
==========================================
- Coverage   76.93%   76.93%   -0.01%     
==========================================
  Files         954      954              
  Lines       48075    48082       +7     
  Branches     5974     5976       +2     
==========================================
+ Hits        36987    36991       +4     
- Misses      10891    10894       +3     
  Partials      197      197              
Flag Coverage Δ
javascript 72.09% <70.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...c/filters/components/Select/SelectFilterPlugin.tsx 84.90% <66.66%> (-4.23%) ⬇️
...nd/src/filters/components/Select/transformProps.ts 90.90% <100.00%> (ø)
...nts/controls/DateFilterControl/DateFilterLabel.tsx 73.72% <0.00%> (-0.23%) ⬇️
...mponents/controls/DateFilterControl/utils/index.ts 100.00% <0.00%> (ø)
...nts/controls/DateFilterControl/utils/dateParser.ts 96.15% <0.00%> (ø)
superset-frontend/src/explore/dateFilterUtils.ts
...ontrols/DateFilterControl/utils/dateFilterUtils.ts 100.00% <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 b963624...0690c68. Read the comment docs.

@villebro villebro force-pushed the villebro/native-select-creatable branch from 6f268c6 to 8bb466c Compare April 23, 2021 13:36
showSearch={showSearch}
mode={multiSelect ? 'multiple' : undefined}
placeholder={placeholderText}
onSearch={val => setCurrentSuggestionSearch(val)}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
onSearch={val => setCurrentSuggestionSearch(val)}
onSearch={setCurrentSuggestionSearch}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nice catch 👍

);
})}
{currentSuggestionSearch &&
!(values || []).some(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WDYT about using ensureIsArray(values) instead of values || []? I'm not sure if it'd be easier to read, but maybe a bit safer in case values is not an array

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea 👍

@villebro villebro merged commit e392e2e into apache:master Apr 24, 2021
@villebro villebro deleted the villebro/native-select-creatable branch April 24, 2021 05:26
@junlincc junlincc added the dashboard:native-filters Related to the native filters of the Dashboard label Apr 26, 2021
amitmiran137 pushed a commit that referenced this pull request Apr 27, 2021
…4314)

* feat(native-filters): add option to create value in select filter

* address comments

(cherry picked from commit e392e2e)
amitmiran137 pushed a commit that referenced this pull request Apr 28, 2021
…4314)

* feat(native-filters): add option to create value in select filter

* address comments

(cherry picked from commit e392e2e)
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
…ache#14314)

* feat(native-filters): add option to create value in select filter

* address comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 First shipped in 1.2.0 labels Mar 12, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
…ache#14314)

* feat(native-filters): add option to create value in select filter

* address comments
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/S v1.2 🚢 1.2.0 First shipped in 1.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants