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.

fix(data-warehouse): explain why the new-source wizard's Next button is disabled (#71797)

Tom Owersa887b6e6abd2
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
index 6ea0f4be4eec..3ca8282562fd 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
@@ -216,6 +216,7 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
isLoading,
canGoBack,
canGoNext,
+ nextButtonDisabledReason,
nextButtonText,
selectedConnector,
connectors,
@@ -257,7 +258,9 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
const nextButton = (disabledReason?: string | false): JSX.Element => (
<LemonButton
loading={isLoading || manualLinkIsLoading}
- disabledReason={disabledReason || (!canGoNext && 'Finish this step to continue')}
+ disabledReason={
+ disabledReason || (!canGoNext && (nextButtonDisabledReason || 'Finish this step to continue'))
+ }
type="primary"
center
onClick={() => onSubmit()}
@@ -299,6 +302,7 @@ function InternalSourcesWizard(props: NewSourcesWizardProps): JSX.Element {
isLoading,
manualLinkIsLoading,
canGoNext,
+ nextButtonDisabledReason,
nextButtonText,
onSubmit,
props.hideBackButton,
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
index 409ef7eedb09..a24c9a4201b9 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
@@ -382,6 +382,7 @@ export interface sourceWizardLogicValues {
| 'Select tables to query'
| 'Set up webhook'
| 'Tables ready to query'
+ nextButtonDisabledReason: string | null
nextButtonText: string
requiredTables: any
returnConfig: {
@@ -1671,6 +1672,13 @@ export interface sourceWizardLogicMeta {
isDirectQueryMode: boolean,
webhookStepComplete: boolean
) => boolean
+ nextButtonDisabledReason: (
+ currentStep: number,
+ isManualLinkingSelected: boolean,
+ databaseSchema: ExternalDataSourceSyncSchema[],
+ isDirectQueryMode: boolean,
+ webhookStepComplete: boolean
+ ) => string | null
showSkipButton: (currentStep: number) => boolean
nextButtonText: (
currentStep: number,
@@ -2303,6 +2311,39 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
return true
},
],
+ nextButtonDisabledReason: [
+ (s) => [
+ s.currentStep,
+ s.isManualLinkingSelected,
+ s.databaseSchema,
+ s.isDirectQueryMode,
+ s.webhookStepComplete,
+ ],
+ (
+ currentStep: number,
+ isManualLinkingSelected: boolean,
+ databaseSchema: ExternalDataSourceSyncSchema[],
+ isDirectQueryMode: boolean,
+ webhookStepComplete: boolean
+ ): string | null => {
+ if (!isManualLinkingSelected && currentStep === 3) {
+ const tablesToSync = databaseSchema.filter((n) => n.should_sync)
+ if (tablesToSync.length === 0) {
+ return 'Select at least one table to sync'
+ }
+
+ if (!isDirectQueryMode && tablesToSync.some((n) => !n.sync_type)) {
+ return 'Choose a sync method for each table you want to sync'
+ }
+ }
+
+ if (currentStep === 4 && !webhookStepComplete) {
+ return 'Finish setting up the webhook to continue'
+ }
+
+ return null
+ },
+ ],
showSkipButton: [
(s) => [s.currentStep],
(currentStep: number): boolean => {
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
index 2f4ca022781a..2467cc675e84 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
@@ -764,6 +764,48 @@ describe('sourceWizardLogic', () => {
unmount()
}
})
+
+ it('explains why Next is disabled on the schema step when no table is selected', () => {
+ const { logic, unmount } = mountWithSchemas([buildSchema({ table: 'Customer', should_sync: false })])
+
+ try {
+ logic.actions.setStep(3)
+ expect(logic.values.canGoNext).toBe(false)
+ expect(logic.values.nextButtonDisabledReason).toEqual('Select at least one table to sync')
+ } finally {
+ unmount()
+ }
+ })
+
+ it('explains why Next is disabled when a selected table has no sync method', () => {
+ const { logic, unmount } = mountWithSchemas([
+ buildSchema({ table: 'Customer', should_sync: true, sync_type: null }),
+ ])
+
+ try {
+ logic.actions.setStep(3)
+ expect(logic.values.canGoNext).toBe(false)
+ expect(logic.values.nextButtonDisabledReason).toEqual(
+ 'Choose a sync method for each table you want to sync'
+ )
+ } finally {
+ unmount()
+ }
+ })
+
+ it('clears the disabled reason once a selected table has a sync method', () => {
+ const { logic, unmount } = mountWithSchemas([
+ buildSchema({ table: 'Customer', should_sync: true, sync_type: 'full_refresh' }),
+ ])
+
+ try {
+ logic.actions.setStep(3)
+ expect(logic.values.canGoNext).toBe(true)
+ expect(logic.values.nextButtonDisabledReason).toBeNull()
+ } finally {
+ unmount()
+ }
+ })
})
// Onboarding one-click setup: autoConfigureTables opts every syncable table in so the user