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): improve loading styles for filter component #13794
fix(native-filters): improve loading styles for filter component #13794
Conversation
padding-bottom: 10px; | ||
min-height: ${({ theme }) => theme.gridUnit * 10.5}px; | ||
padding-bottom: ${({ theme }) => theme.gridUnit * 2.5}px; |
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.
The min height needs to be 32px + the bottom padding, which in gridUnits
is 8 + 2.5 = 10.5.
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.
I'm hoping/trying to avoid fractional gridUnits if at all possible. I know there are a few kicking around in the codebase, but (a) we should just learn to stick to the grid for the sake of design's sanity, and (b) ththings can get weird if gridUnit is ever moved to, say, 5px, and we find ourselves in fractional-pixel land.
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.
Ha - I looked at the designs, and turns out they were more like 12 than 10 - updating accordingly.
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.
Same with the line above btw. Maybe 10px is fine?
if (loading) { | ||
return ( | ||
<StyledLoadingBox> | ||
<Loading /> | ||
</StyledLoadingBox> | ||
); | ||
} |
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.
This needed to be moved inside the FilterItem
, otherwise the title disappears when loading.
Codecov Report
@@ Coverage Diff @@
## master #13794 +/- ##
==========================================
+ Coverage 77.22% 77.56% +0.33%
==========================================
Files 935 935
Lines 47266 47276 +10
Branches 5893 5905 +12
==========================================
+ Hits 36502 36668 +166
+ Misses 10616 10464 -152
+ Partials 148 144 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
LGTM! I will need to test it again in master, if everything looks good - after +ing compatibility with sync query, let's turn native filter on by default for Superset users :D @villebro this is awesome! |
a8189e0
to
2912b7a
Compare
export default function LoadingBox() { | ||
return ( | ||
<StyledLoadingBox> | ||
<Loading /> |
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 might be worth trying
<Loading /> | |
<Loading position="inline" /> |
to see if it's a little smaller, and sits well. It might be left aligned, but if that looks strange, then StyledLoadingBox
could also have text-align: center;
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.
Actually, now that I look at this again, if you do the <Loading position="inline" />
bit, then you no longer need the position: relative;
or height: ${({ theme }) => theme.gridUnit * 8}px;
styles. This feels a bit cleaner to me.
Of course... it may be worth pointing out that if you don't mind the Loading icon being left-aligned, then you could skip that text-align: center;
style.... which means you don't need the StyledLoadingBox
div at all... which means you don't need the LoadingBox
component at all.
And now, to completely belabor this...
If you DO want the loading centered, but think you might want that to be highly reusable, and don't want to bother with adding the LoadingBox
component, then you can edit src/component/Loading/index.tsx
and add the functionality there:
- Add an
inline-centered
class following theinline
class:
&.inline {
margin: 0px;
width: 30px;
}
&.inline-centered {
margin: 0 auto;
width: 30px;
display: block;
}
- Update
PositionOption
to includeinline-centered
- Simply use
<Loading position="inline-centered" />
inFilterValue.tsx
instead of<LoadingBox />
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.
I added a bunch of comments on how to remove some of this new code, and instead extend the Loading component with a centered version, in case you want to make this all a bit smaller. If you do, please update the Loading
Storybook entry too.
That said, what you have works quite well, and I've tested it locally to confirm. Approving.
Thanks @rusackas! I'll address all the low hanging fruit from your comments today and get this merged to unblock pending follow-up PRs (we can further improve the aesthetics in future PRs) |
b1cd528
to
359fe36
Compare
359fe36
to
9c90885
Compare
* master: (56 commits) test: Adds tests and storybook to CertifiedIcon component (#13457) chore: Moves CheckboxIcons to Checkbox folder (#13459) chore: Removes Popover duplication (#13462) build(deps): bump elliptic from 6.5.3 to 6.5.4 in /docs (#13527) fix: allow spaces in DB names (#13800) chore: Update PR template for SIP-59 DB migrations process (#13855) Add CODEOWNERS (#13759) feat(alerts & reports): Easier to read execution logs (#13752) fix: Disallows negative options remaining (#13749) Fix broken link (#13861) fix(native-filters): add global async query support to native filters (#13837) Displays row limit warning with Alert component (#13854) fix(errors): Downgrade error on stop query to a warning (#13826) fix(alerts and reports): Unify timestamp format on execution log view (#13718) fix(sqllab): warning message when rows limited (#13841) chore: add success log whenever a connection is working (#13811) fix(native-filters): improve loading styles for filter component (#13794) chore: update change log with cherry-picks for release 1.1 (#13824) feat: added support to configure the default explorer viz (#13610) fix(#13734): Properly escape special characters in CSV output (#13735) ...
…che#13794) * fix(native-filters): improve loading styles for filter component * round up fractional grid unit * remove LoadingBox
SUMMARY
Currently the native filter components render irregularly when waiting for data to be returned from the database, causing unnecessary zigzagging on the filter tab. In addition, the default value selector in the filter config modal doesn't have a spinner to indicate that data is loading.
AFTER
Now the minimum size of the filter item is at minimum the same height as the AntD select component, leading to a more peaceful loading experience. Also note smaller spinner:
When data is being fetched from the backend in the filter config modal, the spinner is activated:
Before
Previously the filter item would contract when the filter component had finished retrieving data but had not yet fully rendered the component:
The default value selector didn't show that data was being awaited from the backend, but rather displayed "No results":
TEST PLAN
ADDITIONAL INFORMATION