Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 🔧 UI Table migration to v8 #21109

Merged
merged 33 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2713fa8
Starts migration of react-table to v8
YatsukBogdan1 Jan 6, 2023
2e410b8
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 10, 2023
790931f
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 10, 2023
46c8e3c
Fixes react-table v8 types
YatsukBogdan1 Jan 11, 2023
dc7cef7
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 16, 2023
2f13175
Removes inline styles; Adds SCSS custom styles for th in NextTable co…
YatsukBogdan1 Jan 16, 2023
43d2134
Migrate ConnectorsView, ImplementationTable and UserSettingsView Tabl…
YatsukBogdan1 Jan 16, 2023
6db4204
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 16, 2023
1134bf7
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 17, 2023
1d95dfd
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 18, 2023
4269483
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 19, 2023
d84afdb
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 23, 2023
c91470c
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 23, 2023
ed6e658
Adds usage of createColumnHelper utility to get rid of additional typ…
YatsukBogdan1 Jan 24, 2023
4b2b2d4
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 24, 2023
00b964b
Removes unnecessary cell props type definitions
YatsukBogdan1 Jan 24, 2023
312f364
Fixes styles issues
YatsukBogdan1 Jan 24, 2023
39d6192
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 24, 2023
770167f
Fix stream fields table to remove box-shadow
YatsukBogdan1 Jan 24, 2023
0390bc4
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 26, 2023
6de99c5
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 27, 2023
ea75b35
Removes headerHighlighted from column meta; Removes erroredRows prop …
YatsukBogdan1 Jan 29, 2023
c5bbcd0
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 31, 2023
67fc2be
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 31, 2023
3557959
Adds responsive property for column meta
YatsukBogdan1 Jan 31, 2023
966f79b
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 31, 2023
90863e1
Fixes styles for StreamsFieldTable
YatsukBogdan1 Jan 31, 2023
fa24992
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 31, 2023
602c3b0
Update airbyte-webapp/src/components/EntityTable/ConnectionTable.tsx
YatsukBogdan1 Jan 31, 2023
aa1aadc
Fixes ConnectionTable interface name
YatsukBogdan1 Jan 31, 2023
2041d98
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Jan 31, 2023
ebccefd
Fixes StreamsFieldsTable textCell to have min-width: 140px
YatsukBogdan1 Jan 31, 2023
2000fbd
Merge branch 'master' into byatsuk/feauter-update-to-react-table-v8
YatsukBogdan1 Feb 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.tableHeaderButton {
background-color: inherit;
border: none;
color: inherit;
cursor: pointer;
font-size: inherit;
font-weight: inherit;
text-transform: inherit;
white-space: nowrap;
th.width30 {
width: 30%;
}

.thEnabled {
width: 1%;
}

.thConnectionSettings {
width: 1%;
}
151 changes: 83 additions & 68 deletions airbyte-webapp/src/components/EntityTable/ConnectionTable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createColumnHelper } from "@tanstack/react-table";
import queryString from "query-string";
import React, { useCallback } from "react";
import { FormattedMessage } from "react-intl";
import { useNavigate } from "react-router-dom";
import { CellProps } from "react-table";

import { Table, SortableTableHeader } from "components/ui/Table";
import { SortableTableHeader } from "components/ui/Table";

import { ConnectionScheduleType, SchemaChange } from "core/request/AirbyteClient";
import { FeatureItem, useFeature } from "hooks/services/Feature";
Expand All @@ -16,15 +16,17 @@ import { ConnectorNameCell } from "./components/ConnectorNameCell";
import { FrequencyCell } from "./components/FrequencyCell";
import { LastSyncCell } from "./components/LastSyncCell";
import { StatusCell } from "./components/StatusCell";
import { ITableDataItem, SortOrderEnum } from "./types";
import styles from "./ConnectionTable.module.scss";
import { ConnectionTableDataItem, SortOrderEnum } from "./types";
import { NextTable } from "../ui/NextTable";

