-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Connector Builder] Config UI error handling (#20280)
* move connector builder components into the same shared components/connectorBuilder directory * move diff over from poc branch * save current progress * add modal for adding streams * focus stream after adding and reset button style * add reset confirm modal and select view on add * style global config and streams buttons * styling improvements * handle long stream names better * pull in connector manifest schema directly * add box shadows to resizable panels * upgrade orval and use connector manifest schema directly * remove airbyte protocol from connector builder api spec * generate python models from openapi change * fix position of yaml toggle * handle no stream case with better looking message * group global fields into single object and fix console error * confirmation modal on toggling dirty form + cleanup * fix connector name display * undo change to manifest schema * remove commented code * remove unnecessary change * fix spacing * use shadow mixin for connector img * add comment about connector img * save progress * change onSubmit to no-op * remove console log * clean up styling * simplify sidebar to remove StreamSelectButton component * swap colors of toggle * move FormikPatch to src/core/form * move types up to connectorBuilder/ level * use grid display for ui yaml toggle button * use spread instead of setting array index directly * add intl in missing places * pull connector manifest schema in through separate openapi spec * disable test and download buttons when there are errors and touch erroring fields * fix comment * add error indicators to view buttons * remove commented code * use correct intl string id * throttle setting json manifest in yaml editor * use button prop instead of manually styling * consolidate AddStreamButton styles * fix sidebar flex styles * use specific flex properties instead of flex * clean up download and reset button styles * use row-reverse for yaml editor download button * fix stream selector styles to remove margins * give connector setup guide panel same corner and shadow styles * remove blur from page display * set view to stream when selected in test panel * add placeholder when stream name is empty * switch to index-based stream selection to preserve testing panel selected stream on rename * handle empty name in stream selector * remove unnecessary margin * only show error indicator for touched fields * focus erroring view on test click * show warning icon and tooltip when there are form errors * remove unused parameter
- Loading branch information
Showing
15 changed files
with
280 additions
and
87 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
3 changes: 3 additions & 0 deletions
3
airbyte-webapp/src/components/connectorBuilder/DownloadYamlButton.module.scss
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,3 @@ | ||
.tooltipContainer { | ||
display: block; | ||
} |
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
14 changes: 14 additions & 0 deletions
14
...te-webapp/src/components/connectorBuilder/StreamTestingPanel/StreamTestButton.module.scss
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,14 @@ | ||
@use "scss/variables"; | ||
@use "scss/colors"; | ||
|
||
.testButton { | ||
width: 100%; | ||
} | ||
|
||
.testButtonTooltipContainer { | ||
width: 100%; | ||
} | ||
|
||
.testButtonText { | ||
color: colors.$white; | ||
} |
76 changes: 76 additions & 0 deletions
76
airbyte-webapp/src/components/connectorBuilder/StreamTestingPanel/StreamTestButton.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,76 @@ | ||
import { faWarning } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { RotateIcon } from "components/icons/RotateIcon"; | ||
import { Button } from "components/ui/Button"; | ||
import { Text } from "components/ui/Text"; | ||
import { Tooltip } from "components/ui/Tooltip"; | ||
|
||
import { useConnectorBuilderState } from "services/connectorBuilder/ConnectorBuilderStateService"; | ||
|
||
import { useBuilderErrors } from "../useBuilderErrors"; | ||
import styles from "./StreamTestButton.module.scss"; | ||
|
||
interface StreamTestButtonProps { | ||
readStream: () => void; | ||
} | ||
|
||
export const StreamTestButton: React.FC<StreamTestButtonProps> = ({ readStream }) => { | ||
const { editorView, yamlIsValid, testStreamIndex } = useConnectorBuilderState(); | ||
const { hasErrors, validateAndTouch } = useBuilderErrors(); | ||
|
||
const handleClick = () => { | ||
if (editorView === "yaml") { | ||
readStream(); | ||
return; | ||
} | ||
|
||
validateAndTouch(readStream, ["global", testStreamIndex]); | ||
}; | ||
|
||
let buttonDisabled = false; | ||
let showWarningIcon = false; | ||
let tooltipContent = undefined; | ||
|
||
if (editorView === "yaml" && !yamlIsValid) { | ||
buttonDisabled = true; | ||
showWarningIcon = true; | ||
tooltipContent = <FormattedMessage id="connectorBuilder.invalidYamlTest" />; | ||
} | ||
|
||
if (editorView === "ui" && hasErrors(true, ["global", testStreamIndex])) { | ||
showWarningIcon = true; | ||
tooltipContent = <FormattedMessage id="connectorBuilder.configErrorsTest" />; | ||
} | ||
|
||
const testButton = ( | ||
<Button | ||
className={styles.testButton} | ||
size="sm" | ||
onClick={handleClick} | ||
disabled={buttonDisabled} | ||
icon={ | ||
showWarningIcon ? ( | ||
<FontAwesomeIcon icon={faWarning} /> | ||
) : ( | ||
<div> | ||
<RotateIcon width={styles.testIconHeight} height={styles.testIconHeight} /> | ||
</div> | ||
) | ||
} | ||
> | ||
<Text className={styles.testButtonText} size="sm" bold> | ||
<FormattedMessage id="connectorBuilder.testButton" /> | ||
</Text> | ||
</Button> | ||
); | ||
|
||
return tooltipContent !== undefined ? ( | ||
<Tooltip control={testButton} containerClassName={styles.testButtonTooltipContainer}> | ||
{tooltipContent} | ||
</Tooltip> | ||
) : ( | ||
testButton | ||
); | ||
}; |
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
Oops, something went wrong.