-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data-warehouse): edit SQL based import configs (#25685)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a585c33
commit dbfefae
Showing
9 changed files
with
171 additions
and
52 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
58 changes: 58 additions & 0 deletions
58
frontend/src/scenes/data-warehouse/settings/source/SourceConfiguration.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,58 @@ | ||
import { LemonBanner, LemonButton, LemonSkeleton } from '@posthog/lemon-ui' | ||
import { BindLogic, useValues } from 'kea' | ||
import { Form } from 'kea-forms' | ||
import { SourceFormComponent, SourceFormProps } from 'scenes/data-warehouse/external/forms/SourceForm' | ||
|
||
import { dataWarehouseSourceSettingsLogic } from './dataWarehouseSourceSettingsLogic' | ||
|
||
interface SourceConfigurationProps { | ||
id: string | ||
} | ||
|
||
export const SourceConfiguration = ({ id }: SourceConfigurationProps): JSX.Element => { | ||
const { sourceFieldConfig } = useValues(dataWarehouseSourceSettingsLogic({ id })) | ||
return ( | ||
<BindLogic logic={dataWarehouseSourceSettingsLogic} props={{ id }}> | ||
{sourceFieldConfig ? ( | ||
<UpdateSourceConnectionFormContainer id={id} sourceConfig={sourceFieldConfig} showPrefix={false} /> | ||
) : ( | ||
<LemonSkeleton /> | ||
)} | ||
</BindLogic> | ||
) | ||
} | ||
|
||
interface UpdateSourceConnectionFormContainerProps extends SourceFormProps { | ||
id: string | ||
} | ||
|
||
function UpdateSourceConnectionFormContainer(props: UpdateSourceConnectionFormContainerProps): JSX.Element { | ||
const { source, sourceLoading } = useValues(dataWarehouseSourceSettingsLogic({ id: props.id })) | ||
|
||
if (source?.source_type !== 'MSSQL' && source?.source_type !== 'MySQL' && source?.source_type !== 'Postgres') { | ||
return ( | ||
<LemonBanner type="warning" className="mt-2"> | ||
<p> | ||
Only Postgres, MSSQL, and MySQL are configurable. Please delete and recreate your source if you need | ||
to connect to a new source of the same type. | ||
</p> | ||
</LemonBanner> | ||
) | ||
} | ||
return ( | ||
<Form logic={dataWarehouseSourceSettingsLogic} formKey="sourceConfig" enableFormOnSubmit> | ||
<SourceFormComponent {...props} jobInputs={source?.job_inputs} /> | ||
<div className="mt-4 flex flex-row justify-end gap-2"> | ||
<LemonButton | ||
loading={sourceLoading && !source} | ||
type="primary" | ||
center | ||
htmlType="submit" | ||
data-attr="source-update" | ||
> | ||
Save | ||
</LemonButton> | ||
</div> | ||
</Form> | ||
) | ||
} |
Oops, something went wrong.