-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎨 Show Source-defined
cursor
and primary key
fields on new Stre…
…am Details panel (#20366) * add storybook for CheckBox component add disabled state style * just checking how to extend current implementation of storybook * remove experimental changes * replace styled components with css modules add disabled state style add small size style add storybook * update test snapshots * fix checkbox cursor in disabled state * fix overflow issue with table header * create separate Cursor cell component * create separate PK cell component * update links * update translations * update stream details table: optionally show cursor and PK fields and disable them if they are source-defined * add "not-allowed" cursor to disabled radio button
- Loading branch information
Showing
15 changed files
with
140 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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 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
4 changes: 4 additions & 0 deletions
4
...n/CatalogTree/next/StreamDetailsPanel/StreamFieldsTable/CursorCell/CursorCell.module.scss
This file contains 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,4 @@ | ||
.tooltip { | ||
display: flex; | ||
align-items: center; | ||
} |
44 changes: 44 additions & 0 deletions
44
...onnection/CatalogTree/next/StreamDetailsPanel/StreamFieldsTable/CursorCell/CursorCell.tsx
This file contains 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 { CellContext } from "@tanstack/react-table"; | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { RadioButton } from "components/ui/RadioButton"; | ||
import { Tooltip, TooltipLearnMoreLink } from "components/ui/Tooltip"; | ||
|
||
import { links } from "utils/links"; | ||
|
||
import { TableStream } from "../StreamFieldsTable"; | ||
import styles from "./CursorCell.module.scss"; | ||
|
||
interface CursorCellProps extends CellContext<TableStream, boolean | undefined> { | ||
isCursorDefinitionSupported: boolean; | ||
isCursor: (path: string[]) => boolean; | ||
onCursorSelect: (cursorPath: string[]) => void; | ||
} | ||
|
||
export const CursorCell: React.FC<CursorCellProps> = ({ | ||
getValue, | ||
row, | ||
isCursorDefinitionSupported, | ||
isCursor, | ||
onCursorSelect, | ||
}) => { | ||
if (!isCursorDefinitionSupported) { | ||
return null; | ||
} | ||
|
||
const isCursorChecked = isCursor(row.original.path); | ||
|
||
const radioButton = ( | ||
<RadioButton checked={isCursorChecked} onChange={() => onCursorSelect(row.original.path)} disabled={!getValue()} /> | ||
); | ||
|
||
return !getValue() && isCursorChecked ? ( | ||
<Tooltip placement="bottom" control={radioButton} containerClassName={styles.tooltip}> | ||
<FormattedMessage id="form.field.sourceDefinedCursor" /> | ||
<TooltipLearnMoreLink url={links.sourceDefinedCursorLink} /> | ||
</Tooltip> | ||
) : ( | ||
radioButton | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
...nts/connection/CatalogTree/next/StreamDetailsPanel/StreamFieldsTable/CursorCell/index.tsx
This file contains 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 { CursorCell } from "./CursorCell"; |
37 changes: 37 additions & 0 deletions
37
...onents/connection/CatalogTree/next/StreamDetailsPanel/StreamFieldsTable/PKCell/PKCell.tsx
This file contains 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,37 @@ | ||
import { CellContext } from "@tanstack/react-table"; | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { CheckBox } from "components/ui/CheckBox"; | ||
import { Tooltip, TooltipLearnMoreLink } from "components/ui/Tooltip"; | ||
|
||
import { links } from "utils/links"; | ||
|
||
import { TableStream } from "../StreamFieldsTable"; | ||
|
||
interface PKCellProps extends CellContext<TableStream, boolean | undefined> { | ||
isPKDefinitionSupported: boolean; | ||
isPrimaryKey: (path: string[]) => boolean; | ||
onPkSelect: (pkPath: string[]) => void; | ||
} | ||
|
||
export const PKCell: React.FC<PKCellProps> = ({ getValue, row, isPKDefinitionSupported, isPrimaryKey, onPkSelect }) => { | ||
if (!isPKDefinitionSupported) { | ||
return null; | ||
} | ||
|
||
const isPKChecked = isPrimaryKey(row.original.path); | ||
|
||
const checkbox = ( | ||
<CheckBox checked={isPKChecked} onChange={() => onPkSelect(row.original.path)} disabled={!getValue()} /> | ||
); | ||
|
||
return !getValue() && isPKChecked ? ( | ||
<Tooltip placement="bottom" control={checkbox}> | ||
<FormattedMessage id="form.field.sourceDefinedPK" /> | ||
<TooltipLearnMoreLink url={links.sourceDefinedPKLink} /> | ||
</Tooltip> | ||
) : ( | ||
checkbox | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
...ponents/connection/CatalogTree/next/StreamDetailsPanel/StreamFieldsTable/PKCell/index.tsx
This file contains 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 { PKCell } from "./PKCell"; |
This file contains 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 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 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 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 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 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 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 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