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

New Streams Table Column Sizing Fix #20141

Merged
merged 36 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2af3e9d
Better flex handling
krishnaglick Dec 6, 2022
a4e43bd
flex scaling off
krishnaglick Dec 6, 2022
0c8d8f6
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Dec 6, 2022
aeb02a1
flex!
krishnaglick Dec 6, 2022
09b3dc0
Added comment
krishnaglick Dec 6, 2022
b1fb9f3
Cleanup Cell props
krishnaglick Dec 6, 2022
a61a825
Re-adding the padding for most use cases. This "fixes" the old table.
krishnaglick Dec 7, 2022
61cee57
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Dec 7, 2022
52fd062
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Dec 7, 2022
2f9c530
Fixing bold table header
krishnaglick Dec 7, 2022
7541097
Move scrolling to the correct level
krishnaglick Dec 7, 2022
0b0b097
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Dec 8, 2022
30c47cd
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Dec 8, 2022
ecd304f
Further styling fixes
krishnaglick Dec 8, 2022
5118061
Everything is working
krishnaglick Dec 8, 2022
8fb4e9d
Added new table cell so we don't use the old one
krishnaglick Dec 8, 2022
35e0a51
cleanup
krishnaglick Dec 8, 2022
92d338c
Everything is working on the new table???
krishnaglick Dec 9, 2022
8e5d56c
Fixing header
krishnaglick Dec 9, 2022
57c4dbf
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Dec 12, 2022
73dbfb7
Merge remote-tracking branch 'origin' into kc/fix-new-table-column-si…
krishnaglick Dec 12, 2022
0d2b24b
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Dec 13, 2022
b352f87
Snapshots
krishnaglick Dec 13, 2022
b7c2df8
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Dec 15, 2022
c2c0e62
Consolidate checkbox styles
krishnaglick Dec 15, 2022
0ff8247
Cleanup
krishnaglick Dec 15, 2022
c3d6f4f
Fixing old table
krishnaglick Dec 16, 2022
56c7671
Don't want padding on new table
krishnaglick Dec 16, 2022
8497700
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Dec 19, 2022
7b90282
Overflow and padding changes
krishnaglick Dec 19, 2022
bf9a9ce
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Jan 3, 2023
2e737bf
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Jan 3, 2023
fa784fb
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Jan 3, 2023
82fbf71
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Jan 3, 2023
f1e9e3a
Merge branch 'master' into kc/fix-new-table-column-sizing
krishnaglick Jan 4, 2023
316c6e1
Merge branch 'master' of github.com:airbytehq/airbyte into kc/fix-new…
krishnaglick Jan 5, 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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ export const Header = styled(Row)`
export const Cell = styled.div<{
flex?: number;
light?: boolean;
lighter?: boolean;
ellipsis?: boolean;
flush?: boolean;
}>`
flex: ${({ flex }) => (flex !== undefined ? flex : 1)} 0 0;
padding-right: ${({ flush }) => (flush ? 0 : 10)}px;
word-break: break-word;
color: ${({ theme, light, lighter }) => (light ? theme.greyColor40 : lighter ? theme.greyColor60 : "inherit")};
font-weight: ${({ light, lighter }) => (light || lighter ? "normal" : "inherit")};
color: ${({ theme, light }) => (light ? theme.greyColor60 : "inherit")};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

light was unused so I renamed lighter to light and removed the light functionality.

font-weight: ${({ light }) => (light ? "normal" : "inherit")};

overflow: ${({ ellipsis }) => (ellipsis ? "hidden" : "inherit")};
text-overflow: ${({ ellipsis }) => (ellipsis ? "ellipsis" : "inherit")};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@

