Skip to content

Commit 1bfd59a

Browse files
committed
feat: Add BreakableTextCell
1 parent 7f97f71 commit 1bfd59a

File tree

11 files changed

+49
-11
lines changed

11 files changed

+49
-11
lines changed

frontend/src/components/ACLPage/List/List.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import ACLFormContext from 'components/ACLPage/Form/AclFormContext';
2020
import PlusIcon from 'components/common/Icons/PlusIcon';
2121
import ActionButton from 'components/common/ActionComponent/ActionButton/ActionButton';
2222
import ResourcePageHeading from 'components/common/ResourcePageHeading/ResourcePageHeading';
23+
import BreakableTextCell from 'components/common/NewTable/BreakableTextCell';
2324

2425
import * as S from './List.styled';
2526

@@ -56,6 +57,7 @@ const ACList: React.FC = () => {
5657
header: 'Principal',
5758
accessorKey: 'principal',
5859
size: 257,
60+
cell: BreakableTextCell,
5961
},
6062
{
6163
header: 'Resource',

frontend/src/components/Brokers/BrokersList/lib/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as Cell from 'components/Brokers/BrokersList/TableCells/TableCells';
33
import { createColumnHelper } from '@tanstack/react-table';
44
import { keyBy } from 'lib/functions/keyBy';
55
import SkewHeader from 'components/Brokers/BrokersList/SkewHeader/SkewHeader';
6+
import BreakableTextCell from 'components/common/NewTable/BreakableTextCell';
67

78
import { BrokersTableRow } from './types';
89
import { NA_DISK_USAGE } from './constants';
@@ -75,6 +76,6 @@ export const getBrokersTableColumns = () => {
7576
cell: Cell.Skew,
7677
}),
7778
columnHelper.accessor('port', { header: 'Port' }),
78-
columnHelper.accessor('host', { header: 'Host' }),
79+
columnHelper.accessor('host', { header: 'Host', cell: BreakableTextCell }),
7980
];
8081
};

frontend/src/components/Connect/List/List.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { FullConnectorInfo } from 'generated-sources';
66
import { useConnectors } from 'lib/hooks/api/kafkaConnect';
77
import { ColumnDef } from '@tanstack/react-table';
88
import { useNavigate, useSearchParams } from 'react-router-dom';
9+
import BreakableTextCell from 'components/common/NewTable/BreakableTextCell';
910

1011
import ActionsCell from './ActionsCell';
1112
import TopicsCell from './TopicsCell';
@@ -22,10 +23,14 @@ const List: React.FC = () => {
2223

2324
const columns = React.useMemo<ColumnDef<FullConnectorInfo>[]>(
2425
() => [
25-
{ header: 'Name', accessorKey: 'name' },
26-
{ header: 'Connect', accessorKey: 'connect' },
26+
{ header: 'Name', accessorKey: 'name', cell: BreakableTextCell },
27+
{ header: 'Connect', accessorKey: 'connect', cell: BreakableTextCell },
2728
{ header: 'Type', accessorKey: 'type' },
28-
{ header: 'Plugin', accessorKey: 'connectorClass' },
29+
{
30+
header: 'Plugin',
31+
accessorKey: 'connectorClass',
32+
cell: BreakableTextCell,
33+
},
2934
{ header: 'Topics', cell: TopicsCell },
3035
{ header: 'Status', accessorKey: 'status.state', cell: TagCell },
3136
{ header: 'Running Tasks', cell: RunningTasksCell },

frontend/src/components/ConsumerGroups/List.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const List = () => {
4242
// eslint-disable-next-line react/no-unstable-nested-components
4343
cell: ({ getValue }) => (
4444
<LinkCell
45+
style={{ wordBreak: 'break-word', whiteSpace: 'pre-wrap' }}
4546
value={`${getValue<string | number>()}`}
4647
to={encodeURIComponent(`${getValue<string | number>()}`)}
4748
/>

frontend/src/components/Dashboard/ClusterName.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ type ClusterNameProps = CellContext<Cluster, unknown>;
88
const ClusterName: React.FC<ClusterNameProps> = ({ row }) => {
99
const { readOnly, name } = row.original;
1010
return (
11-
<>
11+
<div style={{ wordBreak: 'break-word', whiteSpace: 'pre-wrap' }}>
1212
{readOnly && <Tag color="blue">readonly</Tag>}
1313
{name}
14-
</>
14+
</div>
1515
);
1616
};
1717

frontend/src/components/KsqlDb/TableView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { KsqlStreamDescription, KsqlTableDescription } from 'generated-sources';
33
import Table from 'components/common/NewTable';
44
import { ColumnDef } from '@tanstack/react-table';
5+
import BreakableTextCell from 'components/common/NewTable/BreakableTextCell';
56

67
interface TableViewProps {
78
fetching: boolean;
@@ -13,8 +14,8 @@ const TableView: React.FC<TableViewProps> = ({ fetching, rows }) => {
1314
ColumnDef<KsqlTableDescription | KsqlStreamDescription>[]
1415
>(
1516
() => [
16-
{ header: 'Name', accessorKey: 'name' },
17-
{ header: 'Topic', accessorKey: 'topic' },
17+
{ header: 'Name', accessorKey: 'name', cell: BreakableTextCell },
18+
{ header: 'Topic', accessorKey: 'topic', cell: BreakableTextCell },
1819
{ header: 'Key Format', accessorKey: 'keyFormat' },
1920
{ header: 'Value Format', accessorKey: 'valueFormat' },
2021
{

frontend/src/components/Schemas/List/List.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const List: React.FC = () => {
4545
// eslint-disable-next-line react/no-unstable-nested-components
4646
cell: ({ getValue }) => (
4747
<LinkCell
48+
style={{ wordBreak: 'break-word', whiteSpace: 'pre-wrap' }}
4849
value={`${getValue<string | number>()}`}
4950
to={encodeURIComponent(`${getValue<string | number>()}`)}
5051
/>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ export const TopicTitleCell: React.FC<CellContext<Topic, unknown>> = ({
99
}) => {
1010
const { internal, name } = original;
1111
return (
12-
<NavLink to={name} title={name}>
12+
<NavLink
13+
to={name}
14+
title={name}
15+
style={{ wordBreak: 'break-word', whiteSpace: 'pre-wrap' }}
16+
>
1317
{internal && (
1418
<>
1519
<Tag color="gray">IN</Tag>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import { CellContext } from '@tanstack/react-table';
3+
4+
import * as S from './Table.styled';
5+
6+
const BreakableTextCell = <T,>({ getValue }: CellContext<T, unknown>) => {
7+
return <S.BreakableText>{getValue<string>()}</S.BreakableText>;
8+
};
9+
10+
export default BreakableTextCell;

frontend/src/components/common/NewTable/LinkCell.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@ import React from 'react';
22
import { NavLink } from 'react-router-dom';
33

44
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5-
const LinkCell = ({ value, to = '' }: any) => {
5+
const LinkCell = ({
6+
value,
7+
to = '',
8+
style = {},
9+
}: {
10+
value: string;
11+
to?: string;
12+
style?: React.CSSProperties;
13+
}) => {
614
const handleClick: React.MouseEventHandler = (e) => e.stopPropagation();
715
return (
8-
<NavLink to={to} title={value} onClick={handleClick}>
16+
<NavLink to={to} title={value} onClick={handleClick} style={style}>
917
{value}
1018
</NavLink>
1119
);

0 commit comments

Comments
 (0)