Skip to content

Commit 6f0de4d

Browse files
author
Mark Berger
committed
Long source and destination names make the connection list table scroll horizontally
- Removed styled-components - Refactored Table component - Added responsive columns - Created new cell components
1 parent 229d1c9 commit 6f0de4d

16 files changed

+288
-217
lines changed

airbyte-webapp/src/components/EntityTable/ConnectionTable.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import { FeatureItem, useFeature } from "hooks/services/Feature";
1111
import { useQuery } from "hooks/useQuery";
1212

1313
import ConnectionSettingsCell from "./components/ConnectionSettingsCell";
14-
import ConnectorCell from "./components/ConnectorCell";
15-
import FrequencyCell from "./components/FrequencyCell";
16-
import LastSyncCell from "./components/LastSyncCell";
17-
import NameCell from "./components/NameCell";
14+
import { ConnectionStatusCell } from "./components/ConnectionStatusCell";
15+
import { ConnectorNameCell } from "./components/ConnectorNameCell";
16+
import { FrequencyCell } from "./components/FrequencyCell";
17+
import { LastSyncCell } from "./components/LastSyncCell";
1818
import { StatusCell } from "./components/StatusCell";
1919
import { ITableDataItem, SortOrderEnum } from "./types";
2020

@@ -86,8 +86,13 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
8686
headerHighlighted: true,
8787
accessor: "name",
8888
customWidth: 30,
89+
responsive: true,
8990
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
90-
<NameCell value={cell.value} enabled={row.original.enabled} status={row.original.lastSyncStatus} />
91+
<ConnectionStatusCell
92+
status={row.original.lastSyncStatus}
93+
value={cell.value}
94+
enabled={row.original.enabled}
95+
/>
9196
),
9297
},
9398
{
@@ -104,13 +109,10 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
104109
),
105110
headerHighlighted: true,
106111
accessor: "entityName",
112+
customWidth: 30,
113+
responsive: true,
107114
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
108-
<NameCell
109-
value={cell.value}
110-
enabled={row.original.enabled}
111-
icon={entity === "connection"}
112-
img={row.original.entityIcon}
113-
/>
115+
<ConnectorNameCell value={cell.value} icon={row.original.entityIcon} enabled={row.original.enabled} />
114116
),
115117
},
116118
{
@@ -124,11 +126,12 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
124126
</SortableTableHeader>
125127
),
126128
accessor: "connectorName",
129+
customWidth: 30,
130+
responsive: true,
127131
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
128-
<ConnectorCell value={cell.value} enabled={row.original.enabled} img={row.original.connectorIcon} />
132+
<ConnectorNameCell value={cell.value} icon={row.original.connectorIcon} enabled={row.original.enabled} />
129133
),
130134
},
131-
132135
{
133136
Header: <FormattedMessage id="tables.frequency" />,
134137
accessor: "scheduleData",

airbyte-webapp/src/components/EntityTable/ImplementationTable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { FormattedMessage } from "react-intl";
44
import { useNavigate } from "react-router-dom";
55
import { CellProps } from "react-table";
66

7+
import { ConnectorNameCell } from "components/EntityTable/components/ConnectorNameCell";
78
import { Table, SortableTableHeader } from "components/ui/Table";
89

910
import { useQuery } from "hooks/useQuery";
1011

1112
import AllConnectionsStatusCell from "./components/AllConnectionsStatusCell";
1213
import ConnectEntitiesCell from "./components/ConnectEntitiesCell";
13-
import ConnectorCell from "./components/ConnectorCell";
14-
import LastSyncCell from "./components/LastSyncCell";
15-
import NameCell from "./components/NameCell";
14+
import { EntityNameCell } from "./components/EntityNameCell";
15+
import { LastSyncCell } from "./components/LastSyncCell";
1616
import styles from "./ImplementationTable.module.scss";
1717
import { EntityTableDataItem, SortOrderEnum } from "./types";
1818

@@ -80,7 +80,7 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
8080
accessor: "entityName",
8181
customWidth: 40,
8282
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
83-
<NameCell value={cell.value} enabled={row.original.enabled} />
83+
<EntityNameCell value={cell.value} enabled={row.original.enabled} />
8484
),
8585
},
8686
{
@@ -95,7 +95,7 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
9595
),
9696
accessor: "connectorName",
9797
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
98-
<ConnectorCell value={cell.value} enabled={row.original.enabled} img={row.original.connectorIcon} />
98+
<ConnectorNameCell value={cell.value} icon={row.original.connectorIcon} enabled={row.original.enabled} />
9999
),
100100
},
101101
{
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@use "scss/variables";
2+
@use "scss/colors";
3+
4+
$connector_icon_width: 20px;
5+
$connector_icon_margin: 10px;
6+
7+
.content {
8+
display: flex;
9+
align-items: center;
10+
}
11+
12+
.text {
13+
width: calc(100% - #{$connector_icon_width + $connector_icon_margin});
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,20 @@
11
import React, { useMemo } from "react";
22
import { useIntl } from "react-intl";
3-
import styled from "styled-components";
43

5-
import { ConnectorIcon } from "components/common/ConnectorIcon";
64
import { StatusIcon } from "components/ui/StatusIcon";
75
import { StatusIconStatus } from "components/ui/StatusIcon/StatusIcon";
86

97
import { Status } from "../types";
8+
import styles from "./ConnectionStatusCell.module.scss";
9+
import { EntityNameCell } from "./EntityNameCell";
1010

11-
interface Props {
11+
interface ConnectionStatusCellProps {
12+
status: string | null;
1213
value: string;
13-
enabled?: boolean;
14-
status?: string | null;
15-
icon?: boolean;
16-
img?: string;
14+
enabled: boolean;
1715
}
1816

19-
const Content = styled.div`
20-
display: flex;
21-
align-items: center;
22-
font-weight: 500;
23-
`;
24-
25-
const Name = styled.div<{ enabled?: boolean }>`
26-
white-space: nowrap;
27-
overflow: hidden;
28-
text-overflow: ellipsis;
29-
max-width: 500px;
30-
color: ${({ theme, enabled }) => (!enabled ? theme.greyColor40 : "inherit")};
31-
`;
32-
33-
const Image = styled(ConnectorIcon)`
34-
margin-right: 6px;
35-
`;
36-
37-
const NameCell: React.FC<Props> = ({ value, enabled, status, icon, img }) => {
17+
export const ConnectionStatusCell: React.FC<ConnectionStatusCellProps> = ({ status, value, enabled }) => {
3818
const { formatMessage } = useIntl();
3919
const statusIconStatus = useMemo<StatusIconStatus | undefined>(
4020
() =>
@@ -73,12 +53,9 @@ const NameCell: React.FC<Props> = ({ value, enabled, status, icon, img }) => {
7353
});
7454

7555
return (
76-
<Content>
77-
{status && <StatusIcon title={title} status={statusIconStatus} />}
78-
{icon && <Image icon={img} />}
79-
<Name enabled={enabled}>{value}</Name>
80-
</Content>
56+
<div className={styles.content}>
57+
<StatusIcon title={title} status={statusIconStatus} />
58+
<EntityNameCell className={styles.text} value={value} enabled={enabled} />
59+
</div>
8160
);
8261
};
83-
84-
export default NameCell;

airbyte-webapp/src/components/EntityTable/components/ConnectorCell.tsx

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@use "scss/variables";
2+
@use "scss/colors";
3+
4+
$status_icon_width: 25px;
5+
6+
.content {
7+
display: flex;
8+
align-items: center;
9+
}
10+
11+
.text {
12+
width: calc(100% - #{$status_icon_width});
13+
margin-left: variables.$spacing-md;
14+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react";
2+
3+
import { ConnectorIcon } from "components/common/ConnectorIcon";
4+
5+
import styles from "./ConnectorNameCell.module.scss";
6+
import { EntityNameCell } from "./EntityNameCell";
7+
8+
interface ConnectorNameCellProps {
9+
enabled: boolean;
10+
value: string;
11+
icon: string | undefined;
12+
}
13+
14+
export const ConnectorNameCell: React.FC<ConnectorNameCellProps> = ({ value, enabled, icon }) => {
15+
return (
16+
<div className={styles.content} title={value}>
17+
<ConnectorIcon icon={icon} />
18+
<EntityNameCell className={styles.text} value={value} enabled={enabled} />
19+
</div>
20+
);
21+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@use "scss/variables";
2+
@use "scss/colors";
3+
4+
.text {
5+
overflow: hidden;
6+
white-space: nowrap;
7+
text-overflow: ellipsis;
8+
font-weight: 500;
9+
color: colors.$grey;
10+
11+
&.enabled {
12+
color: colors.$dark-blue;
13+
}
14+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import classNames from "classnames";
2+
import React from "react";
3+
4+
import { Text } from "components/ui/Text";
5+
6+
import styles from "./EntityNameCell.module.scss";
7+
8+
interface EntityNameCellProps {
9+
value: string;
10+
enabled: boolean;
11+
className?: string;
12+
}
13+
14+
export const EntityNameCell: React.FC<EntityNameCellProps> = ({ value, enabled, className }) => {
15+
return (
16+
<Text className={classNames(styles.text, { [styles.enabled]: enabled }, className)} size="sm" title={value}>
17+
{value}
18+
</Text>
19+
);
20+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@use "scss/variables";
2+
@use "scss/colors";
3+
4+
.text {
5+
color: colors.$grey;
6+
7+
&.enabled {
8+
color: colors.$dark-blue;
9+
}
10+
}

0 commit comments

Comments
 (0)