-
Notifications
You must be signed in to change notification settings - Fork 4.6k
🪟 🎨 Streams table design pass #18908
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
Changes from all commits
a7f09ef
992e342
d2affee
a8e933d
2b180d1
4c6d248
004dbf9
c655e4a
c3f385e
bfd682b
a6c8ffb
4439cf0
43a24d0
b35b1e8
542d466
9b2ca97
3e86c5f
9d13609
81f46fd
81a4b07
2094b52
e299741
07b68e4
d8f90bc
458914a
35d1808
95a0186
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@use "scss/_colors"; | ||
@use "scss/_variables"; | ||
|
||
.cellText { | ||
color: colors.$grey; | ||
} | ||
|
||
.headerContainer { | ||
margin: variables.$spacing-md variables.$spacing-md variables.$spacing-sm variables.$spacing-sm; | ||
gap: variables.$spacing-sm; | ||
overflow: hidden; | ||
scrollbar-gutter: stable; | ||
min-height: 33px; | ||
} | ||
|
||
.checkboxCell { | ||
margin-right: variables.$spacing-sm; | ||
max-width: 43px; | ||
font-size: 10px; | ||
line-height: 13px; | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-end; | ||
padding-left: calc(#{variables.$spacing-xl} + #{variables.$spacing-sm}); | ||
} | ||
|
||
.arrowPlaceholder { | ||
width: 20px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,77 @@ | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { Cell, Header } from "components/SimpleTableComponents"; | ||
import { CheckBox } from "components/ui/CheckBox"; | ||
import { Text } from "components/ui/Text"; | ||
import { InfoTooltip, TooltipLearnMoreLink } from "components/ui/Tooltip"; | ||
|
||
import { useBulkEditService } from "hooks/services/BulkEdit/BulkEditService"; | ||
import { useConnectionFormService } from "hooks/services/ConnectionForm/ConnectionFormService"; | ||
import { links } from "utils/links"; | ||
|
||
import styles from "./CatalogTreeTableHeader.module.scss"; | ||
|
||
const TextCell: React.FC<React.PropsWithChildren<{ flex?: number }>> = ({ flex, children }) => { | ||
return ( | ||
<Cell flex={flex}> | ||
<Text size="sm" className={styles.cellText}> | ||
{children} | ||
</Text> | ||
</Cell> | ||
); | ||
}; | ||
|
||
export const CatalogTreeTableHeader: React.FC = () => { | ||
const { mode } = useConnectionFormService(); | ||
const { onCheckAll, selectedBatchNodeIds, allChecked } = useBulkEditService(); | ||
|
||
return ( | ||
<Header> | ||
<Cell> | ||
<Header className={styles.headerContainer}> | ||
<div className={styles.checkboxCell}> | ||
{mode !== "readonly" && ( | ||
<CheckBox | ||
onChange={onCheckAll} | ||
indeterminate={selectedBatchNodeIds.length > 0 && !allChecked} | ||
checked={allChecked} | ||
/> | ||
)} | ||
</Cell> | ||
<Cell> | ||
</div> | ||
<TextCell flex={0.5}> | ||
<FormattedMessage id="sources.sync" /> | ||
</Cell> | ||
<Cell> | ||
</TextCell> | ||
{/* <TextCell> | ||
<FormattedMessage id="form.fields" /> | ||
</Cell> | ||
<Cell> | ||
</TextCell> */} | ||
<TextCell flex={1}> | ||
<FormattedMessage id="form.namespace" /> | ||
</Cell> | ||
<Cell> | ||
</TextCell> | ||
<TextCell flex={1}> | ||
<FormattedMessage id="form.streamName" /> | ||
</Cell> | ||
<Cell> | ||
</TextCell> | ||
<TextCell flex={2}> | ||
<FormattedMessage id="form.syncMode" /> | ||
<InfoTooltip> | ||
<FormattedMessage id="connectionForm.syncType.info" /> | ||
<TooltipLearnMoreLink url={links.syncModeLink} /> | ||
</InfoTooltip> | ||
</Cell> | ||
<Cell> | ||
</TextCell> | ||
<TextCell flex={1}> | ||
<FormattedMessage id="form.cursorField" /> | ||
<InfoTooltip> | ||
<FormattedMessage id="connectionForm.cursor.info" /> | ||
</InfoTooltip> | ||
</Cell> | ||
<Cell> | ||
</TextCell> | ||
<TextCell flex={1}> | ||
<FormattedMessage id="form.primaryKey" /> | ||
</Cell> | ||
<Cell /> | ||
<Cell> | ||
</TextCell> | ||
<div className={styles.arrowPlaceholder} /> | ||
<TextCell flex={1}> | ||
<FormattedMessage id="form.namespace" /> | ||
</Cell> | ||
<Cell> | ||
</TextCell> | ||
<TextCell flex={1}> | ||
<FormattedMessage id="form.streamName" /> | ||
</Cell> | ||
<Cell> | ||
<FormattedMessage id="form.syncMode" /> | ||
<InfoTooltip> | ||
<FormattedMessage id="connectionForm.syncType.info" /> | ||
<TooltipLearnMoreLink url={links.syncModeLink} /> | ||
</InfoTooltip> | ||
</Cell> | ||
</TextCell> | ||
</Header> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,14 @@ import { FormattedMessage } from "react-intl"; | |
import { Cell, Row } from "components/SimpleTableComponents"; | ||
import { CheckBox } from "components/ui/CheckBox"; | ||
import { Switch } from "components/ui/Switch"; | ||
import { Text } from "components/ui/Text"; | ||
|
||
import { useBulkEditSelect } from "hooks/services/BulkEdit/BulkEditService"; | ||
|
||
import { StreamHeaderProps } from "../StreamHeader"; | ||
import { HeaderCell } from "../styles"; | ||
import styles from "./CatalogTreeTableRow.module.scss"; | ||
import { StreamPathSelect } from "./StreamPathSelect"; | ||
import { SyncModeSelect } from "./SyncModeSelect"; | ||
|
||
export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({ | ||
stream, | ||
destName, | ||
|
@@ -35,7 +34,7 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({ | |
hasError, | ||
disabled, | ||
}) => { | ||
const { primaryKey, syncMode, cursorField, destinationSyncMode } = stream.config ?? {}; | ||
const { primaryKey, cursorField, syncMode, destinationSyncMode } = stream.config ?? {}; | ||
const isStreamEnabled = stream.config?.selected; | ||
|
||
const { defaultCursorField } = stream.stream ?? {}; | ||
|
@@ -63,14 +62,13 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({ | |
[styles.disabledChange]: changedSelected && !isStreamEnabled, | ||
[styles.selected]: isSelected, | ||
[styles.error]: hasError, | ||
[styles.disabled]: !changedSelected && !isStreamEnabled, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this makes the syncmode dropdown blend into the background. I do see this in the designs as well, and users can't save changes to a disabled stream anyways currently... so maybe that's ok? Since they can't change things, I wonder if we want to disable the dropdowns in these rows though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that! I'm not a big fan, and maybe we can work around it by disabling it. Additionally, I feel the color contrast may be too low and we may need to revisit this with design. |
||
}); | ||
|
||
const checkboxCellCustomStyle = classnames(styles.checkboxCell, styles.streamRowCheckboxCell); | ||
|
||
return ( | ||
<Row onClick={onRowClick} className={streamHeaderContentStyle}> | ||
{!disabled && ( | ||
<div className={checkboxCellCustomStyle}> | ||
<div className={styles.streamRowCheckboxCell}> | ||
{changedSelected && ( | ||
<div> | ||
{isStreamEnabled ? ( | ||
|
@@ -83,24 +81,33 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({ | |
<CheckBox checked={isSelected} onChange={selectForBulkEdit} /> | ||
</div> | ||
)} | ||
<Cell> | ||
<Cell flex={0.5} flush> | ||
<Switch small checked={stream.config?.selected} onChange={onSelectStream} disabled={disabled} /> | ||
</Cell> | ||
<Cell>{fieldCount}</Cell> | ||
<HeaderCell ellipsis title={stream.stream?.namespace || ""}> | ||
{stream.stream?.namespace || <FormattedMessage id="form.noNamespace" />} | ||
</HeaderCell> | ||
<Cell>{stream.stream?.name}</Cell> | ||
<Cell> | ||
{/* <Cell>{fieldCount}</Cell> */} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. field counts look like they're coming back in a future iteration, leaving this here for now... there may need to be adjustments to the |
||
<Cell flex={1} title={stream.stream?.namespace || ""}> | ||
<Text size="md" className={styles.cellText}> | ||
{stream.stream?.namespace || <FormattedMessage id="form.noNamespace" />} | ||
</Text> | ||
</Cell> | ||
<Cell flex={1} title={stream.stream?.name || ""}> | ||
<Text size="md" className={styles.cellText}> | ||
{stream.stream?.name} | ||
</Text> | ||
</Cell> | ||
<div className={styles.syncModeCell}> | ||
{disabled ? ( | ||
<HeaderCell ellipsis title={syncSchema.syncMode}> | ||
{syncSchema.syncMode} | ||
</HeaderCell> | ||
<Cell title={syncSchema.syncMode}> | ||
<Text size="md" className={styles.cellText}> | ||
{syncSchema.syncMode} | ||
</Text> | ||
</Cell> | ||
) : ( | ||
// todo: SyncModeSelect should probably have a Tooltip, append/dedupe ends up ellipsing | ||
<SyncModeSelect options={availableSyncModes} onChange={onSelectSyncMode} value={syncSchema} /> | ||
)} | ||
</Cell> | ||
<HeaderCell> | ||
</div> | ||
<Cell flex={1}> | ||
{cursorType && ( | ||
<StreamPathSelect | ||
pathType={cursorType} | ||
|
@@ -109,8 +116,8 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({ | |
onPathChange={onCursorChange} | ||
/> | ||
)} | ||
</HeaderCell> | ||
<HeaderCell ellipsis> | ||
</Cell> | ||
<Cell flex={1}> | ||
{pkType && ( | ||
<StreamPathSelect | ||
pathType={pkType} | ||
|
@@ -120,25 +127,17 @@ export const CatalogTreeTableRow: React.FC<StreamHeaderProps> = ({ | |
onPathChange={onPrimaryKeyChange} | ||
/> | ||
)} | ||
</HeaderCell> | ||
<Cell> | ||
<FontAwesomeIcon icon={faArrowRight} /> | ||
</Cell> | ||
<HeaderCell ellipsis title={destNamespace}> | ||
{destNamespace} | ||
</HeaderCell> | ||
<HeaderCell ellipsis title={destName}> | ||
{destName} | ||
</HeaderCell> | ||
<Cell> | ||
{disabled ? ( | ||
<HeaderCell ellipsis title={syncSchema.destinationSyncMode}> | ||
{syncSchema.destinationSyncMode} | ||
</HeaderCell> | ||
) : ( | ||
// TODO: Replace with Dropdown/Popout | ||
syncSchema.destinationSyncMode | ||
)} | ||
<FontAwesomeIcon icon={faArrowRight} className={styles.arrowCell} /> | ||
<Cell flex={1} title={destNamespace}> | ||
<Text size="md" className={styles.cellText}> | ||
{destNamespace} | ||
</Text> | ||
</Cell> | ||
<Cell flex={1} title={destName}> | ||
<Text size="md" className={styles.cellText}> | ||
{destName} | ||
</Text> | ||
</Cell> | ||
</Row> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,37 @@ $icon-size: 15px; | |
.container { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
padding: variables.$spacing-lg calc(variables.$spacing-lg * 2); | ||
padding: variables.$spacing-xl calc(#{variables.$spacing-lg} * 2) 0; | ||
height: 43px; | ||
align-items: center; | ||
overflow: hidden; | ||
scrollbar-gutter: stable; | ||
} | ||
|
||
.connector { | ||
display: flex; | ||
flex-direction: row; | ||
flex: none; | ||
align-self: stretch; | ||
align-items: center; | ||
gap: variables.$spacing-sm; | ||
} | ||
|
||
.source { | ||
flex: 7.3 0 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The .3 is an unfortunate awkward number. This value is the sum of the |
||
min-width: 0; | ||
} | ||
|
||
.destination { | ||
flex: 2 0 0; | ||
min-width: 0; | ||
} | ||
|
||
.icon { | ||
height: $icon-size; | ||
width: $icon-size; | ||
height: $icon-size; | ||
} | ||
|
||
.arrowContainer { | ||
width: 20px; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw the field count looks like it will be in the design in a future round. Leaving this here.