: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
refactor(insights): remove duplicate sidebar monitor actions (#106916)
Matt Puaf31a9e727b86
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 03809b290d1f..150815f6648a 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -6540,14 +6540,6 @@ snapshots:hash: v1.k794b7964.f93f5836e1334a281785def757008dc8ffa21aa628abdad3699de6be7dfc57da.3fn8SNwLnaHNnbN_MopoEAmij74NXlwTFqZ_0EvbX5Iproducts-notebooks-dashboard-widget--saved-results--light:hash: v1.k794b7964.f12c96e51ba15ba72a9e624e28c236e2117b2b1702aa983d7a0ad522c3d1e75e.ZrLMAxC9Z4gZ5qqJz7qFUUC7ykih0WvLmTJxitYD9Mg- products-notebooks-dashboard-widget--search-dashboard-by-creator--narrow--dark:- hash: v1.k794b7964.420b88ad149d19152ff8f1239ea9d8d35319e0b1bf4c1aae14cb773d958a1ae2.b7tEuMNcWeYGsqZkDKNZCz7H-xg8-d3H11AK-HWJzOY- products-notebooks-dashboard-widget--search-dashboard-by-creator--narrow--light:- hash: v1.k794b7964.c461f66b8a15203df372652f6322e407dc9f5fa6cf45156480bdc88822a30ce6.zx8iNjt1xP_kfZ3uydSe4Nj_F171G4DgizV_-l8lcBA- products-notebooks-dashboard-widget--search-dashboard-by-creator--wide--dark:- hash: v1.k794b7964.123382b87f95f9b8839032c88505de0eaf4eceed9092e1f25c24e87af669720c.Cg1vVScDMXtN7SDdxobEI3LqaI3-78O9-Xi8rRwWk54- products-notebooks-dashboard-widget--search-dashboard-by-creator--wide--light:- hash: v1.k794b7964.1a1fd60764b15bdd8ab1072705aae80fe0ac8e20846d7b0d3dddf0cbbf320f89.qBmud_ddtUDMuW4A3gkMxRN2UbQRoJ-0SgT4QmEJHn8products-notebooks-notebook-widget-trust-controls--gate--dark:hash: v1.k794b7964.97a5e7b5f92071f677d09773a3dea88ead3c9a71e85dbd6f6de8875ffc7a3036.9u2VOZ-O_aSU002VK8iAydGcjIYBXzRIacAelaDLJ6Yproducts-notebooks-notebook-widget-trust-controls--gate--light:@@ -10017,21 +10009,21 @@ snapshots:scenes-app-insights-posthog-ai-suggestion--default--light:hash: v1.k794b7964.63299b5e251d2a6beb724655ad8791f82f58ae681bb2c931ba6339dd8fe92a56.vHLJvasOolcLGCjkSmIZqRFJ0CQmc5nTTpBBT40kSc0scenes-app-insights-side-panel-actions--saved-data-visualization--dark:- hash: v1.k794b7964.3911a695d4b7b073bd0bfbaa183acb078d81df968e2cfecd18f84bc1c181bb66.2Hh9UrgF9n3vN3ZVif3FKqyz4F9mFROKhyLIEflEvDY+ hash: v1.k794b7964.57c582d5224e7a3008ca82becdcb0b7108d54df64a341aa2f66927f193534a02.aLr9rbd8XdUYtM06IQBvu_3ylrHYi6RoR4FYZ1f8Dngscenes-app-insights-side-panel-actions--saved-data-visualization--light:- hash: v1.k794b7964.b2284d70e408723520169087ec7e1fe035feb374a854e737de7eb79c43aa39fc.jeFjd9ZtkbDwsQwQXGXkfabL6oCdNbFqWrqHcQAS0Jw+ hash: v1.k794b7964.2042476ecd2ee70f51405e876669b9fa9002a1ead8cc5d9d2060311dd6fce77e.7x99Scpof55eY7Hy80Ysru6pVpsQ7dWGSXuHPT2p0dsscenes-app-insights-side-panel-actions--saved-hog-ql-data-table--dark:- hash: v1.k794b7964.dd73871a7578a0735c6678305046c9c7482e5ab4db83df4ae24b4fed4a8071b0.znK2ZmIRBpBNi0THeBH4RHAIEasVqp8RpGqIpARFVMI+ hash: v1.k794b7964.57c582d5224e7a3008ca82becdcb0b7108d54df64a341aa2f66927f193534a02.dhUGWzrtjNWIv8nOf6CXONIGwOlccEORvs-KP979hz8scenes-app-insights-side-panel-actions--saved-hog-ql-data-table--light:- hash: v1.k794b7964.5b4c6ba0ac07ba8ea0dc4d24a980821992ee75f62b2f885972e5d332394bed34.PnQhji05di1PUTIp8bvdzvWMfEmF0FfC_K5lAZiLAEE+ hash: v1.k794b7964.2042476ecd2ee70f51405e876669b9fa9002a1ead8cc5d9d2060311dd6fce77e.EqStq-QS115jPsfkh2v5r6jgRS0aEHABbQYlZXYQfL4scenes-app-insights-side-panel-actions--saved-trends-insight--dark:- hash: v1.k794b7964.ca6aa0fcb43fabbc163a118cf47e12896792ac27c8542bb890706af614585139.GPsdx7U3h4XJeGs6zR-vu0RoNJ5leYxmJzDNcnbXd2Q+ hash: v1.k794b7964.81ac823906c74b539ba91aa8559359f792eb4ecac79587197a9b9abb4c41398d.jgQVJsTRH-yuIz9n-T1S4mSxLpae46HW_wQnI1W52E4scenes-app-insights-side-panel-actions--saved-trends-insight--light:- hash: v1.k794b7964.9d8c30bf0435f2dfe5886e044189addac343e59d7b9313841638c9e20b5feb1c.bBKHprQ8HyoXQT8MqlC0Q2dtNUvr_np2UFJ-mMEYoJg+ hash: v1.k794b7964.ce2d168909f96fe12fd11051742903a6c0c34f8a2b91e24e17bee321aa7797a3.2AvlfM2Mba4CeMY1u-BZvSgG0WR9Mw1TXZD6SnqI0Y0scenes-app-insights-side-panel-actions--unsaved-insight--dark:- hash: v1.k794b7964.27e7bb90a746914ab15ebdf82e5353bc54017d8d40c6c985acd836b3bfb068ae.ubmfp9aIuKwIOUk_KfFdd7bkRuv77pjb2nA13vH3fQo+ hash: v1.k794b7964.fd37c04636d22a4bd420750e3eb007eeb90eaeb615c73543513fc8bf093ed049.e38Xtlvpj0vSHJNNkprn94CRhpPWmkEtICoHM0C0IqEscenes-app-insights-side-panel-actions--unsaved-insight--light:- hash: v1.k794b7964.4d578bbdfaa1fc1273607e926b15daaffed027ec89dbfad45179410e7a208f6c.hjlOrgS-_brH3WWYD3R8RwnkJs2dmmiNFToArpB2bUc+ hash: v1.k794b7964.d1ae4193c6ddd6ec8ec70b8181cd1fa1e33cfa0728d586423355601166b2e8b2.GFGdmioAb_Lqr7qiZik9jLMbbO6yC4abdURWyrSNeOsscenes-app-insights-sqlboxplot--edit-options--dark:hash: v1.k794b7964.c382f58d52e0fa3cc8645c6c96a13cf39b2c75d7b19dc51b3a0e6192b41bc661.HxfPSO71QtL5TibSeSjUpFdhx5_LA15uyWLzDRrYX-Qscenes-app-insights-sqlboxplot--edit-options--light:diff --git a/frontend/src/lib/components/Scenes/InsightSubscribeProminentButton.tsx b/frontend/src/lib/components/Scenes/InsightSubscribeProminentButton.tsxindex 3f191729267b..6ad6cc03d382 100644--- a/frontend/src/lib/components/Scenes/InsightSubscribeProminentButton.tsx+++ b/frontend/src/lib/components/Scenes/InsightSubscribeProminentButton.tsx@@ -15,9 +15,8 @@ import {DropdownMenuTrigger,} from 'lib/ui/DropdownMenu/DropdownMenu'import { urls } from 'scenes/urls'-import { userLogic } from 'scenes/userLogic'-import { AvailableFeature, InsightShortId } from '~/types'+import { InsightShortId } from '~/types'import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'import { urlForSubscriptions } from 'products/subscriptions/frontend/components/Subscriptions/utils'@@ -28,15 +27,8 @@ interface InsightSubscribeProminentButtonProps {}function SubscribeIcon({ insightShortId }: { insightShortId: InsightShortId }): JSX.Element {- const { hasAvailableFeature } = useValues(userLogic)const { subscriptions } = useValues(subscriptionsLogic({ insightShortId }))- // Mirror the side-panel SceneSubscribeButton: show the active-subscription count badge so- // the header button carries the same "you're already subscribed" signal.- if (!hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS)) {- return <IconBell />- }-return (<IconWithCount count={subscriptions?.length} showZero={false}><IconBell />diff --git a/frontend/src/lib/components/Scenes/SceneAlertsButton.tsx b/frontend/src/lib/components/Scenes/SceneAlertsButton.tsxdeleted file mode 100644index 0f28d941b094..000000000000--- a/frontend/src/lib/components/Scenes/SceneAlertsButton.tsx+++ /dev/null@@ -1,48 +0,0 @@-import { useActions, useValues } from 'kea'-import { router } from 'kea-router'--import { IconWarning } from '@posthog/icons'--import { IconWithCount } from 'lib/lemon-ui/icons/icons'-import { ButtonPrimitive, DisabledReasonsObject } from 'lib/ui/Button/ButtonPrimitives'-import { urls } from 'scenes/urls'--import { InsightLogicProps, InsightShortId } from '~/types'--import { insightAlertsLogic } from 'products/alerts/frontend/logic/insightAlertsLogic'--import { SceneDataAttrKeyProps } from './utils'--interface SceneAlertsButtonProps extends SceneDataAttrKeyProps {- insightId: number- insightShortId: InsightShortId- insightLogicProps: InsightLogicProps- disabledReasons?: DisabledReasonsObject-}--export function SceneAlertsButton({- disabledReasons,- dataAttrKey,- insightId,- insightShortId,- insightLogicProps,-}: SceneAlertsButtonProps): JSX.Element {- const { push } = useActions(router)-- const logic = insightAlertsLogic({ insightId, insightLogicProps })- const { alerts } = useValues(logic)-- return (- <ButtonPrimitive- menuItem- onClick={() => push(urls.insightAlerts(insightShortId))}- data-attr={`${dataAttrKey}-alerts-dropdown-menu-item`}- disabledReasons={disabledReasons}- >- <IconWithCount count={alerts?.length} showZero={false}>- <IconWarning />- </IconWithCount>- Alerts- </ButtonPrimitive>- )-}diff --git a/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsx b/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsxdeleted file mode 100644index 13e679d420a5..000000000000--- a/frontend/src/lib/components/Scenes/SceneSubscribeButton.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { useActions, useValues } from 'kea'-import { router } from 'kea-router'--import { IconBell } from '@posthog/icons'--import { IconWithCount } from 'lib/lemon-ui/icons/icons'-import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'-import { userLogic } from 'scenes/userLogic'--import { AvailableFeature, InsightShortId, InsightModel } from '~/types'--import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'-import {- SubscriptionBaseProps,- urlForSubscriptions,-} from 'products/subscriptions/frontend/components/Subscriptions/utils'--import { SceneDataAttrKeyProps } from './utils'--interface SceneSubscribeButtonProps extends SubscriptionBaseProps, SceneDataAttrKeyProps {- insight?: Partial<InsightModel>- dashboardId?: number-}--function SubscribeIconWithCount({- insightShortId,- dashboardId,-}: {- insightShortId?: InsightShortId- dashboardId?: number-}): JSX.Element {- const { subscriptions } = useValues(subscriptionsLogic({ insightShortId, dashboardId }))- return (- <IconWithCount count={subscriptions?.length} showZero={false}>- <IconBell />- </IconWithCount>- )-}--export function SceneSubscribeButton({- dataAttrKey,- insight,- dashboardId,- disabledReasons,-}: SceneSubscribeButtonProps): JSX.Element {- const { push } = useActions(router)- const { hasAvailableFeature } = useValues(userLogic)- const hasSubscriptionsFeature = hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS)-- return (- <ButtonPrimitive- menuItem- onClick={() => {- push(urlForSubscriptions({ insightShortId: insight?.short_id, dashboardId }))- }}- data-attr={`${dataAttrKey}-subscribe-dropdown-menu-item`}- disabledReasons={disabledReasons}- >- {hasSubscriptionsFeature ? (- <SubscribeIconWithCount insightShortId={insight?.short_id} dashboardId={dashboardId} />- ) : (- <IconBell />- )}- Subscribe- </ButtonPrimitive>- )-}diff --git a/frontend/src/scenes/dashboard/DashboardScenePanel.tsx b/frontend/src/scenes/dashboard/DashboardScenePanel.tsxindex 6e8251ba6cd9..e3a35c858135 100644--- a/frontend/src/scenes/dashboard/DashboardScenePanel.tsx+++ b/frontend/src/scenes/dashboard/DashboardScenePanel.tsx@@ -9,7 +9,6 @@ import { SceneDuplicate } from 'lib/components/Scenes/SceneDuplicate'import { SceneFile } from 'lib/components/Scenes/SceneFile'import { SceneFullscreen } from 'lib/components/Scenes/SceneFullscreen'import { SceneMetalyticsSummaryButton } from 'lib/components/Scenes/SceneMetalyticsSummaryButton'-import { SceneSubscribeButton } from 'lib/components/Scenes/SceneSubscribeButton'import { SceneTags } from 'lib/components/Scenes/SceneTags'import { SceneActivityIndicator } from 'lib/components/Scenes/SceneUpdateActivityInfo'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'@@ -131,9 +130,6 @@ export function DashboardScenePanel(): JSX.Element | null {<IconNotebook />Create notebook from dashboard</ButtonPrimitive>- {tiles.length > 0 && (- <SceneSubscribeButton dashboardId={dashboard.id} dataAttrKey={RESOURCE_TYPE} />- )}<SceneExportDropdownMenudropdownMenuItems={[{diff --git a/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx b/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsxindex fc807521b310..b6b442f99b52 100644--- a/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx+++ b/frontend/src/scenes/dashboard/DashboardSubscribeButton.tsx@@ -8,9 +8,6 @@ import { IconBell } from '@posthog/icons'import { IconWithCount } from 'lib/lemon-ui/icons/icons'import { LemonButton } from 'lib/lemon-ui/LemonButton'-import { userLogic } from 'scenes/userLogic'--import { AvailableFeature } from '~/types'import { subscriptionsLogic } from 'products/subscriptions/frontend/components/Subscriptions/subscriptionsLogic'import { urlForSubscriptions } from 'products/subscriptions/frontend/components/Subscriptions/utils'@@ -28,9 +25,7 @@ function SubscribeCountIcon({ dashboardId }: { dashboardId: number }): JSX.Eleme}function SubscribeIcon({ dashboardId }: { dashboardId: number }): JSX.Element {- const { hasAvailableFeature } = useValues(userLogic)-- if (!hasAvailableFeature(AvailableFeature.SUBSCRIPTIONS) || !subscriptionsLogic.isMounted({ dashboardId })) {+ if (!subscriptionsLogic.isMounted({ dashboardId })) {return <IconBell className="DashboardSubscribeBell" fontSize="16" />}diff --git a/frontend/src/scenes/insights/SidePanel/InsightPanelActions.tsx b/frontend/src/scenes/insights/SidePanel/InsightPanelActions.tsxindex 1b1f46ed8111..65c9bc30f39d 100644--- a/frontend/src/scenes/insights/SidePanel/InsightPanelActions.tsx+++ b/frontend/src/scenes/insights/SidePanel/InsightPanelActions.tsx@@ -9,12 +9,10 @@ import { SceneAddToDashboardButton } from 'lib/components/Scenes/InsightOrDashboimport { SceneAddToNotebookDropdownMenu } from 'lib/components/Scenes/InsightOrDashboard/SceneAddToNotebookDropdownMenu'import { SceneCopyImageButton } from 'lib/components/Scenes/InsightOrDashboard/SceneCopyImageButton'import { SceneExportDropdownMenu } from 'lib/components/Scenes/InsightOrDashboard/SceneExportDropdownMenu'-import { SceneAlertsButton } from 'lib/components/Scenes/SceneAlertsButton'import { SceneDuplicate } from 'lib/components/Scenes/SceneDuplicate'import { SceneFavorite } from 'lib/components/Scenes/SceneFavorite'import { SceneMetalyticsSummaryButton } from 'lib/components/Scenes/SceneMetalyticsSummaryButton'import { SceneShareButton } from 'lib/components/Scenes/SceneShareButton'-import { SceneSubscribeButton } from 'lib/components/Scenes/SceneSubscribeButton'import { Link } from 'lib/lemon-ui/Link'import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'import { getAccessControlDisabledReason } from 'lib/utils/accessControlUtils'@@ -33,14 +31,7 @@ import {isHogQLQuery,isInsightVizNode,} from '~/queries/utils'-import {- AccessControlLevel,- AccessControlResourceType,- ExporterFormat,- InsightLogicProps,- InsightShortId,- InsightModel,-} from '~/types'+import { AccessControlLevel, AccessControlResourceType, ExporterFormat, InsightLogicProps, InsightModel } from '~/types'import { metricsLogic } from 'products/data_catalog/frontend/metricsLogic'import { endpointLogic } from 'products/endpoints/frontend/endpointLogic'@@ -152,24 +143,6 @@ export function InsightPanelActions({ insightLogicProps }: { insightLogicProps:}/>- <SceneSubscribeButton- insight={insight}- dataAttrKey={RESOURCE_TYPE}- disabledReasons={- !isSavedInsight ? { 'You must save the insight first before subscribing to it': true } : undefined- }- />-- <SceneAlertsButton- insightId={insight.id!}- insightShortId={insight.short_id as InsightShortId}- insightLogicProps={insightLogicProps}- dataAttrKey={RESOURCE_TYPE}- disabledReasons={- !isSavedInsight ? { 'You must save the insight first before adding alerts to it': true } : undefined- }- />-<SceneShareButtonbuttonProps={{menuItem: true,diff --git a/playwright/e2e/product-analytics/insights/insight-side-panel.spec.ts b/playwright/e2e/product-analytics/insights/insight-side-panel.spec.tsindex 75c4054a67aa..c86d7cd62ec8 100644--- a/playwright/e2e/product-analytics/insights/insight-side-panel.spec.ts+++ b/playwright/e2e/product-analytics/insights/insight-side-panel.spec.ts@@ -141,16 +141,14 @@ test.describe('Insight side panel actions', () => {})})- test('Open subscriptions modal from side panel', async ({ page }) => {- const insight = new InsightPage(page)-+ test('Open subscriptions modal from insight header', async ({ page }) => {await test.step('navigate to seeded insight', async () => {await page.goto(insightUrl)})- await test.step('click subscribe and verify subscriptions modal opens', async () => {- await insight.openInfoPanel()- await page.getByTestId('insight-subscribe-dropdown-menu-item').click()+ await test.step('click Monitor and open subscriptions', async () => {+ await page.getByTestId('insight-notify-prominent-button').click()+ await page.getByRole('menuitem', { name: /Subscriptions/ }).click()const modal = page.getByTestId('insight-subscriptions-modal')await expect(modal).toBeVisible()})