You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2025/08/28 15:05:34 UTC

(superset) 01/01: fix: Improve table layout and column sizing for better user experience

This is an automated email from the ASF dual-hosted git repository.

kgabryje pushed a commit to branch test-feat
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d76e5e6bd72ce6243a0f4f2c3b1218d2c29dfe5b
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Thu Aug 28 17:03:59 2025 +0200

    fix: Improve table layout and column sizing for better user experience
    
    - Change table layout from fixed to auto for better content fitting
    - Remove hardcoded column sizes to allow dynamic sizing based on content
    - Add max-width constraint to table cells (320px) to prevent excessive expansion
    - Apply background color hotfix for overflowing cells in antd tables
    - Retain explicit sizing only for Actions column in ChartList and Dataset column
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <no...@anthropic.com>
---
 .../superset-ui-core/src/components/TableCollection/index.tsx     | 8 +++++++-
 .../superset-ui-core/src/components/TableCollection/utils.tsx     | 2 +-
 superset-frontend/src/pages/ChartList/index.tsx                   | 6 ++----
 superset-frontend/src/pages/DashboardList/index.tsx               | 4 ----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx
index 27861e9115..3f18719e68 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx
@@ -82,6 +82,7 @@ const StyledTable = styled(Table)`
       }
     }
     .ant-table-cell {
+      max-width: 320px;
       font-feature-settings: 'tnum' 1;
       text-overflow: ellipsis;
       overflow: hidden;
@@ -93,6 +94,11 @@ const StyledTable = styled(Table)`
     .ant-table-placeholder .ant-table-cell {
       border-bottom: 0;
     }
+
+    // Hotfix - antd doesn't apply background color to overflowing cells
+    & table {
+      background-color: ${theme.colorBgContainer};
+    }
   `}
 `;
 
@@ -150,7 +156,7 @@ function TableCollection<T extends object>({
       size={size}
       data-test="listview-table"
       pagination={false}
-      tableLayout="fixed"
+      tableLayout="auto"
       rowKey="rowId"
       rowSelection={rowSelection}
       locale={{ emptyText: null }}
diff --git a/superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx b/superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx
index 5a17ecc555..bc4cf2fd06 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx
@@ -95,7 +95,7 @@ export function mapColumns<T extends object>(
       dataIndex: column.id?.includes('.') ? column.id.split('.') : column.id,
       hidden: column.hidden,
       key: column.id,
-      width: column.size ? COLUMN_SIZE_MAP[column.size] : COLUMN_SIZE_MAP.md,
+      width: column.size ? COLUMN_SIZE_MAP[column.size] : undefined,
       ellipsis: !columnsForWrapText?.includes(column.id),
       defaultSortOrder: (isSorted
         ? isSortedDesc
diff --git a/superset-frontend/src/pages/ChartList/index.tsx b/superset-frontend/src/pages/ChartList/index.tsx
index ebb59def08..ce1e5b1709 100644
--- a/superset-frontend/src/pages/ChartList/index.tsx
+++ b/superset-frontend/src/pages/ChartList/index.tsx
@@ -365,7 +365,6 @@ function ChartList(props: ChartListProps) {
         ),
         Header: t('Name'),
         accessor: 'slice_name',
-        size: 'xxl',
         id: 'slice_name',
       },
       {
@@ -376,7 +375,6 @@ function ChartList(props: ChartListProps) {
         }: any) => registry.get(vizType)?.name || vizType,
         Header: t('Type'),
         accessor: 'viz_type',
-        size: 'lg',
         id: 'viz_type',
       },
       {
@@ -398,7 +396,7 @@ function ChartList(props: ChartListProps) {
         Header: t('Dataset'),
         accessor: 'datasource_id',
         disableSortBy: true,
-        size: 'lg',
+        size: 'xl',
         id: 'datasource_id',
       },
       {
@@ -433,7 +431,6 @@ function ChartList(props: ChartListProps) {
         Header: t('Tags'),
         accessor: 'tags',
         disableSortBy: true,
-        size: 'lg',
         hidden: !isFeatureEnabled(FeatureFlag.TaggingSystem),
         id: 'tags',
       },
@@ -546,6 +543,7 @@ function ChartList(props: ChartListProps) {
         },
         Header: t('Actions'),
         id: 'actions',
+        size: 'lg',
         disableSortBy: true,
         hidden: !canEdit && !canDelete,
       },
diff --git a/superset-frontend/src/pages/DashboardList/index.tsx b/superset-frontend/src/pages/DashboardList/index.tsx
index 8fedfdaa64..e141bd31f5 100644
--- a/superset-frontend/src/pages/DashboardList/index.tsx
+++ b/superset-frontend/src/pages/DashboardList/index.tsx
@@ -346,7 +346,6 @@ function DashboardList(props: DashboardListProps) {
         ),
         Header: t('Name'),
         accessor: 'dashboard_title',
-        size: 'xxl',
         id: 'dashboard_title',
       },
       {
@@ -388,7 +387,6 @@ function DashboardList(props: DashboardListProps) {
         Header: t('Tags'),
         accessor: 'tags',
         disableSortBy: true,
-        size: 'lg',
         hidden: !isFeatureEnabled(FeatureFlag.TaggingSystem),
         id: 'tags',
       },
@@ -401,7 +399,6 @@ function DashboardList(props: DashboardListProps) {
         Header: t('Owners'),
         accessor: 'owners',
         disableSortBy: true,
-        size: 'xl',
         id: 'owners',
       },
       {
@@ -415,7 +412,6 @@ function DashboardList(props: DashboardListProps) {
         }: any) => <ModifiedInfo date={changedOn} user={changedBy} />,
         Header: t('Last modified'),
         accessor: 'changed_on_delta_humanized',
-        size: 'xl',
         id: 'changed_on_delta_humanized',
       },
       {