Skip to content

Commit d56b805

Browse files
committed
FE: Manual column width for Coumers and Topics tables
1 parent 81d92da commit d56b805

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

frontend/src/components/ConsumerGroups/List.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { CONSUMER_GROUP_STATE_TOOLTIPS, PER_PAGE } from 'lib/constants';
1616
import { useConsumerGroups } from 'lib/hooks/api/consumers';
1717
import Tooltip from 'components/common/Tooltip/Tooltip';
1818
import ResourcePageHeading from 'components/common/ResourcePageHeading/ResourcePageHeading';
19+
import { useLocalStoragePersister } from 'components/common/NewTable/ColumnResizer/lib';
1920

2021
const List = () => {
2122
const { clusterName } = useAppParams<ClusterNameRoute>();
@@ -47,6 +48,7 @@ const List = () => {
4748
to={encodeURIComponent(`${getValue<string | number>()}`)}
4849
/>
4950
),
51+
size: 600,
5052
},
5153
{
5254
id: ConsumerGroupOrdering.MEMBERS,
@@ -96,6 +98,8 @@ const List = () => {
9698
[]
9799
);
98100

101+
const columnSizingPersister = useLocalStoragePersister('Consumers');
102+
99103
return (
100104
<>
101105
<ResourcePageHeading text="Consumers" />
@@ -118,6 +122,8 @@ const List = () => {
118122
clusterConsumerGroupDetailsPath(clusterName, original.groupId)
119123
)
120124
}
125+
enableColumnResizing
126+
columnSizingPersister={columnSizingPersister}
121127
disabled={consumerGroups.isFetching}
122128
/>
123129
</>

frontend/src/components/Topics/List/TopicTable.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useSearchParams } from 'react-router-dom';
88
import ClusterContext from 'components/contexts/ClusterContext';
99
import { useTopics } from 'lib/hooks/api/topics';
1010
import { PER_PAGE } from 'lib/constants';
11+
import { useLocalStoragePersister } from 'components/common/NewTable/ColumnResizer/lib';
1112

1213
import { TopicTitleCell } from './TopicTitleCell';
1314
import ActionsCell from './ActionsCell';
@@ -39,6 +40,7 @@ const TopicTable: React.FC = () => {
3940
header: 'Topic Name',
4041
accessorKey: 'name',
4142
cell: TopicTitleCell,
43+
size: 400,
4244
meta: {
4345
width: '100%',
4446
},
@@ -70,6 +72,7 @@ const TopicTable: React.FC = () => {
7072
accessorKey: 'replicationFactor',
7173
enableSorting: false,
7274
size: 148,
75+
maxSize: 148,
7376
},
7477
{
7578
header: 'Number of messages',
@@ -103,6 +106,8 @@ const TopicTable: React.FC = () => {
103106
[]
104107
);
105108

109+
const columnSizingPersister = useLocalStoragePersister('Topics');
110+
106111
return (
107112
<Table
108113
data={topics}
@@ -114,6 +119,8 @@ const TopicTable: React.FC = () => {
114119
enableRowSelection={
115120
!isReadOnly ? (row) => !row.original.internal : undefined
116121
}
122+
enableColumnResizing
123+
columnSizingPersister={columnSizingPersister}
117124
emptyMessage="No topics found"
118125
/>
119126
);

0 commit comments

Comments
 (0)