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(Alert): Migrate Alert component to Ant Design V5 #31168

Merged
merged 16 commits into from
Dec 6, 2024

Conversation

LevisNgigi
Copy link
Contributor

@LevisNgigi LevisNgigi commented Nov 26, 2024

SUMMARY

This PR upgrades the Alert component to Ant Design V5

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

1732640499806

After

Untitled design

TESTING INSTRUCTIONS

  1. Trigger an alert to Verify the appearance of alerts throughout the application.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Ant Design 5: Upgrade Alert component #30911
  • 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

@LevisNgigi LevisNgigi changed the title Upgrade alert antd v5 refactor(Alert): Migrate Alert component to Ant Design V5 Nov 26, 2024
@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 26, 2024
@LevisNgigi LevisNgigi changed the title refactor(Alert): Migrate Alert component to Ant Design V5 chore(Alert): Migrate Alert component to Ant Design V5 Nov 26, 2024
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.

Thanks for the contribution. I gave it a first-pass review. I am wondering if we need to upgrade more references to the updated class selectors throughout the code ant5-{something} for the Alert component.

@@ -62,7 +62,7 @@ describe('Visualization > Line', () => {
'not.exist',
);

cy.get('.ant-alert-warning').should('not.exist');
cy.get('.antd-v5-alert-warning').should('not.exist');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cy.get('.antd-v5-alert-warning').should('not.exist');
cy.get('.antd5-alert-warning').should('not.exist');

@@ -71,7 +71,7 @@ describe('Visualization > Line', () => {
cy.get('#controlSections-tab-display').click();
cy.get('span').contains('Y Axis Bounds').scrollIntoView();
cy.get('input[placeholder="Min"]').type('-0.1', { delay: 100 });
cy.get('.ant-alert-warning').should('not.exist');
cy.get('.antd-v5-alert-warning').should('not.exist');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cy.get('.antd-v5-alert-warning').should('not.exist');
cy.get('.antd5-alert-warning').should('not.exist');

@@ -94,7 +94,7 @@ export const databasesPage = {
dbDropdown: '[class="ant-select-selection-search-input"]',
dbDropdownMenu: '.rc-virtual-list-holder-inner',
dbDropdownMenuItem: '[class="ant-select-item-option-content"]',
infoAlert: '.ant-alert',
infoAlert: '.antd-v5-alert',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
infoAlert: '.antd-v5-alert',
infoAlert: '.antd5-alert',

@@ -103,7 +103,7 @@ export const databasesPage = {
helperBottom: '.helper-bottom',
postgresDatabase: '[name="database"]',
dbInput: '[name="database_name"]',
alertMessage: '.ant-alert-message',
alertMessage: '.antd-v5-alert-message',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
alertMessage: '.antd-v5-alert-message',
alertMessage: '.antd5-alert-message',

@@ -166,7 +166,7 @@ export const sqlLabView = {
renderedTableHeader: '.ReactVirtualized__Table__headerRow',
renderedTableRow: '.ReactVirtualized__Table__row',
errorBody: '.error-body',
alertMessage: '.ant-alert-message',
alertMessage: '.antd-v5-alert-message',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
alertMessage: '.antd-v5-alert-message',
alertMessage: '.antd5-alert-message',

@@ -325,7 +325,7 @@ export const nativeFilters = {
confirmCancelButton: dataTestLocator(
'native-filter-modal-confirm-cancel-button',
),
alertXUnsavedFilters: '.ant-alert-message',
alertXUnsavedFilters: '.antd-v5-alert-message',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
alertXUnsavedFilters: '.antd-v5-alert-message',
alertXUnsavedFilters: '.antd5-alert-message',

@@ -82,6 +84,7 @@ InteractiveAlert.args = {
message: smallText,
description: bigText,
showIcon: true,
closeIcon: <span aria-label="close icon">x</span>,
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 do not need the closeIcon to be one of the storybook args as it accepts a ReactNode and it is hard to configure this in the storybook UI

@@ -44,6 +44,7 @@ export const AlertGallery = () => (
type={type}
showIcon
closable
closeIcon={<span aria-label="close icon">x</span>} // Custom close icon
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove closeIcon from here and create a separate Alert component with a custom close icon just to show this option in storybook

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I opted to showcase the closeIcon directly in the existing AlertGallery to keep things simple and avoid adding extra components. Since closeIcon isn't part of the Storybook args, I think this approach still effectively demonstrates its customization without adding another component.

closeIcon={closable && <Icons.XSmall aria-label="close icon" />}
message={children || 'Default message'}
description={description}
style={{
marginBottom: roomBelow ? gridUnit * 4 : 0,
padding: `${gridUnit * 2}px ${gridUnit * 3}px`,
alignItems: 'flex-start',
border: 0,
backgroundColor: baseColor.light2,
Copy link
Member

Choose a reason for hiding this comment

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

I see you have removed a bunch of custom styles, which is good, but should we bring these in the component theme instead, including also those that you kept? You can see examples here

@sadpandajoe
Copy link
Member

@LevisNgigi should this PR be a refactor instead of a chore?

@LevisNgigi
Copy link
Contributor Author

@LevisNgigi should this PR be a refactor instead of a chore?

@sadpandajoe Let me change it

@LevisNgigi LevisNgigi changed the title chore(Alert): Migrate Alert component to Ant Design V5 Refactor(Alert): Migrate Alert component to Ant Design V5 Nov 27, 2024
@LevisNgigi LevisNgigi changed the title Refactor(Alert): Migrate Alert component to Ant Design V5 refactor(Alert): Migrate Alert component to Ant Design V5 Nov 27, 2024
@LevisNgigi LevisNgigi marked this pull request as ready for review November 30, 2024 12:10
@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor:antd5 labels Nov 30, 2024
@geido geido added the preset:bounty Issues that have been selected by Preset and have a bounty attached. label Dec 2, 2024
closeIcon={closable && <Icons.XSmall aria-label="close icon" />}
message={children || 'Default message'}
description={description}
style={{
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 still need these styles here?

@geido geido force-pushed the upgrade-alert-antd-v5 branch from 4dda84f to bab51f1 Compare December 6, 2024 13:09
@geido
Copy link
Member

geido commented Dec 6, 2024

/testenv up

Copy link
Contributor

github-actions bot commented Dec 6, 2024

@geido Processing your ephemeral environment request here.

Copy link
Contributor

github-actions bot commented Dec 6, 2024

@geido Ephemeral environment spinning up at http://null:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@geido geido merged commit 79aff68 into apache:master Dec 6, 2024
34 checks passed
betodealmeida pushed a commit that referenced this pull request Jan 14, 2025
@LevisNgigi LevisNgigi deleted the upgrade-alert-antd-v5 branch January 25, 2025 19:31
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 preset:bounty Issues that have been selected by Preset and have a bounty attached. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ant Design 5: Upgrade Alert component
3 participants