Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(data-warehouse): remove the self-managed table creation ui (#130022)

Tom Owers383679512bab
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index f2169e348ce5..f8309ed96716 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6183,13 +6183,13 @@ snapshots:
marketing-analytics-add-source--new-sources--light:
hash: v1.k794b7964.5fa1307763c5b2c1d15d9da94126801e790cdb76e0d0de4e7afcd9cd27bc4c50.vlfBEVR6C5WxdqBMZe2QoAmr_I-A-oivfeAPBPrwLzc
marketing-analytics-add-source--open-menu--dark:
- hash: v1.k794b7964.c80e329b11c730701325e1a0c13e1f7c8ce85d379876d50555cc41b14918042e.S-CnWDuB2kd13u1hlddPnY-AYtxtGmuqP3uTt8zxDHA
+ hash: v1.k794b7964.d51ec98a614b79accdb49ca8d3cc27c0e5bf41ba6642340ecbf18a9389b0989a.l1VDDtUPoK7-IKhjk-mkyRGrqedbINjNK4n8VP64lBY
marketing-analytics-add-source--open-menu--light:
- hash: v1.k794b7964.75907cb59b9de8006b1b146dc7007d464d76a88850f8adccf78bebed591d654f.MZPeX3U9rUsg81U5tOBFu7-0Mu23XPoWzNO1xM9pChw
+ hash: v1.k794b7964.d2e506d81189ed9a23402466d0a847ca0b1815ce8267e86da415a79aba8e2596.Nzx08xQi8RRBnXSJckpdS2LOmhyZ_6zpWMRp94bKQis
marketing-analytics-add-source--sources-disabled--dark:
- hash: v1.k794b7964.9bee1e501763e66a28f7ea68a9418ed1df0840df387aa0e00fd4d86488060640.GHV-4l1LqVtt2HjkCblPtfr549EdYvLoVnox07jQALo
+ hash: v1.k794b7964.f87bf5e8d4be0ba27ba4c75a32609858a380ed888ba6f152c93952e4eb0a890d.Af9g_9Sz2_nccEGsHh3C7U8xRV7qS6pdbVDNBTdfxnE
marketing-analytics-add-source--sources-disabled--light:
- hash: v1.k794b7964.ba3d73935d7d3587fd88c6e93573b55d3d6ed1a39c2f39720d0bb3c82ab29784.yC2cotyG1XNhqpPSc4SZG1XnGudulQOoJuSZ8MPcKwM
+ hash: v1.k794b7964.a205467d269caecad3762b2a5e3ede203bff5181bc78311941b36f6ed7497bca.fwSMqwSNKC2ZfzTH0lJQBzRS4GgL8n2xjqfr0gudBXA
marketing-analytics-conversion-recordings--empty--dark:
hash: v1.k794b7964.8982a2852c9527ff952b660792885e04c2fd81a3302a2c5c820c30e040182a06.h2Rie6hdM7FmCIHijYzFOkelhYaqzQboMKzRrwcxu8w
marketing-analytics-conversion-recordings--empty--light:
diff --git a/frontend/src/initKea.ts b/frontend/src/initKea.ts
index 2fb0cad85040..b35c8d84fb78 100644
--- a/frontend/src/initKea.ts
+++ b/frontend/src/initKea.ts
@@ -210,7 +210,6 @@ response to user input, such as a malformed CSV, so it is not reported as an exc
Every other failure on these actions still toasts and reports.
*/
const VALIDATION_ERROR_SELF_HANDLED_BY_LOGIC_PATH: Record<string, string> = {
- createTable: 'products.dataWarehouse.selfManagedSourceLogic',
updateTable: 'products.dataWarehouse.selfManagedSourceLogic',
setEnabled: 'scenes.subscriptions.subscriptionSceneLogic', // Toasts the refusal, or offers to take ownership
}
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index 2b88ed62d652..da568691232c 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -5448,9 +5448,6 @@ const api = {
async get(tableId: DataWarehouseTable['id']): Promise<DataWarehouseTable> {
return await new ApiRequest().dataWarehouseTable(tableId).get()
},
- async create(data: Partial<DataWarehouseTable>): Promise<DataWarehouseTable> {
- return await new ApiRequest().dataWarehouseTables().create({ data })
- },
async delete(tableId: DataWarehouseTable['id']): Promise<void> {
await new ApiRequest().dataWarehouseTable(tableId).delete()
},
diff --git a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx
index d68824e04a24..3b9492085a49 100644
--- a/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx
+++ b/frontend/src/scenes/hog-functions/list/hogFunctionTemplateListLogic.tsx
@@ -23,7 +23,7 @@ import {
UserType,
} from '~/types'
-import { cleanSourceId, isManagedSourceId, isSelfManagedSourceId } from 'products/data_warehouse/frontend/utils'
+import { cleanSourceId, isManagedSourceId } from 'products/data_warehouse/frontend/utils'
import type { FeatureFlagsSet } from '../../../lib/logic/featureFlagLogic'
import type { AvailableFeature } from '../../../types'
@@ -368,7 +368,7 @@ export const hogFunctionTemplateListLogic = kea<hogFunctionTemplateListLogicType
// TRICKY: Hacky place but this is where we handle "nonHogFunctionTemplates" to modify the linked url
- if (isManagedSourceId(template.id) || isSelfManagedSourceId(template.id)) {
+ if (isManagedSourceId(template.id)) {
return urls.dataWarehouseSourceNew(cleanSourceId(template.id))
}
diff --git a/products/data_warehouse/frontend/scenes/DataOpsScene/tabs/SourcesTab.tsx b/products/data_warehouse/frontend/scenes/DataOpsScene/tabs/SourcesTab.tsx
index bdf1c193a58d..1626e5740ebe 100644
--- a/products/data_warehouse/frontend/scenes/DataOpsScene/tabs/SourcesTab.tsx
+++ b/products/data_warehouse/frontend/scenes/DataOpsScene/tabs/SourcesTab.tsx
@@ -1,11 +1,16 @@
+import { useValues } from 'kea'
+
import { SceneDivider } from '~/layout/scenes/components/SceneDivider'
import { SceneSection } from '~/layout/scenes/components/SceneSection'
import { DirectConnectSourcesTable } from 'products/data_warehouse/frontend/shared/components/DirectConnectSourcesTable'
import { ManagedSourcesTable } from 'products/data_warehouse/frontend/shared/components/ManagedSourcesTable'
import { SelfManagedSourcesTable } from 'products/data_warehouse/frontend/shared/components/SelfManagedSourcesTable'
+import { sourceManagementLogic } from 'products/data_warehouse/frontend/shared/logics/sourceManagementLogic'
export function SourcesTab(): JSX.Element {
+ const { hasSelfManagedTables } = useValues(sourceManagementLogic)
+
return (
<div className="flex flex-col gap-4">
<SceneSection
@@ -21,13 +26,17 @@ export function SourcesTab(): JSX.Element {
>
<DirectConnectSourcesTable />
</SceneSection>
- <SceneDivider />
- <SceneSection
- title="Self-managed data warehouse sources"
- description="Connect to your own data sources, making them queryable in PostHog"
- >
- <SelfManagedSourcesTable />
- </SceneSection>
+ {hasSelfManagedTables && (
+ <>
+ <SceneDivider />
+ <SceneSection
+ title="Self-managed data warehouse sources"
+ description="Tables that PostHog reads in place from your own bucket"
+ >
+ <SelfManagedSourcesTable />
+ </SceneSection>
+ </>
+ )}
</div>
)
}
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
index a55a84304b18..864fa3684c4b 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
@@ -44,10 +44,8 @@ import { availableSourcesLogic } from './availableSourcesLogic'
import { BillingLimitNotice } from './components/BillingLimitNotice'
import { DestinationStep } from './components/DestinationStep'
import { FileUploadSourceForm } from './components/FileUploadSourceForm'
-import { SelfManagedSourceForm } from './components/SelfManagedSourceForm'
import { WebhookStepFallback } from './components/WebhookStepFallback'
import { FILE_UPLOAD_SOURCE_NAME } from './fileUploadSource'
-import { selfManagedSourceLogic } from './selfManagedSourceLogic'
import { SourceCatalog } from './SourceCatalog'
import { SourceCatalogSkeleton } from './SourceCatalogSkeleton'
import { WIZARD_DESTINATION_STEP, type SourceWizardLogicProps, sourceWizardLogic } from './sourceWizardLogic'
@@ -254,7 +252,6 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
nextButtonText,
selectedConnector,
connectors,
- isSelfManagedSource,
source,
sourceConnectionDetails,
isWebhookFieldInputsSubmitting,
@@ -268,7 +265,6 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
source.access_method
)
const showAccessMethodSelector = currentStep === 2 && supportsDirectQuery(selectedConnector?.name)
- const { tableLoading: manualLinkIsLoading } = useValues(selfManagedSourceLogic)
const mainContainer = useFloatingContainer()
@@ -301,7 +297,7 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
const nextButton = (disabledReason?: string | false): JSX.Element => (
<LemonButton
- loading={isLoading || manualLinkIsLoading || isWebhookFieldInputsSubmitting}
+ loading={isLoading || isWebhookFieldInputsSubmitting}
disabledReason={
disabledReason || (!canGoNext && (nextButtonDisabledReason || 'Finish this step to continue'))
}
@@ -327,16 +323,12 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
Back
</LemonButton>
)}
- {isSelfManagedSource ? (
- nextButton()
- ) : (
- <AccessControlAction
- resourceType={AccessControlResourceType.ExternalDataSource}
- minAccessLevel={AccessControlLevel.Editor}
- >
- {({ disabledReason: accessDisabledReason }) => nextButton(accessDisabledReason ?? undefined)}
- </AccessControlAction>
- )}
+ <AccessControlAction
+ resourceType={AccessControlResourceType.ExternalDataSource}
+ minAccessLevel={AccessControlLevel.Editor}
+ >
+ {({ disabledReason: accessDisabledReason }) => nextButton(accessDisabledReason ?? undefined)}
+ </AccessControlAction>
</div>
)
}, [
@@ -344,14 +336,12 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
canGoBack,
onBack,
isLoading,
- manualLinkIsLoading,
isWebhookFieldInputsSubmitting,
canGoNext,
nextButtonDisabledReason,
nextButtonText,
onSubmit,
props.hideBackButton,
- isSelfManagedSource,
isFileUploadSource,
])
@@ -582,7 +572,11 @@ function DatabaseFirewallHint(): JSX.Element | null {
)
}
-function SecondStep({ sourceWizardLogicProps }: { sourceWizardLogicProps?: SourceWizardLogicProps }): JSX.Element {
+function SecondStep({
+ sourceWizardLogicProps,
+}: {
+ sourceWizardLogicProps?: SourceWizardLogicProps
+}): JSX.Element | null {
const { selectedConnector, source, sourceConnectionDetails, prefixRequired } = useValues(sourceWizardLogic)
const selectedAccessMethod = getEffectiveAccessMethod(
2,
@@ -596,7 +590,11 @@ function SecondStep({ sourceWizardLogicProps }: { sourceWizardLogicProps?: Sourc
return <FileUploadSourceForm />
}
- return selectedConnector ? (
+ if (!selectedConnector) {
+ return null
+ }
+
+ return (
<div className="space-y-4">
{selectedConnector.caption && selectedAccessMethod !== 'direct' && (
<LemonMarkdown className="text-sm">{selectedConnector.caption}</LemonMarkdown>
@@ -636,10 +634,6 @@ function SecondStep({ sourceWizardLogicProps }: { sourceWizardLogicProps?: Sourc
sourceWizardLogicProps={sourceWizardLogicProps}
/>
</div>
- ) : (
- <BindLogic logic={selfManagedSourceLogic} props={{ id: 'new' }}>
- <SelfManagedSourceForm />
- </BindLogic>
)
}
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx
index b5410b0eea0e..2dd00eec93e6 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/SourceCatalog.tsx
@@ -71,11 +71,6 @@ const SourceTile = memo(function SourceTile({
<LemonTag type="completion">Already connected</LemonTag>
</Tooltip>
)}
- {item.selfManaged && (
- <Tooltip title="Self-managed: your files stay in your own bucket and PostHog queries them there. The managed version copies the data into PostHog on a schedule.">
- <LemonTag type="muted">Self-managed</LemonTag>
- </Tooltip>
- )}
<SourceReleaseTag releaseStatus={item.releaseStatus} />
</div>
)}
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/components/SelfManagedSourceForm.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/components/SelfManagedSourceForm.tsx
index 11d7741135ca..bd9962f4cbaa 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/components/SelfManagedSourceForm.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/components/SelfManagedSourceForm.tsx
@@ -7,9 +7,8 @@ import { LemonField } from 'lib/lemon-ui/LemonField'
import { ManualLinkSourceType } from '~/types'
-import { describeStorageProviderMismatch, storageProviderFromUrl } from '../../../shared/storageProvider'
+import { storageProviderFromUrl } from '../../../shared/storageProvider'
import { selfManagedSourceLogic } from '../selfManagedSourceLogic'
-import { sourceWizardLogic } from '../sourceWizardLogic'
const ProviderMappings: Record<
ManualLinkSourceType,
@@ -51,17 +50,15 @@ const ProviderMappings: Record<
}
interface Props {
- onUpdate?: () => void
+ onUpdate: () => void
}
export function SelfManagedSourceForm({ onUpdate }: Props): JSX.Element {
- const { manualLinkingProvider } = useValues(sourceWizardLogic)
const { table } = useValues(selfManagedSourceLogic)
- // A saved table stores no provider: the backend reads it from the URL host, so the edit form does too.
- const provider = (onUpdate ? storageProviderFromUrl(table?.url_pattern) : manualLinkingProvider) ?? 'aws'
+ // A saved table stores no provider: the backend reads it from the URL host, so the form does too.
+ const provider = storageProviderFromUrl(table?.url_pattern) ?? 'aws'
const isCsvFormat = table?.format === 'CSV' || table?.format === 'CSVWithNames'
- const providerMismatch = describeStorageProviderMismatch(table?.url_pattern, provider)
return (
<Form
@@ -109,7 +106,6 @@ export function SelfManagedSourceForm({ onUpdate }: Props): JSX.Element {
<div className="mb-4 text-xs text-secondary">
You can use <strong>*</strong> to select multiple files.
</div>
- {providerMismatch && <div className="mb-4 text-xs text-warning">{providerMismatch}</div>}
<LemonField name="format" label="File format" className="mb-4 w-max">
{({ value = '', onChange }) => (
<LemonSelect
@@ -198,13 +194,11 @@ export function SelfManagedSourceForm({ onUpdate }: Props): JSX.Element {
</div>
)}
</div>
- {!!onUpdate && (
- <div className="flex justify-end">
- <LemonButton type="primary" onClick={onUpdate}>
- Save
- </LemonButton>
- </div>
- )}
+ <div className="flex justify-end">
+ <LemonButton type="primary" onClick={onUpdate}>
+ Save
+ </LemonButton>
+ </div>
</Form>
)
}
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.test.ts
index 748d256ab498..4e455e0ca310 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.test.ts
@@ -93,28 +93,26 @@ describe('selfManagedSourceLogic', () => {
// A rejected CSV is a validation 400. It must toast the server message without filing an exception.
it.each([
- { id: 'new', method: 'post', action: 'createTable', status: 400, reported: false },
- { id: 'some-id', method: 'patch', action: 'updateTable', status: 400, reported: false },
- { id: 'new', method: 'post', action: 'createTable', status: 500, reported: true },
- ] as const)(
- '$action with a $status toasts the server message, reported: $reported',
- async ({ id, method, action, status, reported }) => {
+ { status: 400, reported: false },
+ { status: 500, reported: true },
+ ])(
+ 'updateTable with a $status toasts the server message, reported: $reported',
+ async ({ status, reported }) => {
useMocks({
get: { '/api/projects/:team_id/warehouse_tables/:id/': () => [200, validTable] },
- [method]: {
- '/api/projects/:team_id/warehouse_tables/': () => [status, { detail: 'Check the delimiter.' }],
+ patch: {
'/api/projects/:team_id/warehouse_tables/:id/': () => [
status,
{ detail: 'Check the delimiter.' },
],
},
})
- const logic = selfManagedSourceLogic({ id })
+ const logic = selfManagedSourceLogic({ id: 'some-id' })
logic.mount()
await expectLogic(logic, () => {
- logic.actions[action]({ ...validTable, format: 'CSVWithNames' })
- }).toDispatchActions([`${action}Failure`])
+ logic.actions.updateTable({ ...validTable, format: 'CSVWithNames' })
+ }).toDispatchActions(['updateTableFailure'])
expect(lemonToast.error).toHaveBeenCalledWith(expect.stringContaining('Check the delimiter.'))
expect(posthog.captureException).toHaveBeenCalledTimes(reported ? 1 : 0)
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx
index af977277b75f..f4027cd42116 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/selfManagedSourceLogic.tsx
@@ -17,7 +17,7 @@ import { AnyPropertyFilter, DataWarehouseCredential, DataWarehouseTable } from '
import { sourceSceneLogic } from '../SourceScene/SourceScene'
export interface TableLogicProps {
- /** A UUID or 'new'. */
+ /** The table's UUID. */
id: string
}
@@ -34,8 +34,8 @@ const NEW_WAREHOUSE_TABLE: DataWarehouseTable = {
},
}
-// `credential` is null on tables saved without one (the API only enforces credentials on
-// creation via this form), so it must be guarded — reading through it crashed the page.
+// `credential` is null on tables saved without one, such as uploaded files, so it must be guarded:
+// reading through it crashed the page.
export function selfManagedTableFormErrors({
name,
url_pattern,
@@ -144,21 +144,6 @@ export interface selfManagedSourceLogicActions {
archiveTable: () => {
value: true
}
- createTable: (tablePayload: any) => any
- createTableFailure: (
- error: string,
- errorObject?: any
- ) => {
- error: string
- errorObject?: any
- }
- createTableSuccess: (
- table: DataWarehouseTable,
- payload?: any
- ) => {
- table: DataWarehouseTable
- payload?: any
- }
editingTable: (editing: boolean) => {
editing: boolean
}
@@ -273,15 +258,7 @@ export const selfManagedSourceLogic = kea<selfManagedSourceLogicType>([
loaders(({ props }) => ({
table: {
loadTable: async () => {
- if (props.id && props.id !== 'new') {
- return await api.dataWarehouseTables.get(props.id)
- }
- return { ...NEW_WAREHOUSE_TABLE }
- },
- createTable: async (tablePayload) => {
- return await api.dataWarehouseTables.create({
- ...tablePayload,
- })
+ return await api.dataWarehouseTables.get(props.id)
},
updateTable: async (tablePayload) => {
return await api.dataWarehouseTables.update(props.id, tablePayload)
@@ -289,22 +266,12 @@ export const selfManagedSourceLogic = kea<selfManagedSourceLogicType>([
},
})),
listeners(({ actions, props }) => ({
- // initKea leaves a validation 400 from these loaders to this logic, so toast the server message here.
- createTableFailure: ({ errorObject }) => {
- if (errorObject?.status === 400) {
- lemonToast.error(readableErrorMessage(errorObject) ?? 'Could not create the table.')
- }
- },
+ // initKea leaves a validation 400 from this loader to this logic, so toast the server message here.
updateTableFailure: ({ errorObject }) => {
if (errorObject?.status === 400) {
lemonToast.error(readableErrorMessage(errorObject) ?? 'Could not update the table.')
}
},
- createTableSuccess: async ({ table }) => {
- lemonToast.success(<>Table {table.name} created</>)
- actions.loadDatabase()
- router.actions.replace(urls.sources())
- },
updateTableSuccess: async ({ table }) => {
lemonToast.success(<>Table {table.name} updated</>)
actions.editingTable(false)
@@ -331,16 +298,12 @@ export const selfManagedSourceLogic = kea<selfManagedSourceLogicType>([
},
],
}),
- forms(({ actions, props }) => ({
+ forms(({ actions }) => ({
table: {
defaults: { ...NEW_WAREHOUSE_TABLE } as DataWarehouseTable,
errors: selfManagedTableFormErrors,
submit: async (tablePayload) => {
- if (props.id && props.id !== 'new') {
- actions.updateTable(tablePayload)
- } else {
- actions.createTable(tablePayload)
- }
+ actions.updateTable(tablePayload)
},
},
})),
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
index 11f9e9f279f3..97b90e998d41 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCatalogLogic.ts
@@ -35,7 +35,6 @@ import {
import {
ALL_SOURCES_CATEGORY,
CATEGORY_SEARCH_PARAM,
- SELF_MANAGED_CATEGORY,
SourceCategoryFilter,
isSourceCategoryFilter,
} from './sourceCategories'
@@ -69,7 +68,7 @@ export interface SourceCatalogLogicProps {
}
export interface CatalogItem {
- /** The source kind passed to the new-source URL (e.g. "Stripe", or "aws" for self-managed). */
+ /** The source kind passed to the new-source URL (e.g. "Stripe"). */
name: string
label: string
/** One line under the label, for entries whose name alone doesn't say what they do. */
@@ -83,8 +82,6 @@ export interface CatalogItem {
url: string
disabledReason?: string | null
existingSource?: boolean
- /** Self-managed: the user keeps the data in their own bucket, PostHog only links to it. */
- selfManaged?: boolean
/** The sources most people connect (Stripe, Postgres, the ad platforms, ...). Led with when browsing. */
featured?: boolean
}
@@ -230,16 +227,8 @@ function searchCatalog(catalogFuse: Fuse, term: string): CatalogItem[] {
return [...matchCounts.keys()].sort((a, b) => (matchCounts.get(b) ?? 0) - (matchCounts.get(a) ?? 0))
}
-// `self-managed` filters on the connection model rather than on `item.category`, so every place
-// that narrows the catalog to a category has to ask through here.
function matchesCategory(item: CatalogItem, category: SourceCategoryFilter): boolean {
- if (category === ALL_SOURCES_CATEGORY) {
- return true
- }
- if (category === SELF_MANAGED_CATEGORY) {
- return !!item.selfManaged
- }
- return item.category === category
+ return category === ALL_SOURCES_CATEGORY || item.category === category
}
export const sourceCatalogLogic = kea<sourceCatalogLogicType>([
@@ -415,25 +404,15 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([
)
// Most-populated categories first; fall back to taxonomy order on a tie.
.sort((a, b) => b.count - a.count)
- const selfManagedCount = catalogItems.filter((item) => item.selfManaged).length
return [
{ category: ALL_SOURCES_CATEGORY, label: 'All sources', count: catalogItems.length },
- ...(selfManagedCount
- ? [
- {
- category: SELF_MANAGED_CATEGORY as SourceCategoryFilter,
- label: 'Self-managed',
- count: selfManagedCount,
- },
- ]
- : []),
...present,
]
},
],
// The empty state names the active filter. A real category's value is already its label
- // ("File storage"), but `self-managed` is a slug, so read the label off the sidebar.
+ // ("File storage"), but `all` is a slug, so read the label off the sidebar.
selectedCategoryLabel: [
(s) => [s.categoriesWithCounts, s.selectedCategory],
(categoriesWithCounts: CatalogCategory[], selectedCategory: SourceCategoryFilter): string =>
@@ -552,17 +531,13 @@ export const sourceCatalogLogic = kea<sourceCatalogLogicType>([
lemonToast.success('Thanks! Your source request has been submitted.')
},
})),
- // The sources list links here with the category already chosen, so "New self-managed source"
- // opens on the self-managed tiles rather than on the whole catalog.
+ // A link can open the catalog with a category already chosen.
urlToAction(({ actions, values }) => ({
'*': (_, searchParams) => {
const category = searchParams[CATEGORY_SEARCH_PARAM]
if (!isSourceCategoryFilter(category) || category === values.selectedCategory) {
return
}
- if (category === SELF_MANAGED_CATEGORY) {
- return
- }
actions.setSelectedCategory(category)
},
})),
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCategories.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCategories.ts
index 65104a490f46..471bb86d4790 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCategories.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceCategories.ts
@@ -1,21 +1,15 @@
import { DataWarehouseSourceCategoryApi } from 'products/warehouse_sources/frontend/generated/api.schemas'
-export type SourceCategoryFilter = DataWarehouseSourceCategoryApi | 'all' | 'self-managed'
+export type SourceCategoryFilter = DataWarehouseSourceCategoryApi | 'all'
export const ALL_SOURCES_CATEGORY = 'all'
-// Not a `DataWarehouseSourceCategoryApi` value: self-managed describes who holds the data, not what
-// the source is about, so a connector has both a category and this flag. The sources list already
-// splits on it, and people look for the same split here.
-export const SELF_MANAGED_CATEGORY = 'self-managed'
-
-// pinned: URL search param — the sources list deep-links into the catalog with it.
+// pinned: URL search param — links open the catalog on a category with it.
export const CATEGORY_SEARCH_PARAM = 'category'
export function isSourceCategoryFilter(value: unknown): value is SourceCategoryFilter {
return (
value === ALL_SOURCES_CATEGORY ||
- value === SELF_MANAGED_CATEGORY ||
Object.values(DataWarehouseSourceCategoryApi).includes(value as DataWarehouseSourceCategoryApi)
)
}
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
index 3b9005e03d5b..9145f7133bb0 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
@@ -17,7 +17,6 @@ import { captureMarketingCrossSellSourceCreated, getMarketingCrossSellAttributio
import { Scene } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
-import { VALID_SELF_MANAGED_MARKETING_SOURCES } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utils'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import {
@@ -26,7 +25,6 @@ import {
ExternalDataSourceSyncSchema,
type ExternalDataSourceType,
IncrementalField,
- ManualLinkSourceType,
manualLinkSources,
RowFilter,
} from '~/types'
@@ -47,7 +45,7 @@ import type { AvailableSetupTaskIdsEnumApi } from '../../../../../frontend/src/g
import type { PaginatedResponse } from '../../../../../frontend/src/lib/api'
import type { FeatureFlagsSet } from '../../../../../frontend/src/lib/logic/featureFlagLogic'
import type { ProductIntentProperties } from '../../../../../frontend/src/lib/utils/product-intents'
-import type { DataWarehouseTable, ExternalDataSource, PreflightStatus } from '../../../../../frontend/src/types'
+import type { ExternalDataSource, PreflightStatus } from '../../../../../frontend/src/types'
import {
getDefaultExpandedSchemaKeys,
groupTablesBySchema,
@@ -59,7 +57,6 @@ import { sourceManagementLogic } from '../../shared/logics/sourceManagementLogic
import { clonePayloadPreservingFiles, findUploadedFiles, readJsonFile } from '../../shared/sourceFieldFiles'
import { destinationStepBlockReason, shouldShowDestinationStep } from './components/destinationStepUtils'
import { FILE_UPLOAD_SOURCE_CONFIG, FILE_UPLOAD_SOURCE_NAME } from './fileUploadSource'
-import { selfManagedSourceLogic } from './selfManagedSourceLogic'
import { restoreSourceFormState, saveSourceFormState } from './wizardFormStorage'
export const SSH_FIELD: SourceFieldSwitchGroupConfigApi = {
@@ -484,7 +481,6 @@ export interface SourceWizardLogicProps {
export interface sourceWizardLogicValues {
featureFlags: FeatureFlagsSet // featureFlagLogic
preflight: PreflightStatus | null // preflightLogic
- tableLoading: boolean // selfManagedSourceLogic
dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null // sourceManagementLogic
currentTeamId: number | null // teamLogic
availableSources: any
@@ -519,15 +515,12 @@ export interface sourceWizardLogicValues {
hasWebhookSchemas: boolean
isDirectQueryMode: boolean
isLoading: boolean
- isManualLinkFormVisible: boolean
isManualLinkingSelected: boolean
- isSelfManagedSource: boolean
isSourceConnectionDetailsSubmitting: boolean
isSourceConnectionDetailsValid: boolean
isWebhookFieldInputsSubmitting: boolean
isWebhookFieldInputsValid: boolean
isWrapped: boolean
- manualLinkingProvider: ManualLinkSourceType | null
modalTitle:
| ''
| 'Choose destinations'
@@ -552,7 +545,7 @@ export interface sourceWizardLogicValues {
schemaNameFilter: string
selectedConnector: SourceConfigResponseApi | null
showDestinationStep: boolean
- showFooter: boolean | SourceConfigResponseApi
+ showFooter: boolean
showSkipButton: boolean
showSourceConnectionDetailsErrors: boolean
showWebhookFieldInputsErrors: boolean
@@ -600,16 +593,6 @@ export interface sourceWizardLogicActions {
markTaskAsCompleted: (taskIdOrIds: SetupTaskId | SetupTaskId[]) => {
taskIdOrIds: AvailableSetupTaskIdsEnumApi | AvailableSetupTaskIdsEnumApi[]
} // globalSetupLogic
- createTableSuccess: (
- table: DataWarehouseTable,
- payload?: any
- ) => {
- payload?: any
- table: DataWarehouseTable
- } // selfManagedSourceLogic
- resetTable: (values?: DataWarehouseTable | undefined) => {
- values?: DataWarehouseTable
- } // selfManagedSourceLogic
loadSources: () => {
value: true
} // sourceManagementLogic
@@ -763,9 +746,6 @@ export interface sourceWizardLogicActions {
setIsLoading: (isLoading: boolean) => {
isLoading: boolean
}
- setManualLinkingProvider: (provider: ManualLinkSourceType) => {
- provider: 'aws' | 'azure' | 'cloudflare-r2' | 'google-cloud'
- }
setReturnConfig: (
returnUrl: string,
returnLabel: string,
@@ -901,9 +881,6 @@ export interface sourceWizardLogicActions {
selectAll: boolean
tableNames: string[] | undefined
}
- toggleManualLinkFormVisible: (visible: boolean) => {
- visible: boolean
- }
toggleSchemaGroup: (
schemaName: string,
shouldSync: boolean
@@ -1034,10 +1011,7 @@ export interface sourceWizardLogicMeta {
} | null,
sourceId: string | null
) => string
- showFooter: (
- selectedConnector: SourceConfigResponseApi | null,
- isManualLinkFormVisible: boolean
- ) => boolean | SourceConfigResponseApi
+ showFooter: (selectedConnector: SourceConfigResponseApi | null) => boolean
prefixRequired: (
dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null,
selectedConnector: SourceConfigResponseApi | null
@@ -1046,9 +1020,6 @@ export interface sourceWizardLogicMeta {
dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null,
availableSources: any
) => SourceConfigResponseApi[]
- isSelfManagedSource: (
- manualLinkingProvider: 'aws' | 'azure' | 'cloudflare-r2' | 'google-cloud' | null
- ) => boolean
filteredDatabaseSchema: (
databaseSchema: ExternalDataSourceSyncSchema[],
schemaNameFilter: string
@@ -1117,7 +1088,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
accessMethod,
}),
setInitialConnector: (connector: SourceConfigResponseApi | null) => ({ connector }),
- toggleManualLinkFormVisible: (visible: boolean) => ({ visible }),
handleRedirect: (source: ExternalDataSourceType, searchParams?: any) => ({
source,
searchParams,
@@ -1180,9 +1150,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
cancelWizard: true,
setStep: (step: number) => ({ step }),
getDatabaseSchemas: true,
- setManualLinkingProvider: (provider: ManualLinkSourceType) => ({
- provider,
- }),
openSyncMethodModal: (schema: ExternalDataSourceSyncSchema) => ({ schema }),
cancelSyncMethodModal: true,
toggleAllTables: (selectAll: boolean, tableNames?: string[]) => ({ selectAll, tableNames }),
@@ -1211,8 +1178,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
}),
connect(() => ({
values: [
- selfManagedSourceLogic,
- ['tableLoading'],
sourceManagementLogic,
['dataWarehouseSources'],
preflightLogic,
@@ -1223,8 +1188,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
['currentTeamId'],
],
actions: [
- selfManagedSourceLogic,
- ['resetTable', 'createTableSuccess'],
sourceManagementLogic,
['loadSources'],
teamLogic,
@@ -1234,12 +1197,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
],
})),
reducers({
- manualLinkingProvider: [
- null as ManualLinkSourceType | null,
- {
- setManualLinkingProvider: (_, { provider }) => provider,
- },
- ],
cdcSelfManagedSetupDialogOpen: [
false,
{
@@ -1255,12 +1212,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
setInitialConnector: (_, { connector }) => connector,
},
],
- isManualLinkFormVisible: [
- false,
- {
- toggleManualLinkFormVisible: (_, { visible }) => visible,
- },
- ],
wizardDestinationIds: [
[] as string[],
{
@@ -1877,9 +1828,8 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
},
],
showFooter: [
- (s) => [s.selectedConnector, s.isManualLinkFormVisible],
- (selectedConnector: SourceConfigResponseApi | null, isManualLinkFormVisible: boolean) =>
- selectedConnector || isManualLinkFormVisible,
+ (s) => [s.selectedConnector],
+ (selectedConnector: SourceConfigResponseApi | null): boolean => !!selectedConnector,
],
prefixRequired: [
(s) => [s.dataWarehouseSources, s.selectedConnector],
@@ -1910,10 +1860,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
}))
},
],
- isSelfManagedSource: [
- (s) => [s.manualLinkingProvider],
- (manualLinkingProvider: ManualLinkSourceType | null): boolean => manualLinkingProvider !== null,
- ],
filteredDatabaseSchema: [
(s) => [s.databaseSchema, s.schemaNameFilter],
(
@@ -2096,8 +2042,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
actions.selectConnector(null)
actions.resetSourceConnectionDetails()
actions.clearSource()
- actions.toggleManualLinkFormVisible(false)
- actions.resetTable()
actions.setIsLoading(false)
},
onSubmit: () => {
@@ -2113,9 +2057,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
if (step === 2 && values.selectedConnector?.name) {
actions.submitSourceConnectionDetails()
- } else if (step === 2 && values.isManualLinkFormVisible) {
- selfManagedSourceLogic.actions.submitTable()
- posthog.capture('source created', { sourceType: 'Manual' })
}
if (step === 3 && values.selectedConnector?.name) {
@@ -2328,9 +2269,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
}
}
},
- createTableSuccess: () => {
- actions.cancelWizard()
- },
closeWizard: () => {
const returnUrl = values.returnConfig?.returnUrl
const sourceUrl = values.sourceId ? urls.dataWarehouseSource(values.sourceId, 'schemas') : undefined
@@ -2798,17 +2736,6 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
actions.setIsLoading(false)
},
- setManualLinkingProvider: ({ provider }) => {
- actions.onNext()
-
- // Track marketing analytics intent for self-managed marketing sources
- if (provider && VALID_SELF_MANAGED_MARKETING_SOURCES.includes(provider)) {
- actions.addProductIntent({
- product_type: ProductKey.MARKETING_ANALYTICS,
- intent_context: ProductIntentContext.MARKETING_ANALYTICS_ADS_INTEGRATION_VISITED,
- })
- }
- },
selectConnector: ({ connector, accessMethod }) => {
syncExpandedSchemaGroupKeys(actions, values)
actions.resetSourceForm(accessMethod)
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
index 32e29eb8a22a..920f620ebe86 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceCatalogLogic.test.ts
@@ -204,13 +204,10 @@ describe('sourceCatalogLogic', () => {
expect(logic.values.filteredItems.map((item) => item.name)).toContain('Postgres')
})
- it.each([
- { category: 'Sales' as const, search: 'Datadog' },
- { category: 'self-managed' as const, search: 'Datadog' },
- ])('flags a cross-category match when a $category search only hits another category', ({ category, search }) => {
+ it('flags a cross-category match when a category search only hits another category', () => {
const logic = sourceCatalogLogic()
- logic.actions.setSelectedCategory(category)
- logic.actions.setSearch(search)
+ logic.actions.setSelectedCategory('Sales')
+ logic.actions.setSearch('Datadog')
// The category filter hides the only match, so the list dead-ends...
expect(logic.values.filteredItems).toHaveLength(0)
@@ -251,25 +248,16 @@ describe('sourceCatalogLogic', () => {
}
)
- it('lists no self-managed tiles and ignores a self-managed category link', () => {
- const logic = sourceCatalogLogic()
-
- expect(logic.values.catalogItems.some((item) => item.selfManaged)).toBe(false)
- expect(logic.values.categoriesWithCounts.some((cat) => cat.category === 'self-managed')).toBe(false)
-
- router.actions.push(urls.dataPipelinesNew('source'), { category: 'self-managed' })
- expect(logic.values.selectedCategory).toEqual('all')
- })
-
- it('opens on the category the sources list linked to', () => {
+ it('opens on the category a link names', () => {
const logic = sourceCatalogLogic()
expect(logic.values.selectedCategory).toEqual('all')
router.actions.push(urls.dataPipelinesNew('source'), { category: 'Databases' })
expect(logic.values.selectedCategory).toEqual('Databases')
- // An unknown value leaves the catalog as it is rather than filtering it down to nothing.
- router.actions.push(urls.dataPipelinesNew('source'), { category: 'not-a-category' })
+ // An unknown value, such as the old `self-managed` link, leaves the catalog as it is rather than
+ // filtering it down to nothing.
+ router.actions.push(urls.dataPipelinesNew('source'), { category: 'self-managed' })
expect(logic.values.selectedCategory).toEqual('Databases')
})
diff --git a/products/data_warehouse/frontend/scenes/SourcesScene/SourcesList.tsx b/products/data_warehouse/frontend/scenes/SourcesScene/SourcesList.tsx
index 72830b244d6a..71f06cd9634c 100644
--- a/products/data_warehouse/frontend/scenes/SourcesScene/SourcesList.tsx
+++ b/products/data_warehouse/frontend/scenes/SourcesScene/SourcesList.tsx
@@ -1,3 +1,5 @@
+import { useValues } from 'kea'
+
import { IconPlusSmall } from '@posthog/icons'
import { LemonButton, LemonTag } from '@posthog/lemon-ui'
@@ -11,8 +13,11 @@ import { SceneSection } from '~/layout/scenes/components/SceneSection'
import { DirectConnectSourcesTable } from 'products/data_warehouse/frontend/shared/components/DirectConnectSourcesTable'
import { ManagedSourcesTable } from 'products/data_warehouse/frontend/shared/components/ManagedSourcesTable'
import { SelfManagedSourcesTable } from 'products/data_warehouse/frontend/shared/components/SelfManagedSourcesTable'
+import { sourceManagementLogic } from 'products/data_warehouse/frontend/shared/logics/sourceManagementLogic'
export function SourcesList(): JSX.Element {
+ const { hasSelfManagedTables } = useValues(sourceManagementLogic)
+
return (
<div className="flex flex-col gap-4">
<SceneSection
@@ -59,14 +64,17 @@ export function SourcesList(): JSX.Element {
>
<DirectConnectSourcesTable />
</SceneSection>
- <SceneDivider />
-
- <SceneSection
- title="Self-managed data warehouse sources"
- description="Connect to your own data sources, making them queryable in PostHog"
- >
- <SelfManagedSourcesTable />
- </SceneSection>
+ {hasSelfManagedTables && (
+ <>
+ <SceneDivider />
+ <SceneSection
+ title="Self-managed data warehouse sources"
+ description="Tables that PostHog reads in place from your own bucket"
+ >
+ <SelfManagedSourcesTable />
+ </SceneSection>
+ </>
+ )}
</div>
)
}
diff --git a/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts b/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts
index 776777c9bee9..693e7ca2d3e6 100644
--- a/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts
+++ b/products/data_warehouse/frontend/shared/logics/sourceManagementLogic.ts
@@ -79,6 +79,7 @@ export interface sourceManagementLogicValues {
filteredDirectSources: ExternalDataSource[]
filteredManagedSources: ExternalDataSource[]
filteredSelfManagedTables: DatabaseSchemaDataWarehouseTable[]
+ hasSelfManagedTables: boolean
hasZendeskSource: boolean
managedSearchTerm: string
managedSources: ExternalDataSource[]
@@ -231,6 +232,10 @@ export interface sourceManagementLogicMeta {
selfManagedTables: DatabaseSchemaDataWarehouseTable[],
searchTerm: string
) => DatabaseSchemaDataWarehouseTable[]
+ hasSelfManagedTables: (
+ selfManagedTables: DatabaseSchemaDataWarehouseTable[],
+ pendingSelfManagedTableIdsLoading: boolean
+ ) => boolean
managedSources: (dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null) => ExternalDataSource[]
directSources: (dataWarehouseSources: PaginatedResponse<ExternalDataSource> | null) => ExternalDataSource[]
filteredDirectSources: (directSources: ExternalDataSource[], directSearchTerm: string) => ExternalDataSource[]
@@ -412,6 +417,14 @@ export const sourceManagementLogic = kea<sourceManagementLogicType>([
return selfManagedTables.filter((table) => table.name.toLowerCase().includes(normalizedSearch))
},
],
+ // Until the pending ids load, tables that a managed source will import still count as self-managed.
+ hasSelfManagedTables: [
+ (s) => [s.selfManagedTables, s.pendingSelfManagedTableIdsLoading],
+ (
+ selfManagedTables: DatabaseSchemaDataWarehouseTable[],
+ pendingSelfManagedTableIdsLoading: boolean
+ ): boolean => !pendingSelfManagedTableIdsLoading && selfManagedTables.length > 0,
+ ],
managedSources: [
(s) => [s.dataWarehouseSources],
(
diff --git a/products/data_warehouse/frontend/shared/logics/tests/sourceManagementLogic.test.ts b/products/data_warehouse/frontend/shared/logics/tests/sourceManagementLogic.test.ts
index 0f97e990f386..2d5466bdf4b8 100644
--- a/products/data_warehouse/frontend/shared/logics/tests/sourceManagementLogic.test.ts
+++ b/products/data_warehouse/frontend/shared/logics/tests/sourceManagementLogic.test.ts
@@ -219,7 +219,8 @@ describe('sourceManagementLogic', () => {
it.each([
['no linked tables', [], ['orders', 'users', 'events']],
['one linked table', ['t-orders'], ['users', 'events']],
- ['every self-managed table linked', ['t-orders', 't-users'], ['events']],
+ ['all but one table linked', ['t-orders', 't-users'], ['events']],
+ ['every self-managed table linked', ['t-orders', 't-users', 't-events'], []],
['id of an unknown table', ['t-missing'], ['orders', 'users', 'events']],
])('hides tables a managed source will import from the self-managed list: %s', async (_, linkedIds, expected) => {
;(warehouseTablesList as jest.Mock).mockResolvedValue({
@@ -250,5 +251,7 @@ describe('sourceManagementLogic', () => {
expect.objectContaining({ pending_source: true })
)
expect(logic.values.selfManagedTables.map((table) => table.name)).toEqual(expected)
+ // The sources list shows its self-managed section only while one of these tables is left.
+ expect(logic.values.hasSelfManagedTables).toBe(expected.length > 0)
})
})
diff --git a/products/data_warehouse/frontend/shared/storageProvider.test.ts b/products/data_warehouse/frontend/shared/storageProvider.test.ts
index a61f9f4f611f..12e76173c839 100644
--- a/products/data_warehouse/frontend/shared/storageProvider.test.ts
+++ b/products/data_warehouse/frontend/shared/storageProvider.test.ts
@@ -1,64 +1,19 @@
-import { describeStorageProviderMismatch } from './storageProvider'
+import { storageProviderFromUrl } from './storageProvider'
-describe('describeStorageProviderMismatch', () => {
+describe('storageProviderFromUrl', () => {
it.each([
- {
- provider: 'google-cloud',
- url: 'https://your-org.s3.amazonaws.com/invoices/*.pqt',
- urlLabel: 'S3',
- chosenLabel: 'Google Cloud Storage',
- },
- {
- provider: 'aws',
- url: 'https://storage.googleapis.com/your-org/invoices/*.pqt',
- urlLabel: 'Google Cloud Storage',
- chosenLabel: 'S3',
- },
- {
- provider: 'aws',
- url: 'https://your-account-id.r2.cloudflarestorage.com/invoices/*.pqt',
- urlLabel: 'Cloudflare R2',
- chosenLabel: 'S3',
- },
- {
- provider: 'cloudflare-r2',
- url: 'https://yourstorageaccount.blob.core.windows.net/your-container/*.pqt',
- urlLabel: 'Azure',
- chosenLabel: 'Cloudflare R2',
- },
- ] as const)(
- 'names both providers for a $urlLabel URL under $chosenLabel',
- ({ provider, url, urlLabel, chosenLabel }) => {
- const message = describeStorageProviderMismatch(url, provider)
-
- expect(message).toContain(`points at ${urlLabel}`)
- expect(message).toContain(`you chose ${chosenLabel}`)
- }
- )
-
- // An S3-compatible store reached through the `aws` provider lives on a host of its own, so an
- // unrecognized host must stay silent rather than accuse the user of picking the wrong provider.
- it.each([
- { provider: 'aws', url: 'https://your-org.s3.amazonaws.com/invoices/*.pqt', case: 'a matching host' },
- {
- provider: 'google-cloud',
- url: 'https://storage.googleapis.com/your-org/invoices/*.pqt',
- case: 'a matching host',
- },
- {
- provider: 'aws',
- url: 'https://s3.us-west-1.wasabisys.com/your-org/invoices/*.pqt',
- case: 'an S3-compatible host',
- },
- { provider: 'aws', url: '', case: 'an empty URL' },
- { provider: 'aws', url: undefined, case: 'no URL yet' },
- {
- provider: 'google-cloud',
- url: 'https://storage.googleapis.com/your-org/amazonaws.com/*.pqt',
- case: "another provider's domain used as a folder name",
- },
- { provider: 'aws', url: 'not a url', case: 'an unparsable URL' },
- ] as const)('stays quiet for $case', ({ provider, url }) => {
- expect(describeStorageProviderMismatch(url, provider)).toBeNull()
+ { url: 'https://your-org.s3.amazonaws.com/invoices/*.pqt', expected: 'aws' },
+ { url: 'https://storage.googleapis.com/your-org/invoices/*.pqt', expected: 'google-cloud' },
+ { url: 'https://your-account-id.r2.cloudflarestorage.com/invoices/*.pqt', expected: 'cloudflare-r2' },
+ { url: 'https://yourstorageaccount.blob.core.windows.net/your-container/*.pqt', expected: 'azure' },
+ // Matching on the whole URL would read the folder name as the provider.
+ { url: 'https://storage.googleapis.com/your-org/amazonaws.com/*.pqt', expected: 'google-cloud' },
+ // An S3-compatible store reached through the `aws` provider lives on a host of its own.
+ { url: 'https://s3.us-west-1.wasabisys.com/your-org/invoices/*.pqt', expected: null },
+ { url: '', expected: null },
+ { url: undefined, expected: null },
+ { url: 'not a url', expected: null },
+ ] as const)('reads $expected from $url', ({ url, expected }) => {
+ expect(storageProviderFromUrl(url)).toEqual(expected)
})
})
diff --git a/products/data_warehouse/frontend/shared/storageProvider.ts b/products/data_warehouse/frontend/shared/storageProvider.ts
index f4e806ed76b7..70e116aa3f9a 100644
--- a/products/data_warehouse/frontend/shared/storageProvider.ts
+++ b/products/data_warehouse/frontend/shared/storageProvider.ts
@@ -1,13 +1,5 @@
import { ManualLinkSourceType } from '~/types'
-/** How each self-managed storage provider is named in the source catalog. */
-export const MANUAL_LINK_SOURCE_LABELS: Record<ManualLinkSourceType, string> = {
- aws: 'S3',
- 'google-cloud': 'Google Cloud Storage',
- 'cloudflare-r2': 'Cloudflare R2',
- azure: 'Azure',
-}
-
/**
* The provider a bucket URL belongs to, or null when the host names none of them.
*
@@ -42,19 +34,3 @@ export function storageProviderFromUrl(url: string | undefined): ManualLinkSourc
}
return null
}
-
-/**
- * Tells the user their bucket URL belongs to a provider other than the one they picked, or null
- * when the two agree. The credentials of one provider never work against another's host, so this
- * pairing can only fail, and it fails at query time long after the form is gone.
- */
-export function describeStorageProviderMismatch(
- urlPattern: string | undefined,
- provider: ManualLinkSourceType
-): string | null {
- const urlProvider = storageProviderFromUrl(urlPattern)
- if (!urlProvider || urlProvider === provider) {
- return null
- }
- return `This URL points at ${MANUAL_LINK_SOURCE_LABELS[urlProvider]}, but you chose ${MANUAL_LINK_SOURCE_LABELS[provider]}. Go back and pick ${MANUAL_LINK_SOURCE_LABELS[urlProvider]}, or enter a ${MANUAL_LINK_SOURCE_LABELS[provider]} URL.`
-}
diff --git a/products/data_warehouse/frontend/utils.ts b/products/data_warehouse/frontend/utils.ts
index 94e93758cd7b..f3c30ba4fad9 100644
--- a/products/data_warehouse/frontend/utils.ts
+++ b/products/data_warehouse/frontend/utils.ts
@@ -244,7 +244,5 @@ export const cleanSourceId = (id: string): string => id.replace('self-managed-',
/**
* Checks if a template represents a managed data warehouse source.
* Managed sources (Stripe, Postgres, etc.) have access control.
- * Self-managed sources (S3, GCS, Azure, R2) do not have access control.
*/
-export const isManagedSourceTemplate = (template: HogFunctionTemplateType): boolean =>
- template.type === 'source' && !isSelfManagedSourceId(template.id)
+export const isManagedSourceTemplate = (template: HogFunctionTemplateType): boolean => template.type === 'source'
diff --git a/products/marketing_analytics/frontend/components/AddIntegrationButton.tsx b/products/marketing_analytics/frontend/components/AddIntegrationButton.tsx
index 3d0ec193cfdf..fc0f2f5bd261 100644
--- a/products/marketing_analytics/frontend/components/AddIntegrationButton.tsx
+++ b/products/marketing_analytics/frontend/components/AddIntegrationButton.tsx
@@ -10,7 +10,6 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { urls } from 'scenes/urls'
import {
VALID_NON_NATIVE_MARKETING_SOURCES,
- VALID_SELF_MANAGED_MARKETING_SOURCES,
getEnabledNativeMarketingSources,
nativeSourceDisplayLabel,
} from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utils'
@@ -55,7 +54,6 @@ export function AddIntegrationButton({ onIntegrationSelect }: AddIntegrationButt
? [{ title: 'Organic search', sources: ['GoogleSearchConsole'] }]
: []),
{ title: 'External sources', sources: VALID_NON_NATIVE_MARKETING_SOURCES },
- { title: 'Self-managed sources', sources: VALID_SELF_MANAGED_MARKETING_SOURCES },
]
const items: LemonMenuItems = [
...(showNewSourcesInMenu