-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎨 🏁 Move editing connection name to Settings page (#6145)
Co-authored-by: josephkmh <joseph@airbyte.io>
- Loading branch information
1 parent
bd0676c
commit ac44a39
Showing
8 changed files
with
131 additions
and
42 deletions.
There are no files selected for viewing
5 changes: 0 additions & 5 deletions
5
airbyte-webapp/src/components/common/DeleteBlock/DeleteBlock.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 |
---|---|---|
@@ -1,17 +1,12 @@ | ||
@use "scss/variables"; | ||
@use "scss/colors"; | ||
|
||
.deleteBlock { | ||
margin-top: variables.$spacing-md; | ||
padding: variables.$spacing-xl; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
|
||
.text { | ||
font-size: 11px; | ||
line-height: 13px; | ||
color: colors.$grey-300; | ||
white-space: pre-line; | ||
} |
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
68 changes: 68 additions & 0 deletions
68
airbyte-webapp/src/components/connection/UpdateConnectionName/UpdateConnectionName.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,68 @@ | ||
import React from "react"; | ||
import { useIntl } from "react-intl"; | ||
import * as yup from "yup"; | ||
|
||
import { Form, FormControl } from "components/forms"; | ||
import { FormSubmissionButtons } from "components/forms/FormSubmissionButtons"; | ||
import { Card } from "components/ui/Card"; | ||
|
||
import { useAppMonitoringService } from "hooks/services/AppMonitoringService"; | ||
import { useConnectionEditService } from "hooks/services/ConnectionEdit/ConnectionEditService"; | ||
import { useNotificationService } from "hooks/services/Notification"; | ||
|
||
const connectionNameFormSchema = yup.object({ | ||
connectionName: yup.string().required("form.empty.error"), | ||
}); | ||
|
||
interface ConnectionNameFormValues { | ||
connectionName: string; | ||
} | ||
|
||
export const UpdateConnectionName: React.FC = () => { | ||
const { connection, updateConnection } = useConnectionEditService(); | ||
const { registerNotification } = useNotificationService(); | ||
const { trackError } = useAppMonitoringService(); | ||
const { formatMessage } = useIntl(); | ||
|
||
const onSuccess = () => { | ||
registerNotification({ | ||
id: "connection_name_change_success", | ||
text: formatMessage({ id: "form.changesSaved" }), | ||
type: "success", | ||
}); | ||
}; | ||
|
||
const onError = (e: Error, { connectionName }: ConnectionNameFormValues) => { | ||
trackError(e, { connectionName }); | ||
registerNotification({ | ||
id: "connection_name_change_error", | ||
text: formatMessage({ id: "connection.updateFailed" }), | ||
type: "error", | ||
}); | ||
}; | ||
|
||
return ( | ||
<Card withPadding> | ||
<Form<ConnectionNameFormValues> | ||
trackDirtyChanges | ||
onSubmit={({ connectionName }) => | ||
updateConnection({ | ||
name: connectionName, | ||
connectionId: connection.connectionId, | ||
}) | ||
} | ||
onError={onError} | ||
onSuccess={onSuccess} | ||
schema={connectionNameFormSchema} | ||
defaultValues={{ connectionName: connection.name }} | ||
> | ||
<FormControl<ConnectionNameFormValues> | ||
label={formatMessage({ id: "form.connectionName" })} | ||
fieldType="input" | ||
name="connectionName" | ||
/> | ||
<FormSubmissionButtons submitKey="settings.accountSettings.updateName" /> | ||
</Form> | ||
</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
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
4 changes: 0 additions & 4 deletions
4
...webapp/src/pages/connections/ConnectionSettingsPage/SchemaUpdateNotifications.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 |
---|---|---|
@@ -1,8 +1,4 @@ | ||
@use "scss/variables"; | ||
@use "scss/colors"; | ||
|
||
.container { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: variables.$spacing-md; | ||
} |