Skip to content

Commit b91926c

Browse files
committed
chore: [SyncCatalog V2] always show expand/collapse control (#13884)
1 parent c9ff4d8 commit b91926c

File tree

4 files changed

+68
-52
lines changed

4 files changed

+68
-52
lines changed

airbyte-webapp/src/components/connection/ConnectionForm/SyncCatalogTable/SyncCatalogTable.tsx

+16-9
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ import { useConnectionFormService } from "hooks/services/ConnectionForm/Connecti
3232
import { useExperiment } from "hooks/services/Experiment";
3333

3434
import { CursorCell } from "./components/CursorCell";
35+
import { ExpandCollapseAllControl } from "./components/ExpandCollapseAllControl";
3536
import { FieldCursorCell } from "./components/FieldCursorCell";
3637
import { FieldHashMapping } from "./components/FieldHashMapping";
3738
import { FieldPKCell } from "./components/FieldPKCell";
3839
import { FormControls } from "./components/FormControls";
3940
import { HeaderNamespaceCell } from "./components/HeaderNamespaceCell";
4041
import { NamespaceNameCell } from "./components/NamespaceNameCell";
4142
import { PKCell } from "./components/PKCell";
43+
import { RefreshSchemaControl } from "./components/RefreshSchemaControl";
4244
import { SelectedFieldsCell } from "./components/SelectedFieldsCell";
4345
import { StreamFieldNameCell } from "./components/StreamFieldCell";
4446
import { StreamNameCell } from "./components/StreamNameCell";
4547
import { FilterTabId, StreamsFilterTabs } from "./components/StreamsFilterTabs";
4648
import { SyncModeCell } from "./components/SyncModeCell";
47-
import { TableControls } from "./components/TableControls";
4849
import { useInitialRowIndex } from "./hooks/useInitialRowIndex";
4950
import styles from "./SyncCatalogTable.module.scss";
5051
import { getRowChangeStatus, getSyncCatalogRows, isNamespaceRow, isStreamRow } from "./utils";
@@ -451,7 +452,7 @@ export const SyncCatalogTable: FC<SyncCatalogTableProps> = ({ scrollParentContai
451452

452453
return (
453454
<>
454-
<Box p="md" pl="xl" className={styles.stickyControlsContainer}>
455+
<Box p="md" pl="xl" pr="xl" className={styles.stickyControlsContainer}>
455456
{debugTable && (
456457
<Box p="md">
457458
{JSON.stringify(
@@ -481,17 +482,23 @@ export const SyncCatalogTable: FC<SyncCatalogTableProps> = ({ scrollParentContai
481482
<FlexContainer>
482483
<FlexContainer justifyContent="flex-end" alignItems="center" direction="row" gap="lg">
483484
{mode === "create" ? (
484-
<TableControls
485-
isAllRowsExpanded={isAllStreamRowsExpanded}
486-
toggleAllRowsExpanded={toggleAllStreamRowsExpanded}
487-
/>
485+
<>
486+
<RefreshSchemaControl />
487+
<ExpandCollapseAllControl
488+
isAllRowsExpanded={isAllStreamRowsExpanded}
489+
toggleAllRowsExpanded={toggleAllStreamRowsExpanded}
490+
/>
491+
</>
488492
) : (
489-
<FormControls>
490-
<TableControls
493+
<>
494+
<FormControls>
495+
<RefreshSchemaControl />
496+
</FormControls>
497+
<ExpandCollapseAllControl
491498
isAllRowsExpanded={isAllStreamRowsExpanded}
492499
toggleAllRowsExpanded={toggleAllStreamRowsExpanded}
493500
/>
494-
</FormControls>
501+
</>
495502
)}
496503
</FlexContainer>
497504
</FlexContainer>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import React from "react";
2+
import { FormattedMessage } from "react-intl";
3+
4+
import { Button } from "components/ui/Button";
5+
import { Tooltip } from "components/ui/Tooltip";
6+
7+
interface ExpandCollapseAllControlProps {
8+
isAllRowsExpanded: boolean;
9+
toggleAllRowsExpanded: (expanded: boolean) => void;
10+
}
11+
12+
export const ExpandCollapseAllControl: React.FC<ExpandCollapseAllControlProps> = ({
13+
isAllRowsExpanded,
14+
toggleAllRowsExpanded,
15+
}) => (
16+
<Tooltip
17+
placement="top"
18+
control={
19+
<Button
20+
icon={isAllRowsExpanded ? "collapseAll" : "expandAll"}
21+
variant="secondary"
22+
type="button"
23+
onClick={() => toggleAllRowsExpanded(!isAllRowsExpanded)}
24+
/>
25+
}
26+
>
27+
<FormattedMessage id={isAllRowsExpanded ? "tables.collapseAll" : "tables.expandAll"} />
28+
</Tooltip>
29+
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from "react";
2+
import { useFormState } from "react-hook-form";
3+
import { FormattedMessage } from "react-intl";
4+
5+
import { Button } from "components/ui/Button";
6+
import { Tooltip } from "components/ui/Tooltip";
7+
8+
import { FormConnectionFormValues } from "../../formConfig";
9+
import { useRefreshSourceSchemaWithConfirmationOnDirty } from "../../refreshSourceSchemaWithConfirmationOnDirty";
10+
11+
export const RefreshSchemaControl: React.FC = () => {
12+
const { isDirty } = useFormState<FormConnectionFormValues>();
13+
const refreshSchema = useRefreshSourceSchemaWithConfirmationOnDirty(isDirty);
14+
15+
return (
16+
<Tooltip
17+
placement="top"
18+
control={<Button variant="secondary" icon="rotate" type="button" onClick={refreshSchema} />}
19+
>
20+
<FormattedMessage id="connection.updateSchema" />
21+
</Tooltip>
22+
);
23+
};

airbyte-webapp/src/components/connection/ConnectionForm/SyncCatalogTable/components/TableControls.tsx

-43
This file was deleted.

0 commit comments

Comments
 (0)