interface IProps {
data: ITableDataItem[];
interface ConnectionTableProps {
data: ConnectionTableDataItem[];
entity: "source" | "destination" | "connection";
onClickRow?: (data: ITableDataItem) => void;
onClickRow?: (data: ConnectionTableDataItem) => void;
}

const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow }) => {
const ConnectionTable: React.FC<ConnectionTableProps> = ({ data, entity, onClickRow }) => {
const navigate = useNavigate();
const query = useQuery<{ sortBy?: string; order?: SortOrderEnum }>();
const allowAutoDetectSchema = useFeature(FeatureItem.AllowAutoDetectSchema);
Expand Down Expand Up @@ -70,10 +72,12 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow }) => {

const sortingData = React.useMemo(() => data.sort(sortData), [sortData, data]);

const columnHelper = createColumnHelper<ConnectionTableDataItem>();

const columns = React.useMemo(
() => [
{
Header: (
columnHelper.accessor("name", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("name")}
isActive={sortBy === "name"}
Expand All @@ -82,20 +86,20 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow }) => {
<FormattedMessage id="tables.name" />
</SortableTableHeader>
),
headerHighlighted: true,
accessor: "name",
customWidth: 30,
responsive: true,
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
meta: {
thClassName: styles.width30,
responsive: true,
},
cell: (props) => (
<ConnectionStatusCell
status={row.original.lastSyncStatus}
value={cell.value}
enabled={row.original.enabled}
status={props.row.original.lastSyncStatus}
value={props.cell.getValue()}
enabled={props.row.original.enabled}
/>
),
},
{
Header: (
}),
columnHelper.accessor("entityName", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("entityName")}
isActive={sortBy === "entityName"}
Expand All @@ -106,16 +110,20 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow }) => {
/>
</SortableTableHeader>
),
headerHighlighted: true,
accessor: "entityName",
customWidth: 30,
responsive: true,
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
<ConnectorNameCell value={cell.value} icon={row.original.entityIcon} enabled={row.original.enabled} />
meta: {
thClassName: styles.width30,
responsive: true,
},
cell: (props) => (
<ConnectorNameCell
value={props.cell.getValue()}
icon={props.row.original.entityIcon}
enabled={props.row.original.enabled}
/>
),
},
{
Header: (
}),
columnHelper.accessor("connectorName", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("connectorName")}
isActive={sortBy === "connectorName"}
Expand All @@ -124,22 +132,30 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow }) => {
<FormattedMessage id={entity === "connection" ? "tables.sourceConnectionToName" : "tables.connector"} />
</SortableTableHeader>
),
accessor: "connectorName",
customWidth: 30,
responsive: true,
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
<ConnectorNameCell value={cell.value} icon={row.original.connectorIcon} enabled={row.original.enabled} />
meta: {
thClassName: styles.width30,
responsive: true,
},
cell: (props) => (
<ConnectorNameCell
value={props.cell.getValue()}
icon={props.row.original.connectorIcon}
enabled={props.row.original.enabled}
/>
),
},
{
Header: <FormattedMessage id="tables.frequency" />,
accessor: "scheduleData",
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
<FrequencyCell value={cell.value} enabled={row.original.enabled} scheduleType={row.original.scheduleType} />
}),
columnHelper.accessor("scheduleData", {
header: () => <FormattedMessage id="tables.frequency" />,
cell: (props) => (
<FrequencyCell
value={props.cell.getValue()}
enabled={props.row.original.enabled}
scheduleType={props.row.original.scheduleType}
/>
),
},
{
Header: (
}),
columnHelper.accessor("lastSync", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("lastSync")}
isActive={sortBy === "lastSync"}
Expand All @@ -148,38 +164,37 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow }) => {
<FormattedMessage id="tables.lastSync" />
</SortableTableHeader>
),
accessor: "lastSync",
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
<LastSyncCell timeInSecond={cell.value} enabled={row.original.enabled} />
),
},
{
Header: <FormattedMessage id="tables.enabled" />,
accessor: "enabled",
customWidth: 1,
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
cell: (props) => <LastSyncCell timeInSeconds={props.cell.getValue()} enabled={props.row.original.enabled} />,
}),
columnHelper.accessor("enabled", {
header: () => <FormattedMessage id="tables.enabled" />,
meta: {
thClassName: styles.thEnabled,
},
cell: (props) => (
<StatusCell
schemaChange={row.original.schemaChange}
enabled={cell.value}
id={row.original.connectionId}
isSyncing={row.original.isSyncing}
isManual={row.original.scheduleType === ConnectionScheduleType.manual}
hasBreakingChange={allowAutoDetectSchema && row.original.schemaChange === SchemaChange.breaking}
schemaChange={props.row.original.schemaChange}
enabled={props.cell.getValue()}
id={props.row.original.connectionId}
isSyncing={props.row.original.isSyncing}
isManual={props.row.original.scheduleType === ConnectionScheduleType.manual}
hasBreakingChange={allowAutoDetectSchema && props.row.original.schemaChange === SchemaChange.breaking}
allowSync={allowSync}
/>
),
},
{
Header: "",
accessor: "connectionId",
customWidth: 1,
Cell: ({ cell }: CellProps<ITableDataItem>) => <ConnectionSettingsCell id={cell.value} />,
},
}),
columnHelper.accessor("connectionId", {
header: "",
meta: {
thClassName: styles.thConnectionSettings,
},
cell: (props) => <ConnectionSettingsCell id={props.cell.getValue()} />,
}),
],
[sortBy, sortOrder, entity, onSortClick, allowSync, allowAutoDetectSchema]
[columnHelper, sortBy, sortOrder, onSortClick, entity, allowAutoDetectSchema, allowSync]
);

