-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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(sqllab): Have table name tooltip only show when name is truncated #17386
fix(sqllab): Have table name tooltip only show when name is truncated #17386
Conversation
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.
Looks good to me, thanks for fixing this! 😁
Codecov Report
@@ Coverage Diff @@
## master #17386 +/- ##
==========================================
- Coverage 77.07% 76.94% -0.13%
==========================================
Files 1036 1038 +2
Lines 55756 56014 +258
Branches 7630 7736 +106
==========================================
+ Hits 42972 43101 +129
- Misses 12529 12655 +126
- Partials 255 258 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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 looks great! Thanks @corbinrobb!
…#17386) * Add conditional to table name tooltip to only show when overflowing * Remove uneccessary state and useEffect, a little clean up and slight refactoring Co-authored-by: Corbin Robb <corbin@Corbins-MacBook-Pro.local>
SUMMARY
Short Summary:
Removed the tooltip hover for tables that are not truncated
Changed tooltip popup to be centered over the table name
Detailed Summary:
This was done by adding a reference to the StyledSpan which is the element that had the styling to truncate when the table name text overflows.
Then when the component mounts, we check if the element is overflowing and if so remove the tooltip trigger that shows the tooltip pop up.
We did that by passing an empty array to the ToolTip trigger property instead of ['hover']. Doing this makes it so the tooltip never triggers and therefore never shows up.
I changed the tooltip to show up over the center of the name because it looked a little weird to have it placed on the left when the table name was so long. I might be the only one who feels that way, so please let me know if anybody disagrees and I will change it back.
BEFORE
AFTER
TESTING INSTRUCTIONS
Open Superset and select the SqlEditor option under SQL Lab at the top of the screen
On the left side of the screen select some schema and add some tables with the table schema dropdown
If you know where to find some tables with long enough names that it causes the name to truncate then open up some of those and then hover your mouse over the table names and observe.
If you are like me and you do not know where to find super long table names you can add a little bit of code at the file located here
superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.jsx
Then we hop on down to line 213 and we can copy-paste this little map method in between
this.props.tables
and.map
.map((table, i) => { if (i % 2 == 0) return table; return { ...table, name: table.name + 'this_is_a_really_really_really_really_long_name', }; })
All this does is appends a really long string to the end of every other table name. You should remove this after visually testing.
Should go from this:
To This:
Then save and refresh the page and now every other table name should be really long.
Finally, you can observe the lack of tooltip on the short names and bear witness to the tooltip popup on the long ones.
ADDITIONAL INFORMATION