-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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): Adjust filter components for horizontal mode #22273
feat(native-filters): Adjust filter components for horizontal mode #22273
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22273 +/- ##
=======================================
Coverage 55.69% 55.70%
=======================================
Files 1846 1847 +1
Lines 70302 70330 +28
Branches 7689 7701 +12
=======================================
+ Hits 39157 39177 +20
- Misses 29151 29155 +4
- Partials 1994 1998 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
/testenv up FEATURE_HORIZONTAL_FILTER_BAR=true |
@geido Ephemeral environment spinning up at http://54.188.207.110:8080. Credentials are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two nits from a first look at the code
superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
Outdated
Show resolved
Hide resolved
46808da
to
3b00821
Compare
@michael-s-molina @geido @codyml I implemented the Select changes based on our yesterday discussion. Can you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @kgabryje. I left a couple of comments.
${ | ||
oneLine && | ||
` | ||
.ant-select-selection-overflow { | ||
flex-wrap: nowrap; | ||
} | ||
|
||
.ant-select-selection-overflow-item:not(.ant-select-selection-overflow-item-rest):not(.ant-select-selection-overflow-item-suffix) { | ||
flex-shrink: 1; | ||
min-width: ${theme.gridUnit * 13}px; | ||
} | ||
|
||
.ant-select-selection-overflow-item-suffix { | ||
flex: unset; | ||
min-width: 0px; | ||
} | ||
` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${ | |
oneLine && | |
` | |
.ant-select-selection-overflow { | |
flex-wrap: nowrap; | |
} | |
.ant-select-selection-overflow-item:not(.ant-select-selection-overflow-item-rest):not(.ant-select-selection-overflow-item-suffix) { | |
flex-shrink: 1; | |
min-width: ${theme.gridUnit * 13}px; | |
} | |
.ant-select-selection-overflow-item-suffix { | |
flex: unset; | |
min-width: 0px; | |
} | |
` | |
} | |
${ | |
oneLine && | |
` | |
.ant-select-selection-overflow { | |
flex-wrap: nowrap; | |
} | |
.ant-select-selection-overflow-item:not(.ant-select-selection-overflow-item-rest):not(.ant-select-selection-overflow-item-suffix) { | |
flex-shrink: 1; | |
min-width: ${theme.gridUnit * 13}px; | |
} | |
.ant-select-selection-overflow-item-suffix { | |
flex: unset; | |
min-width: 0px; | |
} | |
` | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
// TODO: use antd Tag props instead of any. Currently it's causing a typescript error | ||
const Tag = (props: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the custom render is necessary to make oneLine
work correctly so we need to move this code to the Select component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
3b00821
to
7f114aa
Compare
/testenv up FEATURE_HORIZONTAL_FILTER_BAR=true |
@geido Ephemeral environment spinning up at http://52.26.161.172:8080. Credentials are |
/testenv up FEATURE_HORIZONTAL_FILTER_BAR=true |
@kgabryje Ephemeral environment spinning up at http://34.208.45.61:8080. Credentials are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! One thing I noticed that can probably wait for a future PR (or left as-is) is that if there's a time filter in the overflow dropdown, clicking either of the popover buttons also closes the dropdown, which is probably not what we want:
Screen.Recording.2022-12-01.at.1.00.25.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the PR!
@kgabryje Let's open a follow-up to add the same behavior for the async version 😉
Good point @codyml. Let's handle that in a follow-up. |
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
This PR adjusts native filter components for horizontal filter bar.
Noteworthy changes:
a) Introduce a
oneLine
mode to Select component - if enabled, only 1 tag will be displayed at once and the rest of selected tags will be collapsed to an overflow tag. When user opens the dropdown, only the overflow tag is displayed. All tags are always displayed in a single line.b) If tag is truncated, display a tooltip with full name
c) Customize
maxTagPlaceholder
, so that the overflow tag doesn't display 3 dots at the end, which takes precious space(e.g. instead of the default
+ 1 ...
we show+1
when 1 item is overflowing)a) Adjust the top and bottom margin to make sure that the slider is centered in horizontal mode
b) Decrease font weight and line height so that the marks fit well in the horizontal filter bar
Known issues:
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
HORIZONTAL_FILTER_BAR
ffADDITIONAL INFORMATION
CC @codyml for review