-
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.
chore(data-warehouse): postgres integration (#19797)
* basics * add db schema endpoint * frontend progress * form working * working * schema selection * refactor frontend * add team * format api.ts * typing * add internal network filter * typing * fix codescan * typing * fix test * add schemas * update feature flag from hubspot to postgres * remove sslmode * cleanup * fix test * fix test * add logo
- Loading branch information
Showing
26 changed files
with
1,263 additions
and
294 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
File renamed without changes.
45 changes: 45 additions & 0 deletions
45
frontend/src/scenes/data-warehouse/external/forms/PostgresSchemaForm.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,45 @@ | ||
import { LemonSwitch, LemonTable } from '@posthog/lemon-ui' | ||
import { useActions, useMountedLogic, useValues } from 'kea' | ||
|
||
import { sourceModalLogic } from '../sourceModalLogic' | ||
import { sourceFormLogic } from './sourceFormLogic' | ||
|
||
export default function PostgresSchemaForm(): JSX.Element { | ||
useMountedLogic(sourceFormLogic({ sourceType: 'Postgres' })) | ||
const { selectSchema } = useActions(sourceModalLogic) | ||
const { databaseSchema } = useValues(sourceModalLogic) | ||
|
||
return ( | ||
<div className="flex flex-col gap-2"> | ||
<div> | ||
<LemonTable | ||
emptyState="No schemas found" | ||
dataSource={databaseSchema} | ||
columns={[ | ||
{ | ||
title: 'Table', | ||
key: 'table', | ||
render: function RenderTable(_, schema) { | ||
return schema.table | ||
}, | ||
}, | ||
{ | ||
title: 'Sync', | ||
key: 'should_sync', | ||
render: function RenderShouldSync(_, schema) { | ||
return ( | ||
<LemonSwitch | ||
checked={schema.should_sync} | ||
onChange={() => { | ||
selectSchema(schema) | ||
}} | ||
/> | ||
) | ||
}, | ||
}, | ||
]} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} |
33 changes: 33 additions & 0 deletions
33
frontend/src/scenes/data-warehouse/external/forms/SourceForm.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,33 @@ | ||
import { LemonInput } from '@posthog/lemon-ui' | ||
import { Form } from 'kea-forms' | ||
import { Field } from 'lib/forms/Field' | ||
|
||
import { ExternalDataSourceType } from '~/types' | ||
|
||
import { SOURCE_DETAILS } from '../sourceModalLogic' | ||
import { sourceFormLogic } from './sourceFormLogic' | ||
|
||
interface SourceFormProps { | ||
sourceType: ExternalDataSourceType | ||
} | ||
|
||
export default function SourceForm({ sourceType }: SourceFormProps): JSX.Element { | ||
return ( | ||
<Form | ||
logic={sourceFormLogic} | ||
props={{ sourceType }} | ||
formKey={sourceType == 'Postgres' ? 'databaseSchemaForm' : 'externalDataSource'} | ||
className="space-y-4" | ||
enableFormOnSubmit | ||
> | ||
{SOURCE_DETAILS[sourceType].fields.map((field) => ( | ||
<Field key={field.name} name={['payload', field.name]} label={field.label}> | ||
<LemonInput className="ph-ignore-input" data-attr={field.name} /> | ||
</Field> | ||
))} | ||
<Field name="prefix" label="Table Prefix (optional)"> | ||
<LemonInput className="ph-ignore-input" data-attr="prefix" placeholder="internal_" /> | ||
</Field> | ||
</Form> | ||
) | ||
} |
Oops, something went wrong.