-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎉 Add column selection UI to new stream table (#21058)
* add column selection UI to new stream table * disable experiment by default * add option to toggle all selected fields * fix header styling * fix missing dependencies * fix checkbox warnings * add ability to select/deselect all, ignoring pk and cursor * typo in merge * refactor method for single field toggle, add tests * test that cursor & pk are selected when toggling all fields * support source defined pk & cursor * disable field selection checkboxes in readonly mode * omit selectedFields if field selection disabled * disable deselection of parent field when child is part of pk or is cursor * fix disabling checkboxes in readonly mode * missing dependency
- Loading branch information
Showing
11 changed files
with
651 additions
and
143 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
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
126 changes: 126 additions & 0 deletions
126
...nnection/CatalogTree/next/StreamDetailsPanel/StreamFieldsTable/StreamFieldsTable.test.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,126 @@ | ||
import { mockStreamConfiguration } from "test-utils/mock-data/mockAirbyteStreamConfiguration"; | ||
|
||
import { AirbyteStreamConfiguration } from "core/request/AirbyteClient"; | ||
|
||
import { isChildFieldCursor, isChildFieldPrimaryKey, isCursor, isPrimaryKey } from "./StreamFieldsTable"; | ||
|
||
const mockIncrementalConfig: AirbyteStreamConfiguration = { | ||
...mockStreamConfiguration, | ||
syncMode: "incremental", | ||
}; | ||
|
||
const mockIncrementalDedupConfig: AirbyteStreamConfiguration = { | ||
...mockStreamConfiguration, | ||
syncMode: "incremental", | ||
destinationSyncMode: "append_dedup", | ||
}; | ||
|
||
describe(`${isCursor.name}`, () => { | ||
it("returns true if the path matches the cursor", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalConfig, | ||
cursorField: ["my_cursor"], | ||
}; | ||
expect(isCursor(config, ["my_cursor"])).toBe(true); | ||
}); | ||
|
||
it("returns false if there is no cursor", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalConfig, | ||
cursorField: undefined, | ||
}; | ||
expect(isCursor(config, ["my_cursor"])).toBe(false); | ||
}); | ||
|
||
it("returns false if the path does not match the cursor", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalConfig, | ||
cursorField: ["my_cursor"], | ||
}; | ||
expect(isCursor(config, ["some_other_field"])).toBe(false); | ||
}); | ||
}); | ||
|
||
describe(`${isChildFieldCursor.name}`, () => { | ||
it("returns true if the path is the parent of the cursor", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalConfig, | ||
cursorField: ["my_cursor", "nested_field"], | ||
}; | ||
expect(isChildFieldCursor(config, ["my_cursor"])).toBe(true); | ||
}); | ||
|
||
it("returns false if there is no cursor", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalConfig, | ||
cursorField: undefined, | ||
}; | ||
expect(isChildFieldCursor(config, ["my_cursor"])).toBe(false); | ||
}); | ||
|
||
it("returns false if the path does not match the cursor", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalConfig, | ||
cursorField: ["my_cursor", "nested_field"], | ||
}; | ||
expect(isChildFieldCursor(config, ["some_other_field"])).toBe(false); | ||
}); | ||
}); | ||
|
||
describe(`${isPrimaryKey.name}`, () => { | ||
it("returns true if the path matches any part of the primary key", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalDedupConfig, | ||
primaryKey: [["some_other_pk"], ["my_pk"]], | ||
}; | ||
expect(isPrimaryKey(config, ["my_pk"])).toBe(true); | ||
}); | ||
|
||
it("returns false if there is no primary key", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalDedupConfig, | ||
primaryKey: undefined, | ||
}; | ||
expect(isPrimaryKey(config, ["my_pk"])).toBe(false); | ||
}); | ||
|
||
it("returns false if the path does not match any part of the primary key", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalDedupConfig, | ||
primaryKey: [["some_other_pk"], ["my_pk"]], | ||
}; | ||
expect(isPrimaryKey(config, ["unrelated_field"])).toBe(false); | ||
}); | ||
}); | ||
|
||
describe(`${isChildFieldPrimaryKey.name}`, () => { | ||
it("returns true if the path is the parent of any part of the primary key", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalDedupConfig, | ||
primaryKey: [ | ||
["some_other_pk", "nested_field"], | ||
["my_pk", "nested_field"], | ||
], | ||
}; | ||
expect(isChildFieldPrimaryKey(config, ["my_pk"])).toBe(true); | ||
}); | ||
|
||
it("returns false if there is no primary key", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalDedupConfig, | ||
primaryKey: undefined, | ||
}; | ||
expect(isChildFieldPrimaryKey(config, ["my_pk"])).toBe(false); | ||
}); | ||
|
||
it("returns false if the path is not the parent of any part of the primary key", () => { | ||
const config: AirbyteStreamConfiguration = { | ||
...mockIncrementalDedupConfig, | ||
primaryKey: [ | ||
["some_other_pk", "nested_field"], | ||
["my_pk", "nested_field"], | ||
], | ||
}; | ||
expect(isChildFieldPrimaryKey(config, ["unrelated_field"])).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.