return <Table columns={columns} data={sortingData} onClickRow={onClickRow} erroredRows testId="connectionsTable" />;
return <NextTable columns={columns} data={sortingData} onClickRow={onClickRow} testId="connectionsTable" />;
};

export default ConnectionTable;
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
padding-left: 32px !important;
}
}

.thEntityName {
width: 40%;
}
74 changes: 38 additions & 36 deletions airbyte-webapp/src/components/EntityTable/ImplementationTable.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { createColumnHelper } from "@tanstack/react-table";
import queryString from "query-string";
import React, { useCallback } from "react";
import { FormattedMessage } from "react-intl";
import { useNavigate } from "react-router-dom";
import { CellProps } from "react-table";

import { Table, SortableTableHeader } from "components/ui/Table";
import { NextTable } from "components/ui/NextTable";
import { SortableTableHeader } from "components/ui/Table";

import { useQuery } from "hooks/useQuery";

Expand Down Expand Up @@ -64,10 +65,13 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
);

const sortingData = React.useMemo(() => data.sort(sortData), [sortData, data]);

const columnHelper = createColumnHelper<EntityTableDataItem>();

const columns = React.useMemo(
() => [
{
Header: (
columnHelper.accessor("entityName", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("entity")}
isActive={sortBy === "entity"}
Expand All @@ -76,15 +80,13 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
<FormattedMessage id="tables.name" />
</SortableTableHeader>
),
headerHighlighted: true,
accessor: "entityName",
customWidth: 40,
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
<EntityNameCell value={cell.value} enabled={row.original.enabled} />
),
},
{
Header: (
meta: {
thClassName: styles.thEntityName,
},
cell: (props) => <EntityNameCell value={props.cell.getValue()} enabled={props.row.original.enabled} />,
}),
columnHelper.accessor("connectorName", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("connector")}
isActive={sortBy === "connector"}
Expand All @@ -93,20 +95,22 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
<FormattedMessage id="tables.connector" />
</SortableTableHeader>
),
accessor: "connectorName",
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
<ConnectorNameCell value={cell.value} icon={row.original.connectorIcon} enabled={row.original.enabled} />
cell: (props) => (
<ConnectorNameCell
value={props.cell.getValue()}
icon={props.row.original.connectorIcon}
enabled={props.row.original.enabled}
/>
),
},
{
Header: <FormattedMessage id={`tables.${entity}ConnectWith`} />,
accessor: "connectEntities",
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
<ConnectEntitiesCell values={cell.value} entity={entity} enabled={row.original.enabled} />
}),
columnHelper.accessor("connectEntities", {
header: () => <FormattedMessage id={`tables.${entity}ConnectWith`} />,
cell: (props) => (
<ConnectEntitiesCell values={props.cell.getValue()} entity={entity} enabled={props.row.original.enabled} />
),
},
{
Header: (
}),
columnHelper.accessor("lastSync", {
header: () => (
<SortableTableHeader
onClick={() => onSortClick("lastSync")}
isActive={sortBy === "lastSync"}
Expand All @@ -115,24 +119,22 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
<FormattedMessage id="tables.lastSync" />
</SortableTableHeader>
),
accessor: "lastSync",
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
<LastSyncCell timeInSecond={cell.value} enabled={row.original.enabled} />
cell: (props) => (
<LastSyncCell timeInSeconds={props.cell.getValue() || 0} enabled={props.row.original.enabled} />
),
},
{
Header: <FormattedMessage id="sources.status" />,
}),
columnHelper.accessor("connectEntities", {
header: () => <FormattedMessage id="sources.status" />,
id: "status",
accessor: "connectEntities",
Cell: ({ cell }: CellProps<EntityTableDataItem>) => <AllConnectionsStatusCell connectEntities={cell.value} />,
},
cell: (props) => <AllConnectionsStatusCell connectEntities={props.cell.getValue()} />,
}),
],
[entity, onSortClick, sortBy, sortOrder]
[columnHelper, entity, onSortClick, sortBy, sortOrder]
);

return (
<div className={styles.content}>
<Table columns={columns} data={sortingData} onClickRow={onClickRow} erroredRows testId={`${entity}sTable`} />
<NextTable columns={columns} data={sortingData} onClickRow={onClickRow} testId={`${entity}sTable`} />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface AllConnectionStatusConnectEntity {
name: string;
connector: string;
status: string;
lastSyncStatus: string;
lastSyncStatus: string | null;
}

interface AllConnectionsStatusCellProps {
Expand Down
Loading