Skip to content
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

Open
wants to merge 1 commit into
base: template_less
Choose a base branch
from

Conversation

DamianPendrak
Copy link
Contributor

@DamianPendrak DamianPendrak commented Apr 1, 2025

SUMMARY

Fixes #32542

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Home

Before

Screenshot 2025-04-04 at 13 57 16

After

Screenshot 2025-04-04 at 13 55 34

SQL Editor Table Element

Before

Screenshot 2025-04-01 at 08 31 40

After

Screenshot 2025-04-04 at 14 04 12

Explore Data

Before

Screenshot 2025-04-01 at 08 32 44

After

Screenshot 2025-04-04 at 14 04 52

Connect a database - Advanced tab

Before

Screenshot 2025-04-04 at 14 10 27

After

Screenshot 2025-04-04 at 14 06 57

Upload modal

Before

Screenshot 2025-04-04 at 14 14 13

After

Screenshot 2025-04-04 at 14 16 38

Add Alert / Report

Before

Screenshot 2025-04-04 at 17 26 26

After

Screenshot 2025-04-04 at 14 18 53

Fixed or metric

Before

Screenshot 2025-04-04 at 16 45 43

After

Screenshot 2025-04-04 at 16 54 04

Dashboard filters

Before

Screenshot 2025-04-04 at 17 28 43

After

Screenshot 2025-04-04 at 17 01 19

Dashboard Cross-filters

Before

Screenshot 2025-04-04 at 17 30 25

After

Screenshot 2025-04-04 at 17 02 27

Dasbhoard - Out of scope filters

Before

Screenshot 2025-04-04 at 17 40 21

After

Screenshot 2025-04-04 at 17 38 37

VizTypeGallery

Before

Screenshot 2025-04-04 at 17 31 19

After

Screenshot 2025-04-04 at 17 33 43

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue: Ant Design 5: Upgrade Collapse component #32542
  • Required feature flags:
  • 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

Copy link

korbit-ai bot commented Apr 1, 2025

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 /korbit-review.

Your admin can change your review schedule in the Korbit Console

@sadpandajoe sadpandajoe added review:checkpoint Last PR reviewed during the daily review standup review:draft labels Apr 1, 2025
@sadpandajoe sadpandajoe linked an issue Apr 1, 2025 that may be closed by this pull request
@geido geido added preset:bounty Issues that have been selected by Preset and have a bounty attached. hold! On hold labels Apr 2, 2025
aria-label="Copy"
tooltip={t('Copy SELECT statement to the clipboard')}
className={
`fa fa-sort-${sortColumns ? 'numeric' : 'alpha'}-asc ` +
Copy link
Member

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"
Copy link
Member

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 }) =>
Copy link
Member

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?

Copy link
Contributor Author

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',
Copy link
Member

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',
Copy link
Member

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',
Copy link
Member

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

@msyavuz msyavuz self-requested a review April 2, 2025 11:29
@DamianPendrak DamianPendrak force-pushed the collapse-component-upgrade branch from 2eb2f43 to a331275 Compare April 2, 2025 13:00
@sadpandajoe sadpandajoe removed the review:checkpoint Last PR reviewed during the daily review standup label Apr 2, 2025
Comment on lines +234 to +243
{tables.map(table => (
<TableElement
table={table}
key={table.id}
activeKey={tables
.filter(({ expanded }) => expanded)
.map(({ id }) => id)}
onChange={onToggleTable}
/>
))}
Copy link
Member

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?

Copy link
Contributor Author

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}
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2025-04-03 at 11 56 53
Okay, I thought that the contrast is too low with the theme.colorIcon. I will update the code, but let me know if something changes because of the contrast

aria-hidden
iconColor={
sortColumns
? theme.colors.grayscale.dark5
Copy link
Member

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}
Copy link
Member

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}
Copy link
Member

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 {
Copy link
Member

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: (
Copy link
Member

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?

Copy link
Contributor Author

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">
Copy link
Member

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`
Copy link
Member

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};
Copy link
Member

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?

@mistercrunch
Copy link
Member

mistercrunch commented Apr 3, 2025

@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.

@mistercrunch
Copy link
Member

Also wondering what's required to do in order for going from a DRAFT PR to "ready for review"

@DamianPendrak
Copy link
Contributor Author

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

@DamianPendrak DamianPendrak marked this pull request as ready for review April 4, 2025 08:50
Copy link

korbit-ai bot commented Apr 4, 2025

Korbit doesn't automatically review large (3000+ lines changed) pull requests such as this one. If you want me to review anyway, use /korbit-review.

@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor:antd5 labels Apr 4, 2025
@DamianPendrak DamianPendrak force-pushed the collapse-component-upgrade branch from 0d03d4d to bb7a638 Compare April 4, 2025 10:09
@geido
Copy link
Member

geido commented Apr 7, 2025

  • The color of the subtitle seems hard to see. Is this a vanilla Ant Design implementation?
    Screenshot 2025-04-07 at 17 13 09
  • When I first visited the homepage I found all collapse closed. I don't believe I closed them. Something to check.
    Screenshot 2025-04-07 at 17 11 50
  • Colors of text inside the collapse for filters is off. Is it because of Checkbox? Currently being developed here
    Screenshot 2025-04-07 at 17 11 22

You have a conflict. Thanks for the hard work on this!

Copy link
Member

@geido geido left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend frontend:refactor:antd5 hold! On hold preset:bounty Issues that have been selected by Preset and have a bounty attached. review:draft size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ant Design 5: Upgrade Collapse component
5 participants