-
Notifications
You must be signed in to change notification settings - Fork 4.6k
🪟 🎨 New stream details panel #19219
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
Merged
Merged
🪟 🎨 New stream details panel #19219
Changes from 13 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
44be48c
move all stream details table related components to separate folder;
dizel852 2857f77
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 a1e130f
init a copy of existing <Table /> component - <NextTable />
dizel852 2683c52
fixed calc error
dizel852 4762ec6
first implementation of NextTable:
dizel852 e10558c
remove StreamDetailsHeader
dizel852 bab038c
updated StreamFieldsTable
dizel852 0c51fea
fix typings error
dizel852 26bdcfa
update NextTable cells classnames
dizel852 9b3d3f5
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 55c503e
remove last styled component from NextTable
dizel852 79da2d7
add base tests for NextTable component
dizel852 adbfa7a
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 ff7d723
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 f809457
remove comments
dizel852 c86d71f
replace "any" type with "unknown" where possible
dizel852 bd1323e
add react-table v8 package
dizel852 977bb14
update NextTable component
dizel852 6822e57
update NextTable component
dizel852 9ebca26
extend react-table ColumnMeta interface
dizel852 259825d
update StreamFieldsTable component
dizel852 ae43af1
update NextTable tests
dizel852 0bb9d7a
update NextTable storybook
dizel852 79d1daf
fixed crashed StreamConnectionHeader during connection creation
dizel852 d47e61f
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 f308517
replace useConnectionEditService with useConnectionFormService hook
dizel852 5e1db97
remove getIcon wrap function and combine all parts in separate component
dizel852 9d352ae
update styles
dizel852 bfbf327
extract common logic to separate function
dizel852 ff096a2
fix performance
dizel852 7441bd3
fix not capitalized table header cell
dizel852 e537f40
fix checkbox style issue
dizel852 24b9113
make thead sticky by default
dizel852 d2e3257
fix not scrollable table
dizel852 8844c22
fixed top bar overflow during scrolling table
dizel852 5c31048
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 671a77a
fix top bar overflow during scrolling table - second try
dizel852 637668a
fix hidden cursor and pk columns
dizel852 a3be3cb
fix hidden cursor and pk columns
dizel852 55c9eab
fix PR comments: replace css values with variables
dizel852 c5f2349
remove unnecessary hook dependencies
dizel852 e404747
fix relative import component path
dizel852 a0b0566
add space around panel;
dizel852 ce62b2a
fix arrow color
dizel852 2a8fb82
align table padding with toggle
dizel852 73c328e
add ArrowRight icon from design
dizel852 9fbd654
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 d7fedc2
move NextTable component to ui folder
dizel852 03f432c
move StreamDetailsPanel component to separate folder
dizel852 7c47f66
move StreamPanelHeader component to separate folder
dizel852 e9a3eed
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 fcf34cc
remove obsolete DetailsPanel components
dizel852 1ca986e
move all DetailsPanel related components to separate folder
dizel852 6156c03
fix when no namespace
dizel852 1d5b6b1
fixed details panel header sync mode label
dizel852 3436402
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 0c19aa8
fix relative import path
dizel852 80b1006
move react-table.d.ts to src/types
dizel852 4b98045
remove fake destination data type column
dizel852 6afc3db
add FormattedMessage to ConnectorHeaderGroupIcon
dizel852 decdf8c
fix StreamPanelHeader style to match Figma
dizel852 0106fe8
change td color from grey-100 to grey-50
dizel852 9ab40af
temporary remove @tanstack/react-table package
dizel852 cb6c52b
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 567fa06
add @tanstack/react-table back to package.json
dizel852 ebae26e
fix cross icon color
dizel852 62c13e2
Merge branch 'master' into vlad/18242-new-streams-details-panel
dizel852 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
airbyte-webapp/src/components/connection/CatalogTree/next/NextTable/NextTable.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@use "scss/colors"; | ||
|
||
// ------- <table/> -------- | ||
.table { | ||
border-spacing: 0; | ||
width: 100%; | ||
max-width: 100%; | ||
border-radius: 10px; | ||
} | ||
|
||
// --------- <th/> --------- | ||
.th { | ||
background: colors.$grey-50; | ||
color: colors.$grey; | ||
text-transform: uppercase; | ||
border-bottom: none; | ||
text-align: left; | ||
font-size: 10px; | ||
line-height: 12px; | ||
font-weight: 600; | ||
|
||
&:first-child { | ||
padding-left: 45px; | ||
border-radius: 10px 0 0; | ||
} | ||
|
||
&:last-child { | ||
padding-left: 15px; | ||
border-radius: 0 10px 0 0; | ||
} | ||
} | ||
|
||
// --------- <tr/> --------- | ||
.tr { | ||
background: colors.$white; | ||
cursor: auto; | ||
|
||
&:hover { | ||
background-color: colors.$grey-50; | ||
} | ||
} | ||
|
||
// --------- <td/> --------- | ||
|
||
.td { | ||
padding: 16px 13px; | ||
font-size: 12px; | ||
line-height: 15px; | ||
font-weight: normal; | ||
color: colors.$dark-blue; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
border-bottom: 1px solid colors.$grey-100; | ||
dizel852 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
width: auto; | ||
|
||
tr:last-child > & { | ||
border-bottom: none; | ||
|
||
&:first-child { | ||
border-radius: 0 0 0 10px; | ||
dizel852 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
&:last-child { | ||
border-radius: 0 0 10px; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
airbyte-webapp/src/components/connection/CatalogTree/next/NextTable/NextTable.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { render } from "@testing-library/react"; | ||
import { CellProps } from "react-table"; | ||
|
||
import { NextTable } from "./NextTable"; | ||
|
||
interface Item { | ||
name: string; | ||
value: number; | ||
} | ||
|
||
describe("<NextTable>", () => { | ||
it("should should render the table with passed data", () => { | ||
const data: Item[] = [ | ||
{ name: "2017", value: 100 }, | ||
{ name: "2018", value: 300 }, | ||
{ name: "2019", value: 500 }, | ||
{ name: "2020", value: 400 }, | ||
{ name: "2021", value: 200 }, | ||
]; | ||
|
||
const columns = [ | ||
{ | ||
Header: "Name", | ||
accessor: "name", | ||
Cell: ({ cell }: CellProps<Item>) => <strong>{cell.value}</strong>, | ||
}, | ||
{ | ||
Header: "Value", | ||
accessor: "value", | ||
Cell: ({ cell }: CellProps<Item>) => <>{cell.value}</>, | ||
}, | ||
]; | ||
|
||
const { getByText, container } = render(<NextTable columns={columns} data={data} />); | ||
expect(getByText(/2019/)).toBeInTheDocument(); | ||
expect(getByText(/500/)).toBeInTheDocument(); | ||
|
||
expect(container.querySelectorAll("thead tr")).toHaveLength(1); | ||
expect(container.querySelectorAll("tbody tr")).toHaveLength(data.length); | ||
}); | ||
}); |
96 changes: 96 additions & 0 deletions
96
airbyte-webapp/src/components/connection/CatalogTree/next/NextTable/NextTable.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import classNames from "classnames"; | ||
import React, { memo, useMemo } from "react"; | ||
import { Column, SortingRule, useSortBy, useTable } from "react-table"; | ||
|
||
import styles from "./NextTable.module.scss"; | ||
|
||
interface TableProps { | ||
columns: ReadonlyArray<Column<Record<string, unknown>>>; | ||
erroredRows?: boolean; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
data: any[]; | ||
dizel852 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
onClickRow?: (data: any) => void; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
sortBy?: Array<SortingRule<any>>; | ||
} | ||
|
||
export const NextTable: React.FC<TableProps> = memo(({ columns, data, onClickRow, sortBy }) => { | ||
const [plugins, config] = useMemo(() => { | ||
const pl = []; | ||
const plConfig: Record<string, unknown> = {}; | ||
|
||
if (sortBy) { | ||
pl.push(useSortBy); | ||
plConfig.initialState = { sortBy }; | ||
} | ||
return [pl, plConfig]; | ||
}, [sortBy]); | ||
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable( | ||
{ | ||
...config, | ||
columns, | ||
data, | ||
}, | ||
...plugins | ||
); | ||
|
||
return ( | ||
<table className={styles.table} {...getTableProps()}> | ||
<thead> | ||
{headerGroups.map((headerGroup, key) => ( | ||
<tr {...headerGroup.getHeaderGroupProps()} key={`table-header-${key}`}> | ||
{headerGroup.headers.map((column, columnKey) => ( | ||
<th | ||
{...column.getHeaderProps([ | ||
{ | ||
className: classNames( | ||
styles.th, | ||
// @ts-expect-error will be fixed when with typings | ||
dizel852 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
column.thClassName | ||
), | ||
}, | ||
])} | ||
key={`table-column-${key}-${columnKey}`} | ||
> | ||
{column.render("Header")} | ||
</th> | ||
))} | ||
</tr> | ||
))} | ||
</thead> | ||
<tbody {...getTableBodyProps()}> | ||
{rows.map((row) => { | ||
prepareRow(row); | ||
return ( | ||
<tr | ||
{...row.getRowProps()} | ||
className={styles.tr} | ||
key={`table-row-${row.id}`} | ||
onClick={() => onClickRow?.(row.original)} | ||
> | ||
{row.cells.map((cell, key) => { | ||
return ( | ||
<td | ||
{...cell.getCellProps([ | ||
{ | ||
className: classNames( | ||
styles.td, | ||
// @ts-expect-error will be fixed when with typings | ||
cell.column.tdClassName | ||
), | ||
}, | ||
])} | ||
key={`table-cell-${row.id}-${key}`} | ||
> | ||
{cell.render("Cell")} | ||
</td> | ||
); | ||
})} | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
); | ||
}); |
44 changes: 44 additions & 0 deletions
44
airbyte-webapp/src/components/connection/CatalogTree/next/NextTable/index.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { ComponentStory, ComponentMeta } from "@storybook/react"; | ||
import { CellProps } from "react-table"; | ||
|
||
import { NextTable } from "./NextTable"; | ||
|
||
export default { | ||
title: "UI/NextTable", | ||
component: NextTable, | ||
argTypes: {}, | ||
} as ComponentMeta<typeof NextTable>; | ||
|
||
const Template: ComponentStory<typeof NextTable> = (args) => <NextTable {...args} />; | ||
|
||
interface Item { | ||
name: string; | ||
value: number; | ||
} | ||
|
||
const data: Item[] = [ | ||
{ name: "2017", value: 100 }, | ||
{ name: "2018", value: 300 }, | ||
{ name: "2019", value: 500 }, | ||
{ name: "2020", value: 400 }, | ||
{ name: "2021", value: 200 }, | ||
]; | ||
|
||
const columns = [ | ||
{ | ||
Header: "Name", | ||
accessor: "name", | ||
Cell: ({ cell }: CellProps<Item>) => <strong>{cell.value}</strong>, | ||
}, | ||
{ | ||
Header: "Value", | ||
accessor: "value", | ||
Cell: ({ cell }: CellProps<Item>) => <>{cell.value}</>, | ||
}, | ||
]; | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
data, | ||
columns, | ||
}; |
1 change: 1 addition & 0 deletions
1
airbyte-webapp/src/components/connection/CatalogTree/next/NextTable/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./NextTable"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
airbyte-webapp/src/components/connection/CatalogTree/next/StreamFieldsTable.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.