-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎉 [Connector Builder] Add request options component (#20497)
* style view titles * save progress on adding stream delete functionality * fix delete behavior * remove remaining console logs * consolidate shared styles into BuilderConfigView component * add key value list field for request options * fix styles * add hover color for remove button * fix size of remove button * update tooltip to be more accurate * remove console logs * adjust colors of key value component
- Loading branch information
Showing
13 changed files
with
172 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
|
||
.jobStartFailure { | ||
padding: variables.$spacing-lg; | ||
} | ||
} |
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
9 changes: 7 additions & 2 deletions
9
airbyte-webapp/src/components/connectorBuilder/Builder/BuilderCard.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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
|
||
import { Card } from "components/ui/Card"; | ||
|
||
import styles from "./BuilderCard.module.scss"; | ||
|
||
export const BuilderCard: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => { | ||
return <Card className={styles.card}>{children}</Card>; | ||
interface BuilderCardProps { | ||
className?: string; | ||
} | ||
|
||
export const BuilderCard: React.FC<React.PropsWithChildren<BuilderCardProps>> = ({ children, className }) => { | ||
return <Card className={classNames(className, styles.card)}>{children}</Card>; | ||
}; |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
} | ||
|
||
.label { | ||
color: colors.$grey; | ||
color: colors.$grey-400; | ||
} | ||
|
||
.inputContainer { | ||
|
5 changes: 5 additions & 0 deletions
5
airbyte-webapp/src/components/connectorBuilder/Builder/GlobalConfigView.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,5 @@ | ||
@use "scss/variables"; | ||
|
||
.content { | ||
margin-top: variables.$spacing-lg; | ||
} |
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
39 changes: 39 additions & 0 deletions
39
airbyte-webapp/src/components/connectorBuilder/Builder/KeyValueListField.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,39 @@ | ||
@use "scss/variables"; | ||
@use "scss/colors"; | ||
|
||
$removeButtonWidth: 20px; | ||
|
||
.inputContainer { | ||
width: 100%; | ||
display: flex; | ||
gap: variables.$spacing-xl; | ||
align-items: center; | ||
} | ||
|
||
.labeledInput { | ||
flex: 1; | ||
max-width: 400px; | ||
display: flex; | ||
gap: variables.$spacing-sm; | ||
align-items: center; | ||
} | ||
|
||
.kvLabel { | ||
color: colors.$grey-400; | ||
} | ||
|
||
.removeButton { | ||
border: none; | ||
background-color: transparent; | ||
color: colors.$grey; | ||
cursor: pointer; | ||
padding: 0; | ||
width: $removeButtonWidth; | ||
height: $removeButtonWidth; | ||
font-size: 18px; | ||
transition: variables.$transition; | ||
|
||
&:hover { | ||
color: colors.$red; | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
airbyte-webapp/src/components/connectorBuilder/Builder/KeyValueListField.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,74 @@ | ||
import { faXmark } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { useField } from "formik"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import GroupControls from "components/GroupControls"; | ||
import { ControlLabels } from "components/LabeledControl"; | ||
import { Button } from "components/ui/Button"; | ||
import { Input } from "components/ui/Input"; | ||
import { Text } from "components/ui/Text"; | ||
|
||
import styles from "./KeyValueListField.module.scss"; | ||
|
||
interface KeyValueInputProps { | ||
keyValue: [string, string]; | ||
onChange: (keyValue: [string, string]) => void; | ||
onRemove: () => void; | ||
} | ||
|
||
const KeyValueInput: React.FC<KeyValueInputProps> = ({ keyValue, onChange, onRemove }) => { | ||
return ( | ||
<div className={styles.inputContainer}> | ||
<div className={styles.labeledInput}> | ||
<Text className={styles.kvLabel}> | ||
<FormattedMessage id="connectorBuilder.key" /> | ||
</Text> | ||
<Input value={keyValue[0]} onChange={(e) => onChange([e.target.value, keyValue[1]])} /> | ||
</div> | ||
<div className={styles.labeledInput}> | ||
<Text className={styles.kvLabel}> | ||
<FormattedMessage id="connectorBuilder.value" /> | ||
</Text> | ||
<Input value={keyValue[1]} onChange={(e) => onChange([keyValue[0], e.target.value])} /> | ||
</div> | ||
<button type="button" className={styles.removeButton} onClick={onRemove}> | ||
<FontAwesomeIcon icon={faXmark} size="1x" /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
interface KeyValueListFieldProps { | ||
path: string; | ||
label: string; | ||
tooltip: string; | ||
} | ||
|
||
export const KeyValueListField: React.FC<KeyValueListFieldProps> = ({ path, label, tooltip }) => { | ||
const [{ value: keyValueList }, , { setValue: setKeyValueList }] = useField<Array<[string, string]>>(path); | ||
|
||
return ( | ||
<GroupControls label={<ControlLabels label={label} infoTooltipContent={tooltip} />}> | ||
{keyValueList.map((keyValue, keyValueIndex) => ( | ||
<KeyValueInput | ||
key={keyValueIndex} | ||
keyValue={keyValue} | ||
onChange={(newKeyValue) => { | ||
const updatedList = keyValueList.map((entry, index) => (index === keyValueIndex ? newKeyValue : entry)); | ||
setKeyValueList(updatedList); | ||
}} | ||
onRemove={() => { | ||
const updatedList = keyValueList.filter((_, index) => index !== keyValueIndex); | ||
setKeyValueList(updatedList); | ||
}} | ||
/> | ||
))} | ||
<div> | ||
<Button variant="secondary" onClick={() => setKeyValueList([...keyValueList, ["", ""]])}> | ||
<FormattedMessage id="connectorBuilder.addKeyValue" /> | ||
</Button> | ||
</div> | ||
</GroupControls> | ||
); | ||
}; |
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