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(Table): Use our custom Table component in views #32964

Open
wants to merge 39 commits into
base: template_less
Choose a base branch
from

Conversation

msyavuz
Copy link
Member

@msyavuz msyavuz commented Apr 1, 2025

SUMMARY

Right now html table is used in various ListViews styled by tables.less. This pr aims to refactor those tables into using our custom Table component instead.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before dashboards:
image
After dashboards:
image

Before charts:
image
After charts:
image

TESTING INSTRUCTIONS

Run the testing suite/Check list views

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

@msyavuz msyavuz changed the base branch from master to template_less April 1, 2025 18:18
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Apr 4, 2025
@msyavuz msyavuz force-pushed the msyavuz/refactor/use-ant-tables branch from f45860f to 118eaef Compare April 4, 2025 19:28
@msyavuz msyavuz marked this pull request as ready for review April 7, 2025 08:50
@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor Related to refactoring the frontend labels Apr 7, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Documentation Missing Enum Documentation ▹ view 🧠 Not in scope
Documentation Missing documentation for complex row selection logic ▹ view 🧠 Not in scope
Files scanned
File Path Reviewed
superset-frontend/src/components/TableView/TableView.stories.tsx
superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx
superset-frontend/src/features/roles/RoleListEditModal.tsx
superset-frontend/src/features/allEntities/AllEntitiesTable.tsx
superset-frontend/src/components/TableCollection/utils.tsx
superset-frontend/src/components/TableView/TableView.tsx
superset-frontend/src/pages/ExecutionLogList/index.tsx
superset-frontend/src/components/AlteredSliceTag/index.tsx
superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx
superset-frontend/src/pages/CssTemplateList/index.tsx
superset-frontend/src/SqlLab/components/QueryTable/index.tsx
superset-frontend/src/pages/AnnotationLayerList/index.tsx
superset-frontend/src/pages/AnnotationList/index.tsx
superset-frontend/src/pages/Tags/index.tsx
superset-frontend/src/pages/RowLevelSecurityList/index.tsx
superset-frontend/src/components/Table/index.tsx
superset-frontend/src/pages/RolesList/index.tsx
superset-frontend/src/components/TableCollection/index.tsx
superset-frontend/src/components/ListView/ListView.tsx
superset-frontend/src/pages/QueryHistoryList/index.tsx
superset-frontend/src/pages/AlertReportList/index.tsx
superset-frontend/src/pages/SavedQueryList/index.tsx
superset-frontend/src/pages/DashboardList/index.tsx
superset-frontend/src/pages/DatabaseList/index.tsx
superset-frontend/src/pages/ChartList/index.tsx
superset-frontend/src/pages/DatasetList/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

Comment on lines +449 to +455
toggleRowSelected={(rowId, value) => {
const row = rows.find(r => r.id === rowId);
if (row) {
prepareRow(row);
row.toggleRowSelected(value);
}
}}

This comment was marked as resolved.

Comment on lines 50 to 54
export enum TableSize {
Small = 'small',
Middle = 'middle',
Large = 'large',
}

This comment was marked as resolved.

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.

Items from manual testing:

  • Can we try loading the spinner on the content of the table?
  • Should we move TableCollection inside Table? In general, I feel components that are based off of the same base components and that are just extending them should live in the same parent component directory. For instance, we have Checkbox and IndeterminateCheckbox that live far apart in the src/components directory and one might not even notice.
  • I noticed we still have instances of pure tables in the codebase. I believe this PR is the right opportunity to get rid of all of them and just use Ant Design Table.

@@ -32,299 +33,131 @@ interface TableCollectionProps {
loading: boolean;
highlightRowId?: number;
columnsForWrapText?: string[];
setSortBy?: (updater: SortingRule<any>[]) => void;
bulkSelectEnabled?: boolean;
selectedFlatRows?: any[];
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 improve the type here

@@ -32,299 +33,131 @@ interface TableCollectionProps {
loading: boolean;
highlightRowId?: number;
columnsForWrapText?: string[];
setSortBy?: (updater: SortingRule<any>[]) => void;
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 have a better type than any?

id: sorter.field,
desc: sorter.order === 'descend',
},
] as SortingRule<any>[]);
Copy link
Member

Choose a reason for hiding this comment

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

Check for a better type definition

: 'ascend'
: undefined,
sorter: !column.disableSortBy,
render: (val: any, record: any): ReactNode => {
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 check for a better solution all these any

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 Related to refactoring the frontend review:draft size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants