-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🪟🎉 Connector builder: Add manual schema #20862
Merged
Merged
Changes from all commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
d2ed762
improve some types
f474a1c
Merge remote-tracking branch 'upstream/master' into chore-improve-con…
5b0521f
improve further
af659fd
Merge remote-tracking branch 'upstream/master' into chore-improve-con…
1cd3bbb
clean up a bit more
807c436
refactor loading state
6c76e0f
Merge remote-tracking branch 'upstream/master' into flash1293/connect…
05c3107
move loading state up
eee4303
remove isLoading references
7d6f977
remove unused props and make fetch connector error work
0fe11f0
remove special component for name
34d4814
remove top level state for unifinished flows
67d62c5
Merge remote-tracking branch 'upstream/master' into flash1293/connect…
afea882
Merge branch 'flash1293/connector-form-name-override' into flash1293/…
c7e7475
Merge branch 'master' into flash1293/connector-form-loading-state
cc7f65f
Merge branch 'chore-improve-connector-form-types' into flash1293/conn…
a1c6cbd
start removing uiwidget
9be8337
Update airbyte-webapp/src/views/Connector/ConnectorCard/ConnectorCard…
37cee8f
Merge remote-tracking branch 'upstream/master' into flash1293/connect…
5686241
Merge branch 'flash1293/connector-form-loading-state' of github.com:a…
7b73364
remove undefined option for selected id
7058d26
Merge branch 'flash1293/connector-form-loading-state' into flash1293/…
dd7e82a
Merge branch 'flash1293/connector-form-name-override' into flash1293/…
6d4c7d3
Merge remote-tracking branch 'upstream/master' into flash1293/connect…
d624792
Merge branch 'flash1293/connector-form-loading-state' into flash1293/…
36cf941
Merge branch 'flash1293/connector-form-name-override' into flash1293/…
b7a6322
Merge remote-tracking branch 'upstream/master' into flash1293/connect…
72b602a
Merge branch 'flash1293/connector-form-loading-state' into flash1293/…
5e47a4a
Merge branch 'flash1293/connector-form-name-override' into flash1293/…
6c71028
Merge remote-tracking branch 'origin/master' into flash1293/connector…
809625f
remove unused prop
10446eb
Merge branch 'flash1293/connector-form-loading-state' into flash1293/…
4a7a885
Merge branch 'flash1293/connector-form-name-override' into flash1293/…
2024b60
Merge branch 'flash1293/connector-form-unifinished-flows' into flash1…
ee30092
fix types
d91df38
remove uiwidget state
93fe558
Merge remote-tracking branch 'origin/master' into flash1293/connector…
cbc023a
Merge branch 'flash1293/connector-form-name-override' into flash1293/…
ec54d38
Merge branch 'flash1293/connector-form-unifinished-flows' into flash1…
47152ea
clean up
6ec0e10
adjust comment
1aa7829
handle errors in a nice way
7b90088
do not respect default on oneOf fields
fbefbdd
rename to formblock
6b3e5e2
reduce re-renders
9aa3f80
Merge remote-tracking branch 'origin/master' into flash1293/connector…
c765003
Merge branch 'flash1293/connector-form-unifinished-flows' into flash1…
5cd77ec
pass error to secure inputs
5dfbc22
Merge remote-tracking branch 'origin/master' into flash1293/connector…
a6aa741
simplify and improve styling
95717d2
align top
40d162d
Merge branch 'flash1293/connector-form-unifinished-flows' into flash1…
b9384ee
Merge remote-tracking branch 'origin/master' into flash1293/connector…
582a5f2
code review
18d6ce8
remove comment
60c1f1c
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
9cb595d
Merge remote-tracking branch 'origin/master' into flash1293/connector…
fe74a45
review comments
5c00ad0
rename file
bd0dffc
be strict about boolean values
1ff8c13
add example
c6ee526
track form error in error boundary
05bbd6f
Merge branch 'flash1293/connector-form-remove-ui-widget-state' of git…
fff4703
Merge remote-tracking branch 'origin/master' into flash1293/connector…
94ba866
review comments
97bb0a7
handle unexpected cases better
633b9b2
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
e47517f
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
e931956
Merge remote-tracking branch 'origin/master' into feature/connector-b…
6889f66
enrich error with connector id
7b60406
Merge branch 'flash1293/connector-form-remove-ui-widget-state' into f…
d5e56eb
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
35a74ba
Merge branch 'flash1293/connector-form-remove-ui-widget-state' into f…
02c8096
🪟🎉 Add copy stream button (#20577)
526adfc
rename prop
7d49233
🪟🎉 Connector builder: Integrate connector form for test input (#20385)
c5da764
Merge remote-tracking branch 'origin/master' into flash1293/connector…
6c0bf9d
Merge branch 'flash1293/connector-form-remove-ui-widget-state' into f…
477977f
use request_body_json instead of request_body_data
lmossman 200cfe7
:window: :art: Move `Add` button into the line of Connector Builder k…
lmossman c7fd310
🪟🎉 Connector builder: Allow defining inputs (#20431)
e0e3796
fix merge conflict with dropdown prop being renamed to control
e23a6d8
[Connector Builder] Add paginator (#20698)
lmossman 610e668
[Connector Builder] Add stream slicer (#20748)
lmossman e68ff49
debounce form builder values update to reduce load
9ccf294
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
ae9a229
Merge branch 'flash1293/connector-form-remove-ui-widget-state' into f…
a9e1d09
🪟🔧 Connector builder: use new lowcode manifest (#20715)
1965efe
add manual schema
c8f3920
make buttons not submit the form accidentally
e4f7bba
debounce validation as well
16c71ae
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
54c070d
Merge branch 'flash1293/connector-form-remove-ui-widget-state' into f…
a8b9aae
Merge branch 'feature/connector-builder' into flash1293/add-manual-sc…
2e20fa6
akways show stream test button in error state if there are errors
65199d0
fix type of oauth input
92722e0
Merge branch 'master' into flash1293/connector-form-remove-ui-widget-…
718c233
Merge branch 'flash1293/connector-form-remove-ui-widget-state' into f…
c303a5d
Merge branch 'feature/connector-builder' into flash1293/add-manual-sc…
6a8be0b
Merge remote-tracking branch 'origin/master' into feature/connector-b…
753241d
Merge branch 'feature/connector-builder' into flash1293/add-manual-sc…
16ce351
add validation schema for add stream form
lmossman 25d6586
validate all views on test click
lmossman 64a5eb9
add type to prevent console warning
lmossman 1db62dd
Merge branch 'feature/connector-builder' into flash1293/add-manual-sc…
2a3776f
Merge remote-tracking branch 'origin/master' into flash1293/add-manua…
abb9c0b
improve error indicator
08e6d99
make schema editor take up full height (#21000)
lmossman 12db741
Merge branch 'flash1293/add-manual-schema' of github.com:airbytehq/ai…
7088b2c
prevent resizing card when error message is shown or hidden
lmossman 5423192
Merge remote-tracking branch 'origin/master' into flash1293/add-manua…
daae429
Revert "improve error indicator"
4a7ffc6
Merge remote-tracking branch 'origin/master' into flash1293/add-manua…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
display: flex; | ||
flex-direction: column; | ||
gap: variables.$spacing-md; | ||
height: 100%; | ||
} | ||
|
||
.heading { | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,12 @@ import { faTrashCan, faCopy } from "@fortawesome/free-regular-svg-icons"; | |
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import classNames from "classnames"; | ||
import { useField } from "formik"; | ||
import { useIntl } from "react-intl"; | ||
import { useState } from "react"; | ||
import { FormattedMessage, useIntl } from "react-intl"; | ||
|
||
import Indicator from "components/Indicator"; | ||
import { CodeEditor } from "components/ui/CodeEditor"; | ||
import { Text } from "components/ui/Text"; | ||
|
||
import { useConfirmationModalService } from "hooks/services/ConfirmationModal"; | ||
import { BuilderView, useConnectorBuilderState } from "services/connectorBuilder/ConnectorBuilderStateService"; | ||
|
@@ -26,6 +31,7 @@ interface StreamConfigViewProps { | |
export const StreamConfigView: React.FC<StreamConfigViewProps> = ({ streamNum, hasMultipleStreams }) => { | ||
const { formatMessage } = useIntl(); | ||
const [field, , helpers] = useField<BuilderStream[]>("streams"); | ||
const [selectedTab, setSelectedTab] = useState<"configuration" | "schema">("configuration"); | ||
const { openConfirmationModal, closeConfirmationModal } = useConfirmationModalService(); | ||
const { setSelectedView, setTestStreamIndex } = useConnectorBuilderState(); | ||
|
||
|
@@ -49,6 +55,9 @@ export const StreamConfigView: React.FC<StreamConfigViewProps> = ({ streamNum, h | |
}); | ||
}; | ||
|
||
const [, meta] = useField<string | undefined>(streamFieldPath("schema")); | ||
const hasSchemaErrors = Boolean(meta.error); | ||
|
||
return ( | ||
<BuilderConfigView | ||
heading={formatMessage({ id: "connectorBuilder.stream" })} | ||
|
@@ -57,6 +66,17 @@ export const StreamConfigView: React.FC<StreamConfigViewProps> = ({ streamNum, h | |
{/* Not using intl for the labels and tooltips in this component in order to keep maintainence simple */} | ||
<BuilderTitle path={streamFieldPath("name")} label="Stream Name" size="md" /> | ||
<div className={styles.controls}> | ||
<StreamTab | ||
label={formatMessage({ id: "connectorBuilder.streamConfiguration" })} | ||
selected={selectedTab === "configuration"} | ||
onSelect={() => setSelectedTab("configuration")} | ||
/> | ||
<StreamTab | ||
label={formatMessage({ id: "connectorBuilder.streamSchema" })} | ||
selected={selectedTab === "schema"} | ||
onSelect={() => setSelectedTab("schema")} | ||
showErrorIndicator={hasSchemaErrors} | ||
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. nit: should we also show this error indicator on the configuration tab if there are any errors in there? Maybe not necessary since we already show it on the sidebar |
||
/> | ||
<AddStreamButton | ||
onAddStream={(addedStreamNum) => { | ||
setSelectedView(addedStreamNum); | ||
|
@@ -73,53 +93,96 @@ export const StreamConfigView: React.FC<StreamConfigViewProps> = ({ streamNum, h | |
<FontAwesomeIcon icon={faTrashCan} /> | ||
</button> | ||
</div> | ||
<BuilderCard> | ||
<BuilderField | ||
type="string" | ||
path={streamFieldPath("urlPath")} | ||
label="Path URL" | ||
tooltip="Path of the endpoint that this stream represents." | ||
/> | ||
<BuilderField | ||
type="enum" | ||
path={streamFieldPath("httpMethod")} | ||
options={["GET", "POST"]} | ||
label="HTTP Method" | ||
tooltip="HTTP method to use for requests sent to the API" | ||
/> | ||
<BuilderField | ||
type="array" | ||
path={streamFieldPath("fieldPointer")} | ||
label="Record selector" | ||
tooltip="Pointer into the response that should be extracted as the final record" | ||
/> | ||
<BuilderField | ||
type="array" | ||
path={streamFieldPath("primaryKey")} | ||
label="Primary key" | ||
tooltip="Pointer into the response that should be used as the primary key when deduplicating records in the destination" | ||
optional | ||
/> | ||
</BuilderCard> | ||
<PaginationSection streamFieldPath={streamFieldPath} currentStreamIndex={streamNum} /> | ||
<StreamSlicerSection streamFieldPath={streamFieldPath} currentStreamIndex={streamNum} /> | ||
<BuilderCard> | ||
<KeyValueListField | ||
path={streamFieldPath("requestOptions.requestParameters")} | ||
label="Request Parameters" | ||
tooltip="Parameters to attach to API requests" | ||
/> | ||
<KeyValueListField | ||
path={streamFieldPath("requestOptions.requestHeaders")} | ||
label="Request Headers" | ||
tooltip="Headers to attach to API requests" | ||
/> | ||
<KeyValueListField | ||
path={streamFieldPath("requestOptions.requestBody")} | ||
label="Request Body" | ||
tooltip="Body to attach to API requests as url-encoded form values" | ||
/> | ||
</BuilderCard> | ||
{selectedTab === "configuration" ? ( | ||
<> | ||
<BuilderCard> | ||
<BuilderField | ||
type="string" | ||
path={streamFieldPath("urlPath")} | ||
label="Path URL" | ||
tooltip="Path of the endpoint that this stream represents." | ||
/> | ||
<BuilderField | ||
type="enum" | ||
path={streamFieldPath("httpMethod")} | ||
options={["GET", "POST"]} | ||
label="HTTP Method" | ||
tooltip="HTTP method to use for requests sent to the API" | ||
/> | ||
<BuilderField | ||
type="array" | ||
path={streamFieldPath("fieldPointer")} | ||
label="Record selector" | ||
tooltip="Pointer into the response that should be extracted as the final record" | ||
/> | ||
<BuilderField | ||
type="array" | ||
path={streamFieldPath("primaryKey")} | ||
label="Primary key" | ||
tooltip="Pointer into the response that should be used as the primary key when deduplicating records in the destination" | ||
optional | ||
/> | ||
</BuilderCard> | ||
<PaginationSection streamFieldPath={streamFieldPath} currentStreamIndex={streamNum} /> | ||
<StreamSlicerSection streamFieldPath={streamFieldPath} currentStreamIndex={streamNum} /> | ||
<BuilderCard> | ||
<KeyValueListField | ||
path={streamFieldPath("requestOptions.requestParameters")} | ||
label="Request Parameters" | ||
tooltip="Parameters to attach to API requests" | ||
/> | ||
<KeyValueListField | ||
path={streamFieldPath("requestOptions.requestHeaders")} | ||
label="Request Headers" | ||
tooltip="Headers to attach to API requests" | ||
/> | ||
<KeyValueListField | ||
path={streamFieldPath("requestOptions.requestBody")} | ||
label="Request Body" | ||
tooltip="Body to attach to API requests as url-encoded form values" | ||
/> | ||
</BuilderCard> | ||
</> | ||
) : ( | ||
<BuilderCard className={styles.schemaEditor}> | ||
<SchemaEditor streamFieldPath={streamFieldPath} /> | ||
</BuilderCard> | ||
)} | ||
</BuilderConfigView> | ||
); | ||
}; | ||
|
||
const StreamTab = ({ | ||
selected, | ||
label, | ||
onSelect, | ||
showErrorIndicator, | ||
}: { | ||
selected: boolean; | ||
label: string; | ||
onSelect: () => void; | ||
showErrorIndicator?: boolean; | ||
}) => ( | ||
<button type="button" className={classNames(styles.tab, { [styles.selectedTab]: selected })} onClick={onSelect}> | ||
{label} | ||
{showErrorIndicator && <Indicator />} | ||
</button> | ||
); | ||
|
||
const SchemaEditor = ({ streamFieldPath }: { streamFieldPath: (fieldPath: string) => string }) => { | ||
const [field, meta, helpers] = useField<string | undefined>(streamFieldPath("schema")); | ||
|
||
return ( | ||
<> | ||
<CodeEditor | ||
value={field.value || ""} | ||
language="json" | ||
theme="airbyte-light" | ||
onChange={(val: string | undefined) => { | ||
helpers.setValue(val); | ||
}} | ||
/> | ||
<Text className={styles.errorMessage}>{meta.error && <FormattedMessage id={meta.error} />}</Text> | ||
</> | ||
); | ||
}; |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Doesn't need to be done in this PR, but it would be nice if clicking the Test or Download Config buttons would cause the schema view to be focused if it has any errors. Currently it auto-focuses the Stream view, but it doesn't open the Schema tab automatically
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.
Restructured this a bit and I think I found an acceptable way to handle this and the comment about showing an error indicator for the configuration tab. It's always selecting the view that has errors if there is one by default.