Skip to content

Commit 00964a8

Browse files
Vixtirgermanosin
andauthored
FE: Manual column width for Consumers and Topics tables (#1273)
Co-authored-by: German Osin <[email protected]>
1 parent a87278a commit 00964a8

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
id: TopicColumnsToSort.MESSAGES_COUNT,
@@ -97,6 +100,8 @@ const TopicTable: React.FC = () => {
97100
[]
98101
);
99102

103+
const columnSizingPersister = useLocalStoragePersister('Topics');
104+
100105
return (
101106
<Table
102107
data={topics}
@@ -108,6 +113,8 @@ const TopicTable: React.FC = () => {
108113
enableRowSelection={
109114
!isReadOnly ? (row) => !row.original.internal : undefined
110115
}
116+
enableColumnResizing
117+
columnSizingPersister={columnSizingPersister}
111118
emptyMessage="No topics found"
112119
/>
113120
);

0 commit comments

Comments
 (0)