-
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.
🪟 🎉 Multi-cloud: edit connection & workspace data geographies in the …
…UI (#18611) * add geographies service and basic dropdown * add feature for changing data geography * add default data residency to workspace settings * add data residency card to connection creation * add data residency editing to connection settings tab
- Loading branch information
Showing
36 changed files
with
486 additions
and
42 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
20 changes: 20 additions & 0 deletions
20
airbyte-webapp/src/components/CreateConnection/DataResidency.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,20 @@ | ||
@use "scss/variables"; | ||
|
||
.flexRow { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: flex-start; | ||
align-items: flex-start; | ||
gap: variables.$spacing-md; | ||
} | ||
|
||
.leftFieldCol { | ||
flex: 1; | ||
max-width: 640px; | ||
padding-right: 30px; | ||
} | ||
|
||
.rightFieldCol { | ||
flex: 1; | ||
max-width: 300px; | ||
} |
64 changes: 64 additions & 0 deletions
64
airbyte-webapp/src/components/CreateConnection/DataResidency.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,64 @@ | ||
import { Field, FieldProps, useFormikContext } from "formik"; | ||
import { FormattedMessage, useIntl } from "react-intl"; | ||
|
||
import { ControlLabels } from "components/LabeledControl"; | ||
import { DropDown } from "components/ui/DropDown"; | ||
|
||
import { useAvailableGeographies } from "packages/cloud/services/geographies/GeographiesService"; | ||
import { links } from "utils/links"; | ||
import { Section } from "views/Connection/ConnectionForm/components/Section"; | ||
|
||
import styles from "./DataResidency.module.scss"; | ||
|
||
interface DataResidencyProps { | ||
name?: string; | ||
} | ||
|
||
export const DataResidency: React.FC<DataResidencyProps> = ({ name = "geography" }) => { | ||
const { formatMessage } = useIntl(); | ||
const { setFieldValue } = useFormikContext(); | ||
const { geographies } = useAvailableGeographies(); | ||
|
||
return ( | ||
<Section title={formatMessage({ id: "connection.geographyTitle" })}> | ||
<Field name={name}> | ||
{({ field, form }: FieldProps<string>) => ( | ||
<div className={styles.flexRow}> | ||
<div className={styles.leftFieldCol}> | ||
<ControlLabels | ||
nextLine | ||
label={<FormattedMessage id="connection.geographyTitle" />} | ||
message={ | ||
<FormattedMessage | ||
id="connection.geographyDescription" | ||
values={{ | ||
lnk: (node: React.ReactNode) => ( | ||
<a href={links.cloudAllowlistIPsLink} target="_blank" rel="noreferrer"> | ||
{node} | ||
</a> | ||
), | ||
}} | ||
/> | ||
} | ||
/> | ||
</div> | ||
<div className={styles.rightFieldCol}> | ||
<DropDown | ||
isDisabled={form.isSubmitting} | ||
options={geographies.map((geography) => ({ | ||
label: formatMessage({ | ||
id: `connection.geography.${geography}`, | ||
defaultMessage: geography.toUpperCase(), | ||
}), | ||
value: geography, | ||
}))} | ||
value={field.value} | ||
onChange={(geography) => setFieldValue(name, geography.value)} | ||
/> | ||
</div> | ||
</div> | ||
)} | ||
</Field> | ||
</Section> | ||
); | ||
}; |
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
21 changes: 21 additions & 0 deletions
21
...onents/connection/UpdateConnectionDataResidency/UpdateConnectionDataResidency.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,21 @@ | ||
.wrapper { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
.dropdownWrapper { | ||
display: flex; | ||
flex: 1 0 310px; | ||
} | ||
|
||
.spinner { | ||
width: 50px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.dropdown { | ||
flex-grow: 1; | ||
} |
83 changes: 83 additions & 0 deletions
83
...src/components/connection/UpdateConnectionDataResidency/UpdateConnectionDataResidency.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,83 @@ | ||
import React, { useState } from "react"; | ||
import { FormattedMessage, useIntl } from "react-intl"; | ||
|
||
import { ControlLabels } from "components/LabeledControl"; | ||
import { Card } from "components/ui/Card"; | ||
import { DropDown } from "components/ui/DropDown"; | ||
import { Spinner } from "components/ui/Spinner"; | ||
|
||
import { Geography } from "core/request/AirbyteClient"; | ||
import { useConnectionEditService } from "hooks/services/ConnectionEdit/ConnectionEditService"; | ||
import { useNotificationService } from "hooks/services/Notification"; | ||
import { useAvailableGeographies } from "packages/cloud/services/geographies/GeographiesService"; | ||
import { links } from "utils/links"; | ||
|
||
import styles from "./UpdateConnectionDataResidency.module.scss"; | ||
|
||
export const UpdateConnectionDataResidency: React.FC = () => { | ||
const { connection, updateConnection, connectionUpdating } = useConnectionEditService(); | ||
const { registerNotification } = useNotificationService(); | ||
const { formatMessage } = useIntl(); | ||
const [selectedValue, setSelectedValue] = useState<Geography>(); | ||
|
||
const { geographies } = useAvailableGeographies(); | ||
|
||
const handleSubmit = async ({ value }: { value: Geography }) => { | ||
try { | ||
setSelectedValue(value); | ||
await updateConnection({ | ||
connectionId: connection.connectionId, | ||
geography: value, | ||
}); | ||
} catch (e) { | ||
registerNotification({ | ||
id: "connection.geographyUpdateError", | ||
title: formatMessage({ id: "connection.geographyUpdateError" }), | ||
isError: true, | ||
}); | ||
} | ||
setSelectedValue(undefined); | ||
}; | ||
|
||
return ( | ||
<Card withPadding> | ||
<div className={styles.wrapper}> | ||
<div> | ||
<ControlLabels | ||
nextLine | ||
label={<FormattedMessage id="connection.geographyTitle" />} | ||
message={ | ||
<FormattedMessage | ||
id="connection.geographyDescription" | ||
values={{ | ||
lnk: (node: React.ReactNode) => ( | ||
<a href={links.cloudAllowlistIPsLink} target="_blank" rel="noreferrer"> | ||
{node} | ||
</a> | ||
), | ||
}} | ||
/> | ||
} | ||
/> | ||
</div> | ||
<div className={styles.dropdownWrapper}> | ||
<div className={styles.spinner}>{connectionUpdating && <Spinner small />}</div> | ||
<div className={styles.dropdown}> | ||
<DropDown | ||
isDisabled={connectionUpdating} | ||
options={geographies.map((geography) => ({ | ||
label: formatMessage({ | ||
id: `connection.geography.${geography}`, | ||
defaultMessage: geography.toUpperCase(), | ||
}), | ||
value: geography, | ||
}))} | ||
value={selectedValue || connection.geography} | ||
onChange={handleSubmit} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</Card> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
airbyte-webapp/src/components/connection/UpdateConnectionDataResidency/index.ts
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 @@ | ||
export { UpdateConnectionDataResidency } from "./UpdateConnectionDataResidency"; |
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
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.