: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(marketing): group connection issues by integration (#118562)
Javier Bahamondes7204bebe22e0
diff --git a/docs/internal/marketing-source-suggestions.md b/docs/internal/marketing-source-suggestions.mdindex 9443d72c9014..ceca968e3c41 100644--- a/docs/internal/marketing-source-suggestions.md+++ b/docs/internal/marketing-source-suggestions.md@@ -287,3 +287,12 @@ The source status banner names each required table that needs attention and linkDisabled imports, missing tables, running syncs, failures, pauses, cancellations, and tables awaiting a completed sync have separate messages.Multiple table problems remain visible together, even when the connection has one overall status.Google Ads connections using the legacy `campaign_stats` schema retain support and display that actual schema name.++## Connection issues++The source onboarding panel groups connected sources by integration and identifies each connection by its prefix, or its source ID when no prefix exists.+Expand an integration to review the affected tables and open the connection’s source settings.+The panel includes the source validation details shown by the status banner.+When the panel displays a connection, its duplicate status banner entry is hidden.+Configuration validation failures and issues for sources outside the panel remain in the banner.+With source onboarding disabled, the existing banner remains available.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex d645c8c05bd8..c4137a13f335 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12763,9 +12763,9 @@ snapshots:scenes-app-marketing-analytics-source-onboarding--dashboard-with-ads-only--light:hash: v1.k794b7964.a35719d163748f2340f3c78c7c51586d4ad9d06d0a647ab6e40fe140723657b3.g5VthHH34aRvYlqcBJzbTYYCovEmm7bxvV2OWnQsUO8scenes-app-marketing-analytics-source-onboarding--dashboard-with-ads-syncing-without-search-console--dark:- hash: v1.k794b7964.88741aee9f88fadc81e2a99a94b36598ea3d78ccf8e7561c871ebb5a6f757840.Z4eNQGdw57yWQ6uWRvS4EPdXpyWFgSOcfljZdG-leww+ hash: v1.k794b7964.bfa13529bdb940ef1cd344b2bf11c58522804280d0e0dd141008411660a53505.ApfEsWw3lxynpDaRYL_pRTblq_-Yucp5d6hwOFDmY9kscenes-app-marketing-analytics-source-onboarding--dashboard-with-ads-syncing-without-search-console--light:- hash: v1.k794b7964.f1fc4b6bc856a0f683136119bfd6a3bdadbeb01b1b3a8fbccc6a3ac2ee3fb294.OXCU1Z6rueHcBOvG4RGn5m1f4RrVbz3uQ4XvZBgX58s+ hash: v1.k794b7964.3f5301fe8cf282bd4f53876e3e737f93c0efbb84fb31bd89588aba81002f512d.nGEExJIV8BcMR8Csi5eBnZ4ulUzUjmy94D6mye-Gc4Ascenes-app-marketing-analytics-source-onboarding--dashboard-with-search-console-only--dark:hash: v1.k794b7964.cf41d933958f7e522462c9a74b07f227c533241d6645a49446d4cada554316a1.UlI5XySqlFud8grNCLsDY9z6Af2hSWyf0wlOfR4xvI0scenes-app-marketing-analytics-source-onboarding--dashboard-with-search-console-only--light:@@ -12795,9 +12795,9 @@ snapshots:scenes-app-marketing-analytics-source-setup-panel--checking--light:hash: v1.k794b7964.94db2d98c789892ea3ce826fd6b2057f00a42e967c81859f4b350d3aba101593.jpKOFtG3mHI0tDJsLdRLF5AE738k6cjP4Pa-cvjrMtkscenes-app-marketing-analytics-source-setup-panel--connected--dark:- hash: v1.k794b7964.51cf686c234cfb0f38953444a96a397b59c91c49448ea736f99ec15238776719.Aij2AfbATDRoEQkDerAFIcNFYvEY8sMeNtgB6wmxVMM+ hash: v1.k794b7964.9f9dc05c4a8e7399033c74a04a5e32b37e58e649ed8c32a91c4377e823046f12.6VFG6XndwTBGFMDrqeCSGLqKn-hfAa9IN_I9xZDP638scenes-app-marketing-analytics-source-setup-panel--connected--light:- hash: v1.k794b7964.8787c1c4c4cae0926c247404634a832e7d4dcc844430b08e2051dcc5e6666295._NCT2Z9XRKihEvf0Hh1yLqDqhTSL-ycHJ6lv9FwJtmc+ hash: v1.k794b7964.c0f12e6e42c2156970b5f6537a1f86613dbb105fb4bc5797a094f40e0c2a5c00.s4V8oe1cuQzbKOr57bKvGlLFhuO1_vD0b9ypGaxKGlMscenes-app-marketing-analytics-source-setup-panel--detected-platforms--dark:hash: v1.k794b7964.05c03040fd29a2d363bdfaedf3354d9a8bb30e60d75ecf0f3a702cdcf7964aeb.lfVLwNAax4YVjEhf3jQYuzbdaPCPTWwdZTd2eiou_88scenes-app-marketing-analytics-source-setup-panel--detected-platforms--light:@@ -12810,6 +12810,10 @@ snapshots:hash: v1.k794b7964.46c44f8ba528de2ed8bd2bcc379a385b9e1fa46169c73da1e192d751b9c194ec.iQA4jv47I8Vs707MTD17JXFg_luS8tiSd7sjwcOJvp8scenes-app-marketing-analytics-source-setup-panel--dismissed-suggestions--light:hash: v1.k794b7964.ffc8c430ea05caddb72061b672439ea70dc112d2f895c53787c361124608e571.nDJqea2Pblrsydv-gbKq_QaZX36jOZkbXu-3f9ZMdf8+ scenes-app-marketing-analytics-source-setup-panel--grouped-connection-errors--dark:+ hash: v1.k794b7964.58406eca76832c792faa22cf846db49e00ff98ffc4ecc380cb27e89fd698496c.Hz5peryxG8f1PucOohQaTe2h_vqMIyfLgC232hAL8go+ scenes-app-marketing-analytics-source-setup-panel--grouped-connection-errors--light:+ hash: v1.k794b7964.c28f2e8f7855f64c39e9a3956532954a3a137147d169b7c2ed93917551832003.BKiu2w94wqhM9szakLV-25ysRe9NT458zSPMo21pJ-wscenes-app-marketing-analytics-source-setup-panel--missing-connection-action--dark:hash: v1.k794b7964.82381c943a3afaf4bcd1ac432a9a1c1f4e23b49bf9f097126fa973a7d96ca06c.xtPZUVhPcOse-Kb3u0DCpuiICW2SkFiydtZA6pv4XxEscenes-app-marketing-analytics-source-setup-panel--missing-connection-action--light:@@ -12818,14 +12822,18 @@ snapshots:hash: v1.k794b7964.36f4cf02dc3d756d15ebb24bc84bf2a58f6d0259483d462985bcbefa97fb0f88.OrMl8XNgiek6ZQEnh9nkyvlL4F4aYHvgoJ4Fju756XYscenes-app-marketing-analytics-source-setup-panel--narrow--light:hash: v1.k794b7964.7a77d7910281923e51f415530c9c775fe0acc2bfb001f14cbe1a64cd18bf7984.ZH3VQpU1jTt8lUeAzYAsoxyDmFwXiJ3RimsEu_galp8+ scenes-app-marketing-analytics-source-setup-panel--narrow-connection-errors--dark:+ hash: v1.k794b7964.29dcea26545caabfedc6aa786734cbcfe0d5ca943eca8478157188d4503a83ca.ai1oNxAam-vNC5EBi9DiQQWdMXaor8BZRG3UWdEJtPs+ scenes-app-marketing-analytics-source-setup-panel--narrow-connection-errors--light:+ hash: v1.k794b7964.6910a1ed89b25bee7b4bf7a5b332e46d78b91a5f389a3d2daf0e8fbd5a7b8a17.a1Hz1UjFUWzMsZpkOh3xQUjEO2yerkyHlH5DLS8QeFYscenes-app-marketing-analytics-source-setup-panel--no-detected-platforms--dark:hash: v1.k794b7964.abdcd2e7b2563f5c3a10b3332f8efa3ddb78a57a6c7173ec90ec99e6176a42c0.8xGSdXLuk3l3fTvfItzd2P0I0Eybxc3QANJN8cUjTusscenes-app-marketing-analytics-source-setup-panel--no-detected-platforms--light:hash: v1.k794b7964.b30ea957ca84ea1996e6a53a43b0fa3540018ab2d54ce320d6cf47fe8b4ad306.RyaPzoBQjTpnm1_QznBeevy-Fl0rPMsFlN7jNgMc-xsscenes-app-marketing-analytics-source-setup-panel--paused-import--dark:- hash: v1.k794b7964.8a777e8a1e0360f4e26969002b4b2eb64dd7419dc86fd41503f84f42fe1da637.1ReuufBVIHvNyNxe6_Lh1wJz1N5oJfwW_JUGfsFtUFc+ hash: v1.k794b7964.2767a2168560dade89aed5df255a1ea5b9bc23ce33eb52c129aa33ce30cb5f56.wv4RIwTBcApr3JOuFZQQ8SMf-6NyE5xuKryFMK7tMpQscenes-app-marketing-analytics-source-setup-panel--paused-import--light:- hash: v1.k794b7964.47171b9540b017e064c1fa2a23cbc4b5955048b67e9b8c277f986fef9450d4a1.1X6MCoQcEwCo97CvpE3tmpgv8LHpAZAOgFFZGlPgpFQ+ hash: v1.k794b7964.8f62a10810579067c7bb3d5a922b9c2a31f604921e2ca75b3c79313c349182b7.qZpy9z7n8MxdEXWtUBIyGVHLBgVOIfYhr1nuX87HDdMscenes-app-marketing-analytics-source-setup-panel--scan-failed--dark:hash: v1.k794b7964.f6022e62301aba6d5521c0671b66cde3d9f73084733cba667aff2723b6cafecd.nyTvmZgNFvpMmOLJ3fuJMD1NeGTETROPakgmG1yPEQIscenes-app-marketing-analytics-source-setup-panel--scan-failed--light:@@ -12835,9 +12843,13 @@ snapshots:scenes-app-marketing-analytics-source-setup-panel--scanning--light:hash: v1.k794b7964.531176fd3ea7b0152cac1de251fad21d7d9cc0b38933a4360a97691f8a482297.-62clxyv-gVSav_XMR4tSCO35iXBEAFfyD2DGaJMx9oscenes-app-marketing-analytics-source-setup-panel--syncing--dark:- hash: v1.k794b7964.ec5ba8cdd691bf757e9d08863755b3b0e05eed72330db95dc8b850081c43ff98.nShy4MdQcV-WjbMt0r7KezH8DEhNhV4ja9ASHL4MG4E+ hash: v1.k794b7964.1f891709b3aa05baa122b87467fc4cf49aca8d0786e0a9e9aaea4661e7439057.B4q1FSTxksM53QEg2rD75KH1npno_DqQSQv9JMpdgPoscenes-app-marketing-analytics-source-setup-panel--syncing--light:- hash: v1.k794b7964.6a2719e03a7020806535edd43ece2c6107122e44bb2df4fe5fe154cefeba0c18.fLb8TeFan3iHWanMHIjOmLRq3b2ypZcUkxs-j2oBTBY+ hash: v1.k794b7964.26d2bb305834706822eb7537a147d8c462c6101f323bb676cd3b9ddd03206922.3rBhEq__zEDZJcyu61FZSCughF7FB0-jd_CFRl7rCw0+ scenes-app-marketing-analytics-source-status--connection-already-in-panel--dark:+ hash: v1.k794b7964.b4c0bc2c8615a9f1eb803ded13ec684d5a87dbbe9d7c2c80f246dd9752837a97.Tgs6gYhsP2gjy8I_WMmn3tuSp-cCtyOVJFmfEbgNd1M+ scenes-app-marketing-analytics-source-status--connection-already-in-panel--light:+ hash: v1.k794b7964.2c5a657394b08029711b2c4d6e6239fd070ee90f71939bb9e35d471799c8406a.pLED3ZeNKP0ktwUdsyURrSb4QPokSrYpSRbiXmBImSkscenes-app-marketing-analytics-source-status--source-issues--dark:hash: v1.k794b7964.d2057a7b1316abc7100c30b86214f5eb891f35b01c19e899a33a3b9164fc4cc4.YhYj7qFW2Z65don1TkJCwtepa3O1JZOcF3_56hu3Tf0scenes-app-marketing-analytics-source-status--source-issues--light:diff --git a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsxindex f3b4a4131467..ce428573bf1f 100644--- a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx+++ b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx@@ -209,7 +209,9 @@ const SourceMarketingAnalyticsDashboard = (): JSX.Element => {/>)}<LegacyOAuthReconnectBanner />- {hasSyncedMarketingSources && <MarketingAnalyticsSourceStatusBanner />}+ {!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && hasSyncedMarketingSources && (+ <MarketingAnalyticsSourceStatusBanner />+ )}<h2className={hasSyncedMarketingSources || hasSearchConsole ? 'mt-6 mb-0' : 'max-w-3xl w-full mx-auto mt-6 mb-0'diff --git a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner.tsx b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner.tsxindex fc4160523ec2..eddd2bd373c8 100644--- a/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner.tsx+++ b/frontend/src/scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner.tsx@@ -10,18 +10,24 @@ import { ExternalDataSchemaStatus } from '~/types'import { MarketingSourceStatus, marketingAnalyticsLogic } from '../logic/marketingAnalyticsLogic'import { nativeSourceDisplayLabel } from '../logic/utils'-export const MarketingAnalyticsSourceStatusBanner = (): JSX.Element | null => {+export const MarketingAnalyticsSourceStatusBanner = ({+ hiddenSourceIds = [],+}: {+ hiddenSourceIds?: string[]+}): JSX.Element | null => {const { allAvailableSourcesWithStatus, sourceValidationError } = useValues(marketingAnalyticsLogic)- const sourcesWithIssues = allAvailableSourcesWithStatus.filter(- (source) =>- source.status === 'Running' ||- source.status === 'Failed' ||- source.status === 'Paused' ||- source.status === 'Cancelled' ||- source.status === MarketingSourceStatus.Error ||- source.status === MarketingSourceStatus.Warning- )+ const sourcesWithIssues = allAvailableSourcesWithStatus+ .filter((source) => !hiddenSourceIds.includes(source.id))+ .filter(+ (source) =>+ source.status === 'Running' ||+ source.status === 'Failed' ||+ source.status === 'Paused' ||+ source.status === 'Cancelled' ||+ source.status === MarketingSourceStatus.Error ||+ source.status === MarketingSourceStatus.Warning+ )if (sourcesWithIssues.length === 0 && !sourceValidationError) {return nulldiff --git a/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx b/products/marketing_analytics/frontend/dashboard/DetectedSources.tsxindex 33dbfd605a65..00646fed9b16 100644--- a/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx+++ b/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx@@ -6,6 +6,7 @@ import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { marketingOnboardingLogic } from 'scenes/marketing-analytics/Onboarding/marketingOnboardingLogic'import { teamLogic } from 'scenes/teamLogic'+import { MarketingAnalyticsSourceStatusBanner } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner'import { marketingAnalyticsLogic } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic'import { setupPlanLogic } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/setupPlanLogic'import {@@ -41,12 +42,19 @@ export function DetectedSources({ compact = false }: { compact?: boolean }): JSX!nativeSources.some((source) => source.source_type === suggestion.apply?.kind) &&!allAvailableSourcesWithStatus.some((source) => source.source_type === suggestion.apply?.kind))- const connections = nativeSources.map((source) => ({- id: source.id,- name: nativeSourceDisplayLabel(source.source_type),- sourceType: source.source_type,- ...nativeSourceConnectionStatus(source),- }))+ const connections = nativeSources.map((source) => {+ const connectionStatus = nativeSourceConnectionStatus(source)+ const issue = allAvailableSourcesWithStatus.find((candidate) => candidate.id === source.id)+ const needsAttention = issue && ['Warning', 'Error', 'Failed', 'Paused', 'Cancelled'].includes(issue.status)+ return {+ id: source.id,+ name: source.prefix || `${nativeSourceDisplayLabel(source.source_type)} (${source.id.slice(0, 8)})`,+ sourceType: source.source_type,+ ...connectionStatus,+ ...(needsAttention ? { status: 'Needs attention' as const } : {}),+ detail: issue && issue.status !== 'Completed' ? issue.statusMessage : connectionStatus.detail,+ }+ })const openIntegrations = (): void => {setManualSourceSearch('')setShowIntegrations(true)@@ -56,50 +64,58 @@ export function DetectedSources({ compact = false }: { compact?: boolean }): JSX}if (showIntegrations) {return (- <SourceCatalog- hasSources={connections.length > 0 || hasSyncedMarketingSources}- onBack={() => setShowIntegrations(false)}- />+ <>+ <MarketingAnalyticsSourceStatusBanner />+ <SourceCatalog+ hasSources={connections.length > 0 || hasSyncedMarketingSources}+ onBack={() => setShowIntegrations(false)}+ />+ </>)}const pendingConnections = hasSyncedMarketingSources? connections.filter((connection) => connection.status === 'Needs attention'): connectionsif (hasSyncedMarketingSources && !sources.length && !pendingConnections.length) {- return null+ return <MarketingAnalyticsSourceStatusBanner />}return (- <SourceSetupPanel- compact={compact || hasSyncedMarketingSources}- state={- pendingConnections.length- ? 'waiting'- : !setupPlan- ? setupPlanFailed- ? 'error'- : 'scanning'- : sources.length- ? 'suggestions'- : dismissedSuggestions.some((suggestion) => suggestion.kind === 'connect_source')- ? 'dismissed'- : 'empty'- }- suggestions={sources}- connections={pendingConnections}- onRetry={rescanSources}- rescanLoading={setupPlanLoading}- rescanDisabledReason={sourceScanDisabledReason}- onDismiss={dismissSource}- onRestore={restoreAllDismissed}- footer={- <LemonButton- type={sources.length || connections.length ? 'secondary' : 'primary'}- onClick={openIntegrations}- data-attr="marketing-dashboard-connect-source"- >- Browse integrations- </LemonButton>- }- />+ <>+ <MarketingAnalyticsSourceStatusBanner+ hiddenSourceIds={pendingConnections.map((connection) => connection.id)}+ />+ <SourceSetupPanel+ compact={compact || hasSyncedMarketingSources}+ state={+ pendingConnections.length+ ? 'waiting'+ : !setupPlan+ ? setupPlanFailed+ ? 'error'+ : 'scanning'+ : sources.length+ ? 'suggestions'+ : dismissedSuggestions.some((suggestion) => suggestion.kind === 'connect_source')+ ? 'dismissed'+ : 'empty'+ }+ suggestions={sources}+ connections={pendingConnections}+ onRetry={rescanSources}+ rescanLoading={setupPlanLoading}+ rescanDisabledReason={sourceScanDisabledReason}+ onDismiss={dismissSource}+ onRestore={restoreAllDismissed}+ footer={+ <LemonButton+ type={sources.length || connections.length ? 'secondary' : 'primary'}+ onClick={openIntegrations}+ data-attr="marketing-dashboard-connect-source"+ >+ Browse integrations+ </LemonButton>+ }+ />+ </>)}diff --git a/products/marketing_analytics/frontend/dashboard/MarketingAnalyticsSourceStatusBanner.stories.tsx b/products/marketing_analytics/frontend/dashboard/MarketingAnalyticsSourceStatusBanner.stories.tsxindex 0133d9000d0d..08a7d71f344f 100644--- a/products/marketing_analytics/frontend/dashboard/MarketingAnalyticsSourceStatusBanner.stories.tsx+++ b/products/marketing_analytics/frontend/dashboard/MarketingAnalyticsSourceStatusBanner.stories.tsx@@ -1,4 +1,5 @@import type { Meta, StoryObj } from '@storybook/react'+import { within } from '@testing-library/dom'import { FEATURE_FLAGS } from 'lib/constants'import { MarketingAnalyticsSourceStatusBanner } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner'@@ -6,6 +7,8 @@ import { MarketingAnalyticsSourceStatusBanner } from 'scenes/web-analytics/tabs/import { mswDecorator } from '~/mocks/browser'import { DatabaseSchemaDataWarehouseTable, MARKETING_INTEGRATION_CONFIGS } from '~/queries/schema/schema-general'+import { expect } from 'storybook/test'+const table: DatabaseSchemaDataWarehouseTable = {id: 'example-insights-table',name: 'openai_campaign_insights',@@ -22,9 +25,9 @@ const table: DatabaseSchemaDataWarehouseTable = {const meta: Meta<typeof MarketingAnalyticsSourceStatusBanner> = {title: 'Scenes-App/Marketing Analytics/Source status',component: MarketingAnalyticsSourceStatusBanner,- render: () => (+ render: (args) => (<div id="source-status-snapshot" className="w-200 max-w-[calc(100vw-2rem)]">- <MarketingAnalyticsSourceStatusBanner />+ <MarketingAnalyticsSourceStatusBanner {...args} /></div>),parameters: {@@ -102,3 +105,12 @@ export default metatype Story = StoryObj<typeof MarketingAnalyticsSourceStatusBanner>export const SourceIssues: Story = {}++export const ConnectionAlreadyInPanel: Story = {+ args: { hiddenSourceIds: ['example-google-source'] },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement)+ expect(await canvas.findByText(/OpenAI Ads is missing/)).toBeVisible()+ expect(canvas.queryByRole('link', { name: 'Google Ads' })).not.toBeInTheDocument()+ },+}diff --git a/products/marketing_analytics/frontend/dashboard/NewMarketingAnalyticsDashboard.tsx b/products/marketing_analytics/frontend/dashboard/NewMarketingAnalyticsDashboard.tsxindex a1017d7ce998..85c32416ed72 100644--- a/products/marketing_analytics/frontend/dashboard/NewMarketingAnalyticsDashboard.tsx+++ b/products/marketing_analytics/frontend/dashboard/NewMarketingAnalyticsDashboard.tsx@@ -216,7 +216,9 @@ export function NewMarketingAnalyticsDashboard(): JSX.Element {</>)}</div>- <MarketingAnalyticsSourceStatusBanner />+ {!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && (+ <MarketingAnalyticsSourceStatusBanner />+ )}<DetectedSources /><div className="grid grid-cols-[repeat(auto-fit,minmax(min(100%,24rem),1fr))] items-start gap-2 empty:hidden">{!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && sourceSuggestions.length > 0 && (diff --git a/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.stories.tsx b/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.stories.tsxindex ecbb3f211907..732a7b579ff4 100644--- a/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.stories.tsx+++ b/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.stories.tsx@@ -7,7 +7,7 @@ import { FEATURE_FLAGS } from 'lib/constants'import { mswDecorator } from '~/mocks/browser'-import { expect } from 'storybook/test'+import { expect, userEvent } from 'storybook/test'import { SearchConsoleSource } from './SearchConsoleSource'import { SourceSetupPanel } from './SourceSetupPanel'@@ -156,3 +156,57 @@ export const PausedImport: Story = {expect(canvas.getByRole('link', { name: /Manage source/ })).toBeVisible()},}++export const GroupedConnectionErrors: Story = {+ args: {+ state: 'waiting',+ compact: true,+ connections: [+ {+ id: 'example-google-one',+ name: 'Example campaigns',+ sourceType: 'GoogleAds',+ status: 'Needs attention',+ detail: 'campaign: import disabled. Enable this table in the source’s Schemas tab. campaign_overview_stats: sync failed. Review the error in the source’s Schemas tab.',+ },+ {+ id: 'example-google-two',+ name: 'Example search',+ sourceType: 'GoogleAds',+ status: 'Needs attention',+ detail: 'campaign_overview_stats: sync failed. Review the error in the source’s Schemas tab.',+ },+ {+ id: 'example-tiktok',+ name: 'Example video',+ sourceType: 'TikTokAds',+ status: 'Needs attention',+ detail: 'campaign_report: import disabled. Enable this table in the source’s Schemas tab.',+ },+ ],+ },+ play: async ({ canvasElement }) => {+ const canvas = within(canvasElement)+ expect(await canvas.findByText('Example campaigns')).toBeVisible()+ expect(canvas.getByText('Example search')).toBeVisible()+ expect(canvas.getByText(/campaign: import disabled.*campaign_overview_stats: sync failed/)).toBeVisible()+ expect(canvas.getByText('2 connections')).toBeVisible()+ expect(canvas.getAllByRole('link', { name: /Manage source/ })[0]).toHaveAttribute(+ 'href',+ expect.stringContaining('managed-example-google-one')+ )+ await userEvent.click(canvas.getByRole('button', { name: /TikTok Ads/ }))+ expect(await canvas.findByText('Example video')).toBeVisible()+ },+}++export const NarrowConnectionErrors: Story = {+ ...GroupedConnectionErrors,+ decorators: [+ (Story) => (+ <div className="w-full max-w-lg">+ <Story />+ </div>+ ),+ ],+}diff --git a/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.tsx b/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.tsxindex 8fe38e2e389c..ed72c62694c0 100644--- a/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.tsx+++ b/products/marketing_analytics/frontend/dashboard/SourceSetupPanel.tsx@@ -10,6 +10,7 @@ import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { urls } from 'scenes/urls'import type { Suggestion } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/setupPlanLogic'+import { nativeSourceDisplayLabel } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utils'import { SourceIcon } from 'products/data_warehouse/frontend/shared/components/SourceIcon'@@ -134,30 +135,72 @@ export function SourceSetupPanel({</div>)}{connections.length > 0 && (- <div className="divide-y border-t">- {connections.map((connection) => (- <div key={connection.id} className="py-4 space-y-2">- <div className="flex items-center flex-wrap gap-3">- <SourceIcon type={connection.sourceType} size="small" disableTooltip />- <strong>{connection.name}</strong>- <LemonTag type={connection.status === 'Needs attention' ? 'warning' : 'info'}>- {connection.status}- </LemonTag>- </div>- <p className="text-secondary text-sm mb-0">{connection.detail}</p>- {connection.status === 'Needs attention' && (- <LemonButton- type="secondary"- size="small"- to={urls.dataWarehouseSource(connection.id)}- targetBlank- >- Manage source- </LemonButton>- )}- </div>- ))}- </div>+ <LemonCollapse+ embedded+ multiple+ defaultActiveKeys={[connections[0].sourceType]}+ panels={Array.from(new Set(connections.map((connection) => connection.sourceType))).map(+ (sourceType) => {+ const group = connections.filter((connection) => connection.sourceType === sourceType)+ return {+ key: sourceType,+ header: {+ className: 'focus-visible:-outline-offset-2',+ children: (+ <span className="flex flex-wrap items-center gap-2 min-w-0">+ <SourceIcon type={sourceType} size="small" disableTooltip />+ <strong>{nativeSourceDisplayLabel(sourceType)}</strong>+ <span className="text-secondary">{`${group.length} ${group.length === 1 ? 'connection' : 'connections'}`}</span>+ </span>+ ),+ },+ content: (+ <div className="divide-y">+ {group.map((connection) => (+ <div+ key={connection.id}+ className="flex flex-wrap items-start justify-between gap-3 py-3"+ >+ <div className="min-w-0 flex-1 basis-64 space-y-2 break-words">+ <div className="flex items-center flex-wrap gap-2">+ <strong className="break-all">{connection.name}</strong>+ <LemonTag+ type={+ connection.status === 'Needs attention'+ ? 'warning'+ : 'info'+ }+ >+ {connection.status}+ </LemonTag>+ </div>+ <p className="text-secondary text-sm mb-0 whitespace-pre-line">+ {connection.detail}+ </p>+ </div>+ {connection.status === 'Needs attention' && (+ <div className="shrink-0 ml-auto">+ <LemonButton+ type="secondary"+ size="small"+ to={urls.dataWarehouseSource(+ `managed-${connection.id}`+ )}+ targetBlank+ data-attr="marketing-connection-manage-source"+ >+ Manage source+ </LemonButton>+ </div>+ )}+ </div>+ ))}+ </div>+ ),+ }+ }+ )}+ />)}{suggestions.length > 0 && !busy && (<div className="divide-y border-t">