: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
chore(dashboards): move the dashboards list and templates scenes into the product (#122183)
Thomas Obermüller7630f308eb1b
diff --git a/frontend/src/scenes/appScenes.ts b/frontend/src/scenes/appScenes.tsindex 13e85f31e285..00726f7d3619 100644--- a/frontend/src/scenes/appScenes.ts+++ b/frontend/src/scenes/appScenes.ts@@ -24,7 +24,7 @@ export const appScenes: Record<Scene | string, () => any> = {[Scene.Cohorts]: () => import('./cohorts/Cohorts'),[Scene.CustomCss]: () => import('./themes/CustomCssScene'),[Scene.Dashboard]: () => import('./dashboard/Dashboard'),- [Scene.Dashboards]: () => import('./dashboard/dashboards/Dashboards'),+ [Scene.Dashboards]: () => import('products/dashboards/frontend/dashboards/Dashboards'),[Scene.DataManagement]: () => import('./data-management/DataManagementScene'),[Scene.DataPipelinesNew]: () => import('./data-pipelines/DataPipelinesNewScene'),[Scene.DeadLetterQueue]: () => import('./instance/DeadLetterQueue/DeadLetterQueue'),@@ -96,7 +96,8 @@ export const appScenes: Record<Scene | string, () => any> = {[Scene.Replay]: () => import('./session-recordings/SessionRecordings'),[Scene.ResourceTransfer]: () => import('./resource-transfer/ResourceTransfer'),[Scene.RealTimeUsage]: () => import('./real-time-usage/RealTimeUsage'),- [Scene.DashboardTemplateCopy]: () => import('./dashboard/dashboards/templates/DashboardTemplateCopyScene'),+ [Scene.DashboardTemplateCopy]: () =>+ import('products/dashboards/frontend/dashboards/templates/DashboardTemplateCopyScene'),[Scene.SQLEditor]: () => import('./data-warehouse/editor/EditorScene'),[Scene.SavedInsights]: () => import('products/product_analytics/frontend/insights/savedInsights/SavedInsights'),[Scene.WebScripts]: () => import('./data-pipelines/WebScriptsScene'),diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 697c7316664a..9b119de35dce 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -3258,6 +3258,9 @@ importers:'@posthog/icons':specifier: 'catalog:'+ '@posthog/quill':+ specifier: workspace:*+ version: link:../../packages/quill/packages/quill'@types/react':specifier: 18.3.27version: 18.3.27@@ -3285,6 +3288,9 @@ importers:kea-router:specifier: 'catalog:'version: 3.4.2([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))+ kea-subscriptions:+ specifier: 'catalog:'+ version: 3.0.1([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))posthog-js:specifier: 'catalog:'version: 1.438.23(@types/[email protected])([email protected])diff --git a/products/dashboards/frontend/DashboardsList.stories.tsx b/products/dashboards/frontend/DashboardsList.stories.tsxindex b1e1ddd925b7..576f4830704d 100644--- a/products/dashboards/frontend/DashboardsList.stories.tsx+++ b/products/dashboards/frontend/DashboardsList.stories.tsx@@ -1,10 +1,11 @@import type { Meta, StoryObj } from '@storybook/react'import __dashboards from 'scenes/dashboard/__mocks__/dashboards.json'-import { DashboardsTableContainer } from 'scenes/dashboard/dashboards/DashboardsTable'import { mswDecorator } from '~/mocks/browser'+import { DashboardsTableContainer } from './dashboards/DashboardsTable'+const meta: Meta<typeof DashboardsTableContainer> = {component: DashboardsTableContainer,title: 'Products/Dashboards',diff --git a/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateCopyScene.stories.tsx b/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateCopyScene.stories.tsxindex d6cdd25f75fa..f69e701cc559 100644--- a/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateCopyScene.stories.tsx+++ b/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplateCopyScene.stories.tsx@@ -3,13 +3,14 @@ import { MOCK_DEFAULT_BASIC_USER, MOCK_DEFAULT_ORGANIZATION, MOCK_DEFAULT_TEAM,import { Meta, StoryObj } from '@storybook/react'import { useEffect } from 'react'-import { DashboardTemplateCopyScene } from 'scenes/dashboard/dashboards/templates/DashboardTemplateCopyScene'import { organizationLogic } from 'scenes/organizationLogic'import { urls } from 'scenes/urls'import { mswDecorator } from '~/mocks/browser'import { InsightColor, type DashboardTemplateType, type OrganizationType, type TeamType } from '~/types'+import { DashboardTemplateCopyScene } from '../../dashboards/templates/DashboardTemplateCopyScene'+const SOURCE_TEMPLATE_ID = 'storybook-copy-source-template'const insightTile = {diff --git a/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplatesTable.stories.tsx b/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplatesTable.stories.tsxindex 61f0c6e271b0..ff480156ad15 100644--- a/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplatesTable.stories.tsx+++ b/products/dashboards/frontend/components/DashboardTemplates/DashboardTemplatesTable.stories.tsx@@ -14,7 +14,6 @@ import { useEffect } from 'react'import __dashboard_template_schema from 'scenes/dashboard/__mocks__/dashboard_template_schema.json'import { DashboardTemplateModal } from 'scenes/dashboard/dashboards/templates/DashboardTemplateModal'import { dashboardTemplatesLogic } from 'scenes/dashboard/dashboards/templates/dashboardTemplatesLogic'-import { DashboardTemplatesTable } from 'scenes/dashboard/dashboards/templates/DashboardTemplatesTable'import { DashboardTemplateEditor } from 'scenes/dashboard/DashboardTemplateEditor'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'@@ -31,6 +30,8 @@ import {type UserType,} from '~/types'+import { DashboardTemplatesTable } from '../../dashboards/templates/DashboardTemplatesTable'+/** Same key as `DashboardTemplatesTable` — list load is driven by `/dashboard` urlToAction in-app; storybook calls `getAllTemplates` after mount so the table is not stuck empty. */const templatesTabListLogic = dashboardTemplatesLogic({ scope: 'default', templatesTabList: true })diff --git a/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx b/products/dashboards/frontend/dashboards/Dashboards.tsxsimilarity index 98%rename from frontend/src/scenes/dashboard/dashboards/Dashboards.tsxrename to products/dashboards/frontend/dashboards/Dashboards.tsxindex 16c0cc6e8084..2df65e81d511 100644--- a/frontend/src/scenes/dashboard/dashboards/Dashboards.tsx+++ b/products/dashboards/frontend/dashboards/Dashboards.tsx@@ -13,7 +13,6 @@ import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { DashboardsTab, dashboardsLogic } from 'scenes/dashboard/dashboards/dashboardsLogic'import { DashboardTemplateModal } from 'scenes/dashboard/dashboards/templates/DashboardTemplateModal'-import { DashboardTemplatesTable } from 'scenes/dashboard/dashboards/templates/DashboardTemplatesTable'import { DashboardTemplateEditor } from 'scenes/dashboard/DashboardTemplateEditor'import { DeleteDashboardModal } from 'scenes/dashboard/DeleteDashboardModal'import { DuplicateDashboardModal } from 'scenes/dashboard/DuplicateDashboardModal'@@ -36,6 +35,7 @@ import { DashboardsSceneMenuBar } from './DashboardsSceneMenuBar'import { DashboardsTableContainer } from './DashboardsTable'import { NewDashboardMenu } from './NewDashboardMenu'import { QuillDashboardsActions } from './QuillDashboardsActions'+import { DashboardTemplatesTable } from './templates/DashboardTemplatesTable'export const scene: SceneExport = {component: Dashboards,diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsFiltersBar.test.tsx b/products/dashboards/frontend/dashboards/DashboardsFiltersBar.test.tsxsimilarity index 97%rename from frontend/src/scenes/dashboard/dashboards/DashboardsFiltersBar.test.tsxrename to products/dashboards/frontend/dashboards/DashboardsFiltersBar.test.tsxindex eea8f37c3fd8..a6cf9a944ec0 100644--- a/frontend/src/scenes/dashboard/dashboards/DashboardsFiltersBar.test.tsx+++ b/products/dashboards/frontend/dashboards/DashboardsFiltersBar.test.tsx@@ -4,8 +4,9 @@ import { fireEvent, render, screen } from '@testing-library/react'import { useActions, useValues } from 'kea'import type { ReactNode } from 'react'+import { DashboardsTab } from 'scenes/dashboard/dashboards/dashboardsLogic'+import { DashboardsFiltersBar } from './DashboardsFiltersBar'-import { DashboardsTab } from './dashboardsLogic'jest.mock('kea', () => ({ ...jest.requireActual('kea'), useValues: jest.fn(), useActions: jest.fn() }))jest.mock('lib/components/MemberSelectMultiplePopover', () => ({ MemberSelectMultiplePopover: () => null }))diff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsFiltersBar.tsx b/products/dashboards/frontend/dashboards/DashboardsFiltersBar.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/DashboardsFiltersBar.tsxrename to products/dashboards/frontend/dashboards/DashboardsFiltersBar.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsSceneMenuBar.tsx b/products/dashboards/frontend/dashboards/DashboardsSceneMenuBar.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/DashboardsSceneMenuBar.tsxrename to products/dashboards/frontend/dashboards/DashboardsSceneMenuBar.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsx b/products/dashboards/frontend/dashboards/DashboardsTable.test.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/DashboardsTable.test.tsxrename to products/dashboards/frontend/dashboards/DashboardsTable.test.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx b/products/dashboards/frontend/dashboards/DashboardsTable.tsxsimilarity index 99%rename from frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsxrename to products/dashboards/frontend/dashboards/DashboardsTable.tsxindex 45b2ae246ab0..51dd691772ef 100644--- a/frontend/src/scenes/dashboard/dashboards/DashboardsTable.tsx+++ b/products/dashboards/frontend/dashboards/DashboardsTable.tsx@@ -20,6 +20,8 @@ import { Link } from 'lib/lemon-ui/Link'import { Tooltip } from 'lib/lemon-ui/Tooltip'import { accessLevelSatisfied } from 'lib/utils/accessControlUtils'import { DashboardEventSource } from 'lib/utils/eventUsageLogic'+import { UNFILED_DASHBOARDS_FOLDER } from 'scenes/dashboard/dashboardConstants'+import { DASHBOARD_CANNOT_EDIT_MESSAGE } from 'scenes/dashboard/DashboardHeader'import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'import { dashboardsLogic } from 'scenes/dashboard/dashboards/dashboardsLogic'import { deleteDashboardLogic } from 'scenes/dashboard/deleteDashboardLogic'@@ -33,8 +35,6 @@ import { urls } from 'scenes/urls'import { dashboardsModel, nameCompareFunction } from '~/models/dashboardsModel'import { AccessControlLevel, AccessControlResourceType, DashboardBasicType, DashboardType } from '~/types'-import { UNFILED_DASHBOARDS_FOLDER } from '../dashboardConstants'-import { DASHBOARD_CANNOT_EDIT_MESSAGE } from '../DashboardHeader'import { DashboardsFiltersBar } from './DashboardsFiltersBar'function BulkMoveToFolderButton({diff --git a/frontend/src/scenes/dashboard/dashboards/NewDashboardMenu.tsx b/products/dashboards/frontend/dashboards/NewDashboardMenu.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/NewDashboardMenu.tsxrename to products/dashboards/frontend/dashboards/NewDashboardMenu.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/QuillDashboardsActions.tsx b/products/dashboards/frontend/dashboards/QuillDashboardsActions.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/QuillDashboardsActions.tsxrename to products/dashboards/frontend/dashboards/QuillDashboardsActions.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplateCopyScene.tsx b/products/dashboards/frontend/dashboards/templates/DashboardTemplateCopyScene.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplateCopyScene.tsxrename to products/dashboards/frontend/dashboards/templates/DashboardTemplateCopyScene.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesEmptyState.tsx b/products/dashboards/frontend/dashboards/templates/DashboardTemplatesEmptyState.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesEmptyState.tsxrename to products/dashboards/frontend/dashboards/templates/DashboardTemplatesEmptyState.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesTable.test.tsx b/products/dashboards/frontend/dashboards/templates/DashboardTemplatesTable.test.tsxsimilarity index 100%rename from frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesTable.test.tsxrename to products/dashboards/frontend/dashboards/templates/DashboardTemplatesTable.test.tsxdiff --git a/frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesTable.tsx b/products/dashboards/frontend/dashboards/templates/DashboardTemplatesTable.tsxsimilarity index 99%rename from frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesTable.tsxrename to products/dashboards/frontend/dashboards/templates/DashboardTemplatesTable.tsxindex 4482c8ed9d33..407595fae813 100644--- a/frontend/src/scenes/dashboard/dashboards/templates/DashboardTemplatesTable.tsx+++ b/products/dashboards/frontend/dashboards/templates/DashboardTemplatesTable.tsx@@ -14,6 +14,7 @@ import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'import { Tooltip } from 'lib/lemon-ui/Tooltip'import { getAppContext } from 'lib/utils/getAppContext'import { humanFriendlyNumber } from 'lib/utils/numbers'+import { dashboardTemplateModalLogic } from 'scenes/dashboard/dashboards/templates/dashboardTemplateModalLogic'import { dashboardTemplatesLogic } from 'scenes/dashboard/dashboards/templates/dashboardTemplatesLogic'import { dashboardTemplateEditorLogic } from 'scenes/dashboard/dashboardTemplateEditorLogic'import { urls } from 'scenes/urls'@@ -21,7 +22,6 @@ import { userLogic } from 'scenes/userLogic'import { DashboardTemplateType } from '~/types'-import { dashboardTemplateModalLogic } from './dashboardTemplateModalLogic'import { DashboardTemplatesEmptyState } from './DashboardTemplatesEmptyState'const templatesTableLogic = dashboardTemplatesLogic({ scope: 'default', templatesTabList: true })diff --git a/frontend/src/scenes/dashboard/dashboards/templates/FeaturedTemplatesChooser.tsx b/products/dashboards/frontend/dashboards/templates/FeaturedTemplatesChooser.tsxsimilarity index 89%rename from frontend/src/scenes/dashboard/dashboards/templates/FeaturedTemplatesChooser.tsxrename to products/dashboards/frontend/dashboards/templates/FeaturedTemplatesChooser.tsxindex 1420c2c798f4..f254fdd4bc2e 100644--- a/frontend/src/scenes/dashboard/dashboards/templates/FeaturedTemplatesChooser.tsx+++ b/products/dashboards/frontend/dashboards/templates/FeaturedTemplatesChooser.tsx@@ -5,17 +5,22 @@ import { IconPlus } from '@posthog/icons'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { cn } from 'lib/utils/css-classes'+import {+ runBlankDashboardFlow,+ runDashboardTemplateClickFlow,+} from 'scenes/dashboard/dashboards/templates/dashboardTemplateCreationFlows'+import { TemplateItem } from 'scenes/dashboard/dashboards/templates/DashboardTemplateItem'+import { DashboardTemplateItemSkeleton } from 'scenes/dashboard/dashboards/templates/DashboardTemplateItemSkeleton'+import {+ DashboardTemplateProps,+ dashboardTemplatesLogic,+} from 'scenes/dashboard/dashboards/templates/dashboardTemplatesLogic'import { newDashboardLogic } from 'scenes/dashboard/newDashboardLogic'import { DashboardTemplateType, TemplateAvailabilityContext } from '~/types'import BlankDashboardHog from 'public/blank-dashboard-hog.png'-import { runBlankDashboardFlow, runDashboardTemplateClickFlow } from './dashboardTemplateCreationFlows'-import { TemplateItem } from './DashboardTemplateItem'-import { DashboardTemplateItemSkeleton } from './DashboardTemplateItemSkeleton'-import { DashboardTemplateProps, dashboardTemplatesLogic } from './dashboardTemplatesLogic'-export type FeaturedTemplatesChooserProps = Pick<DashboardTemplateProps,'scope' | 'onItemClick' | 'redirectAfterCreation' | 'availabilityContexts' | 'className'diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.test.ts b/products/dashboards/frontend/dashboards/templates/dashboardTemplateCopyLogic.test.tssimilarity index 98%rename from frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.test.tsrename to products/dashboards/frontend/dashboards/templates/dashboardTemplateCopyLogic.test.tsindex 0419516cc7a2..2a0ceae3c8f3 100644--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.test.ts+++ b/products/dashboards/frontend/dashboards/templates/dashboardTemplateCopyLogic.test.ts@@ -5,6 +5,7 @@ import { expectLogic } from 'kea-test-utils'import api, { ApiError } from 'lib/api'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'+import { dashboardTemplatesLogic } from 'scenes/dashboard/dashboards/templates/dashboardTemplatesLogic'import { urls } from 'scenes/urls'import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'@@ -12,7 +13,6 @@ import { initKeaTests } from '~/test/init'import type { DashboardTemplateType } from '~/types'import { dashboardTemplateCopyLogic } from './dashboardTemplateCopyLogic'-import { dashboardTemplatesLogic } from './dashboardTemplatesLogic'jest.mock('lib/lemon-ui/LemonToast/LemonToast', () => ({lemonToast: { success: jest.fn(), error: jest.fn() },diff --git a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.ts b/products/dashboards/frontend/dashboards/templates/dashboardTemplateCopyLogic.tssimilarity index 97%rename from frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.tsrename to products/dashboards/frontend/dashboards/templates/dashboardTemplateCopyLogic.tsindex 0f3b1f827223..c4d9994d7df4 100644--- a/frontend/src/scenes/dashboard/dashboards/templates/dashboardTemplateCopyLogic.ts+++ b/products/dashboards/frontend/dashboards/templates/dashboardTemplateCopyLogic.ts@@ -5,14 +5,13 @@ import { subscriptions } from 'kea-subscriptions'import api from 'lib/api'import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'+import { dashboardTemplatesLogic } from 'scenes/dashboard/dashboards/templates/dashboardTemplatesLogic'import { organizationLogic } from 'scenes/organizationLogic'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'import type { DashboardTemplateType } from '~/types'--import type { OrganizationType } from '../../../../types'-import { dashboardTemplatesLogic } from './dashboardTemplatesLogic'+import type { OrganizationType } from '~/types'export interface DashboardTemplateCopyLogicProps {sourceTemplateId: stringdiff --git a/products/dashboards/package.json b/products/dashboards/package.jsonindex b91169720fa7..950250edf142 100644--- a/products/dashboards/package.json+++ b/products/dashboards/package.json@@ -5,11 +5,13 @@},"dependencies": {"@floating-ui/react": "^0.27.19",+ "@posthog/quill": "workspace:*","fast-equals": "catalog:","kea": "catalog:","kea-forms": "catalog:","kea-loaders": "catalog:","kea-router": "catalog:",+ "kea-subscriptions": "catalog:","posthog-js": "catalog:","react-grid-layout": "^2.2.4","react-intersection-observer": "^9.5.3"