.catalogTreeTable {
padding: variables.$spacing-lg variables.$spacing-xl 0;
overflow: auto;
border-radius: 10px;
margin-bottom: 29px;

&.newCatalogTreeTable {
padding: 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import classNames from "classnames";
import React, { useCallback, useMemo, useState } from "react";

import { LoadingBackdrop } from "components/ui/LoadingBackdrop";
Expand All @@ -7,15 +8,10 @@ import { BulkEditServiceProvider } from "hooks/services/BulkEdit/BulkEditService
import { useConnectionFormService } from "hooks/services/ConnectionForm/ConnectionFormService";
import { naturalComparatorBy } from "utils/objects";

import { BulkHeader } from "./BulkHeader";
import styles from "./CatalogTree.module.scss";
import { CatalogTreeBody } from "./CatalogTreeBody";
import { CatalogTreeHeader } from "./CatalogTreeHeader";
import { CatalogTreeSearch } from "./CatalogTreeSearch";
import { CatalogTreeSubheader } from "./CatalogTreeSubheader";
import { BulkEditPanel } from "./next/BulkEditPanel";
import { CatalogTreeTableHeader } from "./next/CatalogTreeTableHeader";
import { StreamConnectionHeader } from "./next/StreamConnectionHeader";

interface CatalogTreeProps {
streams: SyncSchemaStream[];
Expand Down Expand Up @@ -76,19 +72,9 @@ const CatalogTreeComponent: React.FC<React.PropsWithChildren<CatalogTreeProps>>
<BulkEditServiceProvider nodes={streams} update={onStreamsChanged}>
<LoadingBackdrop loading={isLoading}>
{mode !== "readonly" && <CatalogTreeSearch onSearch={setSearchString} />}
<div className={isNewStreamsTableEnabled ? undefined : styles.catalogTreeTable}>
{isNewStreamsTableEnabled ? (
<>
<StreamConnectionHeader />
<CatalogTreeTableHeader />
</>
) : (
<>
<CatalogTreeHeader />
<CatalogTreeSubheader />
<BulkHeader />
</>
)}
<div
className={classNames(styles.catalogTreeTable, { [styles.newCatalogTreeTable]: isNewStreamsTableEnabled })}
>
<CatalogTreeBody
streams={filteredStreams}
changedStreams={changedStreams}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.container {
margin-bottom: 29px;
max-height: 600px;
overflow-y: auto;
overflow: unset;
min-width: fit-content;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely core to this working.


--webkit-overlay: true;

width: 100%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,22 @@ import { AirbyteStreamConfiguration } from "core/request/AirbyteClient";
import { useConnectionFormService } from "hooks/services/ConnectionForm/ConnectionFormService";
import { FormikConnectionFormValues } from "views/Connection/ConnectionForm/formConfig";

import { BulkHeader } from "./BulkHeader";
import { CatalogSection } from "./CatalogSection";
import styles from "./CatalogTreeBody.module.scss";
import { CatalogTreeHeader } from "./CatalogTreeHeader";
import { CatalogTreeSubheader } from "./CatalogTreeSubheader";
import { CatalogTreeTableHeader } from "./next/CatalogTreeTableHeader";
import { StreamConnectionHeader } from "./next/StreamConnectionHeader";

interface CatalogTreeBodyProps {
streams: SyncSchemaStream[];
changedStreams: SyncSchemaStream[];
onStreamChanged: (stream: SyncSchemaStream) => void;
}

const isNewStreamsTableEnabled = process.env.REACT_APP_NEW_STREAMS_TABLE ?? false;

export const CatalogTreeBody: React.FC<CatalogTreeBodyProps> = ({ streams, changedStreams, onStreamChanged }) => {
const { mode } = useConnectionFormService();

Expand All @@ -33,6 +40,18 @@ export const CatalogTreeBody: React.FC<CatalogTreeBodyProps> = ({ streams, chang

return (
<div className={styles.container}>
{isNewStreamsTableEnabled ? (
<>
<StreamConnectionHeader />
<CatalogTreeTableHeader />
</>
) : (
<>
<CatalogTreeHeader />
<CatalogTreeSubheader />
<BulkHeader />
</>
)}
{streams.map((streamNode) => (
<Field key={`schema.streams[${streamNode.id}].config`} name={`schema.streams[${streamNode.id}].config`}>
{({ form }: FieldProps<FormikConnectionFormValues>) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,36 @@ export const CatalogTreeHeader: React.FC = () => {
</Cell>
)}
{mode !== "readonly" && <Cell flex={0.1} />}
<Cell lighter flex={0.4}>
<Cell light flex={0.4}>
<FormattedMessage id="sources.sync" />
</Cell>
<Cell lighter>
<Cell light>
<FormattedMessage id="sources.source" />
<InfoTooltip>
<FormattedMessage id="connectionForm.source.info" />
</InfoTooltip>
</Cell>
<Cell />
<Cell lighter flex={1.5}>
<Cell light flex={1.5}>
<FormattedMessage id="form.syncMode" />
<InfoTooltip>
<FormattedMessage id="connectionForm.syncType.info" />
<TooltipLearnMoreLink url={links.syncModeLink} />
</InfoTooltip>
</Cell>
<Cell lighter>
<Cell light>
<FormattedMessage id="form.cursorField" />
<InfoTooltip>
<FormattedMessage id="connectionForm.cursor.info" />
</InfoTooltip>
</Cell>
<Cell lighter>
<Cell light>
<FormattedMessage id="form.primaryKey" />
<InfoTooltip>
<FormattedMessage id="connectionForm.primaryKey.info" />
</InfoTooltip>
</Cell>
<Cell lighter>
<Cell light>
<FormattedMessage id="connector.destination" />
<InfoTooltip>
<FormattedMessage id="connectionForm.destinationName.info" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useConnectionFormService } from "hooks/services/ConnectionForm/Connecti

import styles from "./CatalogTreeSubheader.module.scss";

const SubtitleCell = styled(Cell).attrs(() => ({ lighter: true }))`
const SubtitleCell = styled(Cell).attrs(() => ({ light: true }))`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not caught by the rename! Can't wait to get rid of styled components.

font-size: 10px;
line-height: 12px;
border-top: 1px solid ${({ theme }) => theme.greyColor0};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,34 @@ const FieldHeaderInner: React.FC = () => {
return (
<>
{isColumnSelectionEnabled && (
<HeaderCell lighter flex={0}>
<HeaderCell light flex={0}>
<SyncHeaderContainer>
<FormattedMessage id="form.field.sync" />
</SyncHeaderContainer>
</HeaderCell>
)}
<HeaderCell lighter flex={1.5}>
<HeaderCell light flex={1.5}>
{!isColumnSelectionEnabled && (
<NameContainer>
<FormattedMessage id="form.field.name" />
</NameContainer>
)}
{isColumnSelectionEnabled && <FormattedMessage id="form.field.name" />}
</HeaderCell>
<HeaderCell lighter>
<HeaderCell light>
<FormattedMessage id="form.field.dataType" />
</HeaderCell>
<HeaderCell lighter>
<HeaderCell light>
<FormattedMessage id="form.field.cursorField" />
</HeaderCell>
<HeaderCell lighter>
<HeaderCell light>
<FormattedMessage id="form.field.primaryKey" />
</HeaderCell>
<HeaderCell lighter flex={1.5}>
<HeaderCell light flex={1.5}>
<FormattedMessage id="form.field.destinationName" />
</HeaderCell>
</>
);
};

const FieldHeader = memo(FieldHeaderInner);

export { FieldHeader };
export const FieldHeader = memo(FieldHeaderInner);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$xsmall: 20px;
$small: 50px;
$medium: 120px;
$large: 200px;

.tableCell {
flex: 1 0 $medium;
min-width: $medium;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pair this with the flex-basis for it to work.

word-break: break-word;
overflow: hidden;
text-overflow: ellipsis;

&.xsmall {
flex-basis: $xsmall;
min-width: $xsmall;
}

&.small {
flex-basis: $small;
min-width: $small;
}

&.large {
flex-basis: $large;
min-width: $large;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import classNames from "classnames";
import React from "react";

import styles from "./CatalogTreeTableCell.module.scss";

type Sizes = "xsmall" | "small" | "medium" | "large";

interface CatalogTreeTableCellProps {
size?: Sizes;
className?: string;
}

// This lets us avoid the eslint complaint about unused styles
const sizeMap: Record<Sizes, string> = {
xsmall: styles.xsmall,
small: styles.small,
medium: styles.medium,
large: styles.large,
};

export const CatalogTreeTableCell: React.FC<React.PropsWithChildren<CatalogTreeTableCellProps>> = ({
size = "medium",
className,
children,
}) => {
return <div className={classNames(styles.tableCell, className, sizeMap[size])}>{children}</div>;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New cell component for these tables

Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
@use "scss/_colors";
@use "scss/_variables";
@forward "./CatalogTreeTableRow.module.scss";

.cellText {
color: colors.$grey;
}

.headerContainer {
margin: variables.$spacing-md variables.$spacing-md variables.$spacing-sm variables.$spacing-md;
margin: variables.$spacing-md 0 variables.$spacing-sm 0;
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});
&.newTable {
overflow: unset;
}
}

.arrowPlaceholder {
width: 20px;
.checkboxCell {
@extend %streamRowCheckboxCell;
}
Loading