-
Notifications
You must be signed in to change notification settings - Fork 14.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
refactor(Collapse): Upgrade Collapse to Antd5 #32959
base: template_less
Are you sure you want to change the base?
refactor(Collapse): Upgrade Collapse to Antd5 #32959
Conversation
Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment
|
aria-label="Copy" | ||
tooltip={t('Copy SELECT statement to the clipboard')} | ||
className={ | ||
`fa fa-sort-${sortColumns ? 'numeric' : 'alpha'}-asc ` + |
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.
We are removing usages of fa icons from the codebase. Can you use the Icons component from src/components/Icons
instead?
<CopyToClipboard | ||
copyNode={ | ||
<IconTooltip | ||
aria-label="Copy" |
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.
Let's localize this too. I see inconsistent localization with this prop across the codebase but I guess localizing won't hurt.
expandIconPosition === 'right' && | ||
` | ||
.anticon.anticon-right.ant-collapse-arrow > svg { | ||
${({ expandIconPosition }) => |
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 is all necessary because Ant Design does not support arrows on the right?
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 does, but the arrow points to the right by default. In Superset, when the arrow is on the right, it points down when closed and up when open
</Collapse> | ||
items={[ | ||
{ | ||
key: '1', |
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.
Can we use human-readable keys?
<Collapse | ||
items={[ | ||
{ | ||
key: '1', |
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.
human-readable if possible
{!queryData ? ( | ||
items={[ | ||
{ | ||
key: '1', |
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 comment about human-readable
2eb2f43
to
a331275
Compare
{tables.map(table => ( | ||
<TableElement | ||
table={table} | ||
key={table.id} | ||
activeKey={tables | ||
.filter(({ expanded }) => expanded) | ||
.map(({ id }) => id)} | ||
onChange={onToggleTable} | ||
/> | ||
))} |
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 am not sure why this refactor of Collapse into TableElement necessary?
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.
Mainly because of the hover functionality for the tooltip and the fact that the Collapse items prop accepts label and children as separate components
> | ||
<Icons.SyncOutlined | ||
iconSize="m" | ||
iconColor={theme.colors.grayscale.dark5} |
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 think we are trying to use Ant Design tokens whenever we can so i am not sure but this would roughly map to theme.colorIcon
?
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.
aria-hidden | ||
iconColor={ | ||
sortColumns | ||
? theme.colors.grayscale.dark5 |
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 here
<Icons.CopyOutlined | ||
iconSize="m" | ||
aria-hidden | ||
iconColor={theme.colors.grayscale.dark5} |
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.
and here
<Icons.CloseOutlined | ||
iconSize="m" | ||
aria-hidden | ||
iconColor={theme.colors.grayscale.dark5} |
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.
and here
@@ -41,9 +41,11 @@ const collapseStyle = (theme: SupersetTheme) => css` | |||
.ant-collapse-arrow { | |||
left: 0px !important; | |||
} | |||
.ant-collapse-header { |
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.
Won't these classnames change to antd5?
{ | ||
key: `${filterId}-${FilterPanels.configuration.key}`, | ||
label: FilterPanels.configuration.name, | ||
children: ( |
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.
Is losing forceRender not important here?
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.
Restored the forceRender
@@ -105,7 +105,7 @@ const ColumnElement = ({ column }: ColumnElementProps) => { | |||
} | |||
return ( | |||
<div className="clearfix table-column"> | |||
<div className="pull-left m-l-10 col-name"> | |||
<div className="pull-left col-name"> |
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.
Do we know where these classes are coming from? Can we use the standard Ant Design approach here, like Flex
or Space
?
} | ||
} | ||
`} | ||
const StyledControls = styled.div` |
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.
Don't want to go too much outside of the scope of the PR but do you think we can use standard Ant Design Flex
and Space
components to manage the layout for all the styles in this file?
width: 100%; | ||
height: 1px; | ||
display: block; | ||
background: ${theme.colors.grayscale.light3}; |
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.
Do we need this? Can we use an Ant Design color instead? Also, this should be a standard atomic component?
@DamianPendrak I see some pre-commit checks fail, highly recommend setting up pre-commit -> https://superset.apache.org/docs/contributing/development/#git-hooks Once you do, you may want to squish your commits as a way to re-trigger it on all the files you touched in this PR. |
Also wondering what's required to do in order for going from a DRAFT PR to "ready for review" |
I think I will fix the failing tests and then mark it ready |
0d03d4d
to
bb7a638
Compare
You have a conflict. Thanks for the hard work on this! |
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.
Approving as it looks mostly good with comments I have left above. It would be great to have more eyes on testing as well. @msyavuz maybe you can help with that.
Thank you!
SUMMARY
Fixes #32542
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Home
Before
After
SQL Editor Table Element
Before
After
Explore Data
Before
After
Connect a database - Advanced tab
Before
After
Upload modal
Before
After
Add Alert / Report
Before
After
Fixed or metric
Before
After
Dashboard filters
Before
After
Dashboard Cross-filters
Before
After
Dasbhoard - Out of scope filters
Before
After
VizTypeGallery
Before
After
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION