fix: Improve table layout and column sizing (#34887)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Kamil Gabryjelski
2025-09-01 10:31:25 +02:00
committed by GitHub
parent 077724c2d2
commit 175835138c
6 changed files with 18 additions and 12 deletions

View File

@@ -40,7 +40,14 @@ export const PublishedLabel: React.FC<PublishedLabelProps> = ({
const labelType = isPublished ? 'success' : 'primary';
return (
<Label type={labelType} icon={icon} onClick={onClick}>
<Label
type={labelType}
icon={icon}
onClick={onClick}
style={{
color: isPublished ? theme.colorSuccessText : theme.colorPrimaryText,
}}
>
{label}
</Label>
);

View File

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

View File

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

View File

@@ -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,
},

View File

@@ -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',
},
{

View File

@@ -348,7 +348,6 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
},
Header: t('Name'),
accessor: 'table_name',
size: 'xxl',
id: 'table_name',
},
{