: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
feat(data-catalog): explain the metric lifecycle with a stage strip (#123949)
Sinan Kucukkoselera29c7105a686
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 1c19ca7af75d..ee21cf677e5a 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2968,6 +2968,14 @@ snapshots:hash: v1.k794b7964.7e808d1acde79b48d8f6c2d7139a9a11e2c33e0579b69636176f4f3b06f0fd94.4U7X0_N-c7UsfP55hsEDM_-nKHMzZYtNczPj2K5penIcustomer-analytics-task-digest--tasks-modal--light:hash: v1.k794b7964.d699105ed3649edc2776b326c0b8417aaf3d6b22573537c1812e5cee2917f13a.yH78vgMSeg2K_yuHa4ej4U_5g6atJd_s4pbbMFhbVlA+ data-catalog-catalog-explainer--open--dark:+ hash: v1.k794b7964.0ad2a530a9ad1afe591806ee3cc1afeb3cc69f57d384364a8aaa60d4ac0261ea.mgTnoEIYKH7Gg9M-J0Wz0urJ1KCy-5kheFE40XythUo+ data-catalog-catalog-explainer--open--light:+ hash: v1.k794b7964.a0a5deaa54fe14ca1ef17a6b8031d3b4922743380d4f0c2cc07d96367878b17b.sJoIZE3EzWU-pfsMzHrmpfxfxIipxsHFH2kf9d2VzZ4+ data-catalog-lifecycle-strip--drifted-selected--dark:+ hash: v1.k794b7964.0374c7974dec7e4856f35cc96eb4b5581f6fbd90c60e2141b7f91b6251f4db5d.zFGMI4Evxi3Bq17XxaBxRQhfhr1bkSVt5IxYnDtTOw0+ data-catalog-lifecycle-strip--drifted-selected--light:+ hash: v1.k794b7964.ffe0d2155bc7ca77f345984218ce641ca9747fb40a6bdc65f8cbb2073785986c.XDE9QK2mEGIFM5M9sDeqXJVE4B3S8B8nk_q3Re6rYgwdata-catalog-metric-run-result-cell--long-values-collapse--dark:hash: v1.k794b7964.dc188a898119faa5dc90aabb8b42f172657e8d18604c5cb4dfecd77f33dcca14.OkK0G4Kc9D5flwW3eKJ24FBFZcaNd7oEQUHyqqLXtqYdata-catalog-metric-run-result-cell--long-values-collapse--light:diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 9e7d0a6bb537..b28dbf66dc06 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -301,6 +301,7 @@ export const FEATURE_FLAGS = {DASHBOARD_EXPORT_NUDGE: 'dashboard-export-nudge', // owner: #team-analytics-platform multivariate=control,test, nudges people who just exported a dashboard toward a recurring subscriptionDASHBOARD_LAYOUT_DISCARD_PROMPT: 'dashboard-layout-discard-prompt', // owner: @cory.s #team-analytics-platformDASHBOARD_TILE_GROUP_SECTIONS: 'dashboard-tile-group-sections', // owner: @pauldambra #team-analytics-platform, shows tile groups as bands that open and close+ DATA_CATALOG_REVIEW_QUEUE: 'data-catalog-review-queue', // owner: #team-data-modeling, gates the data catalog lifecycle strip and review queueDATA_MODELING_USAGE: 'data-modeling-usage', // owner: #team-data-modeling, gates the Models usage tabDATA_WAREHOUSE_CUSTOM_SOURCE_AI_BUILDER: 'dwh-custom-source-ai-builder', // owner: #team-warehouse-sourcesDATA_WAREHOUSE_CUSTOM_SOURCE_OAUTH2: 'dwh-custom-source-oauth2', // owner: #team-warehouse-sourcesdiff --git a/products/data_catalog/frontend/DataCatalogScene.tsx b/products/data_catalog/frontend/DataCatalogScene.tsxindex a6cdc0e56ee7..c56fd6b1c735 100644--- a/products/data_catalog/frontend/DataCatalogScene.tsx+++ b/products/data_catalog/frontend/DataCatalogScene.tsx@@ -84,7 +84,7 @@ export function DataCatalogScene(): JSX.Element {<SceneContent><SceneTitleSectionname="Data catalog"- description="Review and manage governed metrics, certifications, and relationships for your data."+ description="Define each metric once. PostHog AI and agents compute it from the definition you approve here."resourceType={{ type: 'data_warehouse' }}actions={todayRailNav ? (diff --git a/products/data_catalog/frontend/catalogExplainerLogic.test.ts b/products/data_catalog/frontend/catalogExplainerLogic.test.tsnew file mode 100644index 000000000000..9be218748f66--- /dev/null+++ b/products/data_catalog/frontend/catalogExplainerLogic.test.ts@@ -0,0 +1,35 @@+import { MOCK_DEFAULT_USER } from 'lib/api.mock'++import { userLogic } from 'scenes/userLogic'++import { initKeaTests } from '~/test/init'+import { expectLogic } from '~/test/keaTestUtils'++import { EXPLAINER_DISMISSED_KEY, catalogExplainerLogic } from './catalogExplainerLogic'++describe('catalogExplainerLogic', () => {+ let logic: ReturnType<typeof catalogExplainerLogic.build>++ beforeEach(() => {+ initKeaTests()+ logic = catalogExplainerLogic()+ logic.mount()+ })++ it('hides the explainer at once on dismiss and stores the dismissal on the user', async () => {+ expect(logic.values.explainerDismissed).toBe(false)++ await expectLogic(logic, () => logic.actions.dismissExplainer())+ .toDispatchActions([userLogic.actionCreators.updateHasSeenProductIntroFor(EXPLAINER_DISMISSED_KEY)])+ .toMatchValues({ explainerDismissed: true })+ })++ it('stays hidden for a user who dismissed it before', () => {+ userLogic.actions.loadUserSuccess({+ ...MOCK_DEFAULT_USER,+ has_seen_product_intro_for: { [EXPLAINER_DISMISSED_KEY]: true },+ })++ expect(logic.values.explainerDismissed).toBe(true)+ })+})diff --git a/products/data_catalog/frontend/catalogExplainerLogic.ts b/products/data_catalog/frontend/catalogExplainerLogic.tsnew file mode 100644index 000000000000..df13d0ede50f--- /dev/null+++ b/products/data_catalog/frontend/catalogExplainerLogic.ts@@ -0,0 +1,96 @@+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'+import posthog from 'posthog-js'++import { userLogic } from 'scenes/userLogic'++import { UserType } from '~/types'++// pinned: localStorage key, renaming it reopens the explainer for everyone who closed it+const EXPLAINER_OPEN_STORAGE_KEY = 'data_catalog_explainer_open'++// pinned: key in the user's server-side `has_seen_product_intro_for`, renaming it brings the explainer+// back for everyone who dismissed it+export const EXPLAINER_DISMISSED_KEY = 'data_catalog_explainer'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface catalogExplainerLogicValues {+ user: UserType | null // userLogic+ dismissedLocally: boolean+ explainerDismissed: boolean+ explainerOpen: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface catalogExplainerLogicActions {+ updateHasSeenProductIntroFor: (+ productKey: string,+ value?: boolean | undefined+ ) => {+ productKey: string+ value: boolean+ } // userLogic+ dismissExplainer: () => {+ value: true+ }+ setExplainerOpen: (open: boolean) => {+ open: boolean+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface catalogExplainerLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ explainerDismissed: (dismissedLocally: boolean, user: UserType | null) => boolean+ }+}++export type catalogExplainerLogicType = MakeLogicType<+ catalogExplainerLogicValues,+ catalogExplainerLogicActions,+ Record<string, any>,+ catalogExplainerLogicMeta+>++export const catalogExplainerLogic = kea<catalogExplainerLogicType>([+ path(['products', 'data_catalog', 'frontend', 'catalogExplainerLogic']),+ connect(() => ({+ values: [userLogic, ['user']],+ actions: [userLogic, ['updateHasSeenProductIntroFor']],+ })),+ actions({+ setExplainerOpen: (open: boolean) => ({ open }),+ dismissExplainer: true,+ }),+ reducers({+ explainerOpen: [+ true,+ { persist: true, storageKey: EXPLAINER_OPEN_STORAGE_KEY },+ {+ setExplainerOpen: (_, { open }) => open,+ },+ ],+ // Hides the explainer at once; the user record confirms the dismissal after it reloads.+ dismissedLocally: [+ false,+ {+ dismissExplainer: () => true,+ },+ ],+ }),+ selectors({+ explainerDismissed: [+ (s) => [s.dismissedLocally, s.user],+ (dismissedLocally: boolean, user: UserType | null): boolean =>+ dismissedLocally || !!user?.has_seen_product_intro_for?.[EXPLAINER_DISMISSED_KEY],+ ],+ }),+ listeners(({ actions }) => ({+ setExplainerOpen: ({ open }) => {+ posthog.capture('data catalog explainer toggled', { open })+ },+ dismissExplainer: () => {+ actions.updateHasSeenProductIntroFor(EXPLAINER_DISMISSED_KEY)+ posthog.capture('data catalog explainer dismissed')+ },+ })),+])diff --git a/products/data_catalog/frontend/components/CatalogExplainer.stories.tsx b/products/data_catalog/frontend/components/CatalogExplainer.stories.tsxnew file mode 100644index 000000000000..529245ce7257--- /dev/null+++ b/products/data_catalog/frontend/components/CatalogExplainer.stories.tsx@@ -0,0 +1,17 @@+import type { Meta, StoryObj } from '@storybook/react'++import { CatalogExplainer } from './CatalogExplainer'++const meta: Meta<typeof CatalogExplainer> = {+ title: 'Data catalog/Catalog explainer',+ component: CatalogExplainer,+ parameters: { viewMode: 'story' },+ render: () => (+ <div className="@container w-240 p-4">+ <CatalogExplainer />+ </div>+ ),+}+export default meta++export const Open: StoryObj<typeof CatalogExplainer> = {}diff --git a/products/data_catalog/frontend/components/CatalogExplainer.tsx b/products/data_catalog/frontend/components/CatalogExplainer.tsxnew file mode 100644index 000000000000..bca486ffc0fa--- /dev/null+++ b/products/data_catalog/frontend/components/CatalogExplainer.tsx@@ -0,0 +1,84 @@+import { useActions, useValues } from 'kea'++import * as stampApprovedPng from '@posthog/brand/hoggies/png/stamp-approved'+import { IconBook, IconInfo, IconX } from '@posthog/icons'++import { pngHoggie } from 'lib/brand/hoggies'+import { LemonCollapse } from 'lib/lemon-ui/LemonCollapse'++import { catalogExplainerLogic } from '../catalogExplainerLogic'++const EXPLAINER_PANEL_KEY = 'how-it-works'++const HedgehogStampApproved = pngHoggie(stampApprovedPng)++const STEPS = [+ 'Add the metrics you and your team care about, like revenue or active users.',+ 'Approve the definition, so it becomes the one your team uses.',+ 'From then on, PostHog AI and every agent compute it from that definition.',+]++export function CatalogExplainer(): JSX.Element | null {+ const { explainerOpen, explainerDismissed } = useValues(catalogExplainerLogic)+ const { setExplainerOpen, dismissExplainer } = useActions(catalogExplainerLogic)++ if (explainerDismissed) {+ return null+ }++ return (+ // The data catalog's product color, swapped for its dark variant in dark mode.+ <LemonCollapse+ className="[--catalog-accent:var(--color-product-data-catalog-light)] dark:[--catalog-accent:var(--color-product-data-catalog-dark)] border-[color-mix(in_srgb,var(--catalog-accent)_35%,transparent)]"+ activeKey={explainerOpen ? EXPLAINER_PANEL_KEY : null}+ onChange={(activeKey) => setExplainerOpen(activeKey === EXPLAINER_PANEL_KEY)}+ panels={[+ {+ key: EXPLAINER_PANEL_KEY,+ header: {+ children: (+ <span className="flex items-center gap-2">+ <IconBook className="size-4 text-[var(--catalog-accent)]" />+ One definition for every metric+ </span>+ ),+ sideAction: {+ icon: <IconX />,+ tooltip: "Don't show this again",+ 'aria-label': "Don't show this again",+ onClick: dismissExplainer,+ // pinned: data-attr values feed autocapture dashboards+ 'data-attr': 'data-catalog-explainer-dismiss',+ },+ },+ dataAttr: 'data-catalog-explainer',+ bodyClassName: 'bg-[color-mix(in_srgb,var(--catalog-accent)_6%,var(--color-bg-surface-primary))]',+ content: (+ <div className="flex items-center gap-4">+ <div className="flex flex-col gap-2 text-sm flex-1 min-w-0">+ <ol className="flex flex-wrap gap-x-6 gap-y-2 list-none p-0 m-0">+ {STEPS.map((step, index) => (+ <li key={step} className="flex gap-2 flex-1 min-w-48">+ <span className="shrink-0 size-5 rounded-full bg-[var(--catalog-accent)] text-white flex items-center justify-center text-xs font-semibold">+ {index + 1}+ </span>+ <span>{step}</span>+ </li>+ ))}+ </ol>+ <div className="mt-2 flex items-start gap-2 text-secondary">+ <IconInfo className="size-4 shrink-0 mt-0.5" />+ <span>+ Agents can also use proposed and drifted metrics after evaluating their content.+ Users will see a warning alongside the answer.+ </span>+ </div>+ </div>+ <HedgehogStampApproved className="hidden @3xl:block size-20 shrink-0" />+ </div>+ ),+ },+ ]}+ />+ )+}diff --git a/products/data_catalog/frontend/components/LifecycleStrip.stories.tsx b/products/data_catalog/frontend/components/LifecycleStrip.stories.tsxnew file mode 100644index 000000000000..eed4841754da--- /dev/null+++ b/products/data_catalog/frontend/components/LifecycleStrip.stories.tsx@@ -0,0 +1,20 @@+import type { Meta, StoryObj } from '@storybook/react'++import { LifecycleStrip } from './LifecycleStrip'++const meta: Meta<typeof LifecycleStrip> = {+ title: 'Data catalog/Lifecycle strip',+ component: LifecycleStrip,+ parameters: { viewMode: 'story' },+ render: (props) => (+ // A fixed width keeps the wrap point, and so the baseline, the same on every run.+ <div className="@container w-240 p-4">+ <LifecycleStrip {...props} />+ </div>+ ),+}+export default meta++export const DriftedSelected: StoryObj<typeof LifecycleStrip> = {+ args: { counts: { proposed: 7, approved: 42, drifted: 2 }, status: 'drifted', onToggle: () => {} },+}diff --git a/products/data_catalog/frontend/components/LifecycleStrip.tsx b/products/data_catalog/frontend/components/LifecycleStrip.tsxnew file mode 100644index 000000000000..50e443d3b3b4--- /dev/null+++ b/products/data_catalog/frontend/components/LifecycleStrip.tsx@@ -0,0 +1,78 @@+import { IconArrowRight } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import type { MetricStage, MetricStageCounts, MetricStatusFilter } from '../metricsLogic'++interface StageCardProps {+ stage: MetricStage+ title: string+ description: string+ count: number+ selected: boolean+ onToggle: (stage: MetricStage) => void+}++function StageCard({ stage, title, description, count, selected, onToggle }: StageCardProps): JSX.Element {+ return (+ <LemonButton+ type="secondary"+ active={selected}+ aria-pressed={selected}+ className="flex-1 min-w-48"+ fullWidth+ onClick={() => onToggle(stage)}+ // pinned: data-attr values feed autocapture dashboards+ data-attr={`data-catalog-stage-${stage}`}+ >+ <div className="flex flex-col gap-1 py-1 text-left font-normal">+ <div className="flex items-baseline gap-2">+ <span className="font-semibold">{title}</span>+ <span className={`text-xl font-semibold ${stage === 'drifted' && count > 0 ? 'text-danger' : ''}`}>+ {count}+ </span>+ </div>+ <span className="text-xs text-secondary">{description}</span>+ </div>+ </LemonButton>+ )+}++export interface LifecycleStripProps {+ counts: MetricStageCounts+ status: MetricStatusFilter+ onToggle: (stage: MetricStage) => void+}++export function LifecycleStrip({ counts, status, onToggle }: LifecycleStripProps): JSX.Element {+ return (+ <div className="flex flex-wrap items-stretch gap-2" data-attr="data-catalog-lifecycle-strip">+ <StageCard+ stage="proposed"+ title="Proposed"+ description="Waiting for review. Agents can use it, with a warning."+ count={counts.proposed}+ selected={status === 'proposed'}+ onToggle={onToggle}+ />+ <IconArrowRight className="text-secondary shrink-0 self-center" />+ <StageCard+ stage="approved"+ title="Approved"+ description="Reviewed by your team. Agents compute it from this definition."+ count={counts.approved}+ selected={status === 'approved'}+ onToggle={onToggle}+ />+ {/* Drift is a fault state, not a step after approval, so it stands apart from the flow. */}+ <div className="hidden @2xl:block self-stretch mx-1 border-l border-primary" />+ <StageCard+ stage="drifted"+ title="Drifted"+ description="The source insight changed or was deleted after this metric was saved. Agents use it with a warning."+ count={counts.drifted}+ selected={status === 'drifted'}+ onToggle={onToggle}+ />+ </div>+ )+}diff --git a/products/data_catalog/frontend/metricsLogic.test.ts b/products/data_catalog/frontend/metricsLogic.test.tsindex f57c88d1f126..b4b1c9637d67 100644--- a/products/data_catalog/frontend/metricsLogic.test.ts+++ b/products/data_catalog/frontend/metricsLogic.test.ts@@ -256,6 +256,37 @@ describe('metricsLogic', () => {expect(logic.values.metrics.map((metric) => metric.name)).toEqual(['b'])})+ it('filters to drifted metrics of any status from the stage strip, reports one event per click, and resets on a second click', async () => {+ const proposed = buildMetric({ id: 'metric-1', name: 'proposed' })+ const approvedDrifted = buildMetric({+ id: 'metric-2',+ name: 'approved_drifted',+ status: 'approved',+ is_drifted: true,+ })+ const approved = buildMetric({ id: 'metric-3', name: 'approved', status: 'approved' })+ logic.actions.loadMetricsSuccess([proposed, approvedDrifted, approved])++ expect(logic.values.stageCounts).toEqual({ proposed: 1, approved: 2, drifted: 1 })++ const capture = jest.spyOn(posthog, 'capture').mockImplementation()+ jest.useFakeTimers({ doNotFake: ['queueMicrotask', 'nextTick'] })+ try {+ logic.actions.toggleStage('drifted')+ expect(logic.values.metrics).toEqual([approvedDrifted])++ await jest.advanceTimersByTimeAsync(500)+ expect(capture.mock.calls.map(([event]) => event)).toEqual(['data catalog stage card clicked'])+ } finally {+ jest.useRealTimers()+ capture.mockRestore()+ }++ logic.actions.toggleStage('drifted')+ expect(logic.values.filters.status).toEqual('all')+ expect(logic.values.metrics).toEqual([proposed, approvedDrifted, approved])+ })+it('patches approved rows and reloads to reconcile skipped ones', async () => {logic.actions.loadMetricsSuccess([buildMetric({ id: 'metric-1', name: 'first' }),diff --git a/products/data_catalog/frontend/metricsLogic.tsx b/products/data_catalog/frontend/metricsLogic.tsxindex b79b9bad120e..4999270a7858 100644--- a/products/data_catalog/frontend/metricsLogic.tsx+++ b/products/data_catalog/frontend/metricsLogic.tsx@@ -26,7 +26,11 @@ import {import type { DataCatalogMetricApi, DataCatalogMetricBulkSkipApi } from './generated/api.schemas'import { openOverwriteMetricDialog } from './openOverwriteMetricDialog'-export type MetricStatusFilter = 'all' | 'proposed' | 'approved'+export type MetricStage = 'proposed' | 'approved' | 'drifted'++export type MetricStatusFilter = 'all' | MetricStage++export type MetricStageCounts = Record<MetricStage, number>export type BulkMetricAction = 'approve' | 'delete' | 'change_owner'@@ -89,6 +93,7 @@ export interface metricsLogicValues {metrics: DataCatalogMetricApi[]ownerFilterOptions: string[]proposedCount: number+ stageCounts: MetricStageCounts}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -178,6 +183,9 @@ export interface metricsLogicActions {name: stringowner: string | null}+ toggleStage: (stage: MetricStage) => {+ stage: MetricStage+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -186,6 +194,7 @@ export interface metricsLogicMeta {metrics: (allMetrics: DataCatalogMetricApi[], filters: MetricsFilters) => DataCatalogMetricApi[]ownerFilterOptions: (allMetrics: DataCatalogMetricApi[]) => string[]proposedCount: (allMetrics: DataCatalogMetricApi[]) => number+ stageCounts: (allMetrics: DataCatalogMetricApi[]) => MetricStageCounts}}@@ -203,6 +212,7 @@ export const metricsLogic = kea<metricsLogicType>([})),actions({setFilters: (filters: Partial<MetricsFilters>) => ({ filters }),+ toggleStage: (stage: MetricStage) => ({ stage }),setCreatingMetricAs: (creatingAs: MetricSaveAction | null) => ({ creatingAs }),approveMetric: (name: string) => ({ name }),refreshMetricFromInsight: (name: string) => ({ name }),@@ -252,6 +262,8 @@ export const metricsLogic = kea<metricsLogicType>([DEFAULT_METRICS_FILTERS as MetricsFilters,{setFilters: (state, { filters }) => ({ ...state, ...filters }),+ // Set here rather than through setFilters, so a card click reports one event, not two.+ toggleStage: (state, { stage }) => ({ ...state, status: state.status === stage ? 'all' : stage }),},],creatingMetricAs: [@@ -285,7 +297,9 @@ export const metricsLogic = kea<metricsLogicType>([(s) => [s.allMetrics, s.filters],(allMetrics: DataCatalogMetricApi[], filters: MetricsFilters) => {let results = allMetrics- if (filters.status !== 'all') {+ if (filters.status === 'drifted') {+ results = results.filter((metric) => metric.is_drifted)+ } else if (filters.status !== 'all') {results = results.filter((metric) => metric.status === filters.status)}if (filters.createdBy) {@@ -315,8 +329,20 @@ export const metricsLogic = kea<metricsLogicType>([(s) => [s.allMetrics],(allMetrics: DataCatalogMetricApi[]) => allMetrics.filter((metric) => metric.status === 'proposed').length,],+ // Drift is not a status, so a drifted metric counts in its status stage and in the drifted stage.+ stageCounts: [+ (s) => [s.allMetrics],+ (allMetrics: DataCatalogMetricApi[]): MetricStageCounts => ({+ proposed: allMetrics.filter((metric) => metric.status === 'proposed').length,+ approved: allMetrics.filter((metric) => metric.status === 'approved').length,+ drifted: allMetrics.filter((metric) => metric.is_drifted).length,+ }),+ ],}),listeners(({ values, actions }) => ({+ toggleStage: ({ stage }) => {+ posthog.capture('data catalog stage card clicked', { stage, status: values.filters.status })+ },setFilters: async ({ filters }, breakpoint) => {// The search box dispatches on every keystroke, so wait for typing to settle before reporting.await breakpoint(500)diff --git a/products/data_catalog/frontend/tabs/MetricsTab.tsx b/products/data_catalog/frontend/tabs/MetricsTab.tsxindex 9acf76924dfc..a1bdbabca904 100644--- a/products/data_catalog/frontend/tabs/MetricsTab.tsx+++ b/products/data_catalog/frontend/tabs/MetricsTab.tsx@@ -5,6 +5,7 @@ import { IconRefresh } from '@posthog/icons'import { LemonButton, LemonDialog, LemonSelect } from '@posthog/lemon-ui'import { MemberSelect } from 'lib/components/MemberSelect'+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { More } from 'lib/lemon-ui/LemonButton/More'import { LemonInput } from 'lib/lemon-ui/LemonInput'import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'@@ -17,6 +18,8 @@ import { Tooltip } from 'lib/lemon-ui/Tooltip'import { urls } from 'scenes/urls'import { METRIC_BULK_MAX, compareText, humanizeDefinitionKind, metricCount, reportCatalogTableSorted } from '../common'+import { CatalogExplainer } from '../components/CatalogExplainer'+import { LifecycleStrip } from '../components/LifecycleStrip'import { MetricOwnerSelect } from '../components/MetricOwnerSelect'import type { DataCatalogMetricApi } from '../generated/api.schemas'import { BulkMetricAction, MetricStatusFilter, metricsLogic } from '../metricsLogic'@@ -66,10 +69,19 @@ export function MetricsTab(): JSX.Element {// State, not a ref, so the table re-renders once the slot mounts and the bar can portal into it.// The bar portals below the table instead of above it, so selecting a row never shifts the rows.const [bulkBarTarget, setBulkBarTarget] = useState<HTMLDivElement | null>(null)- const { metrics, allMetrics, allMetricsLoading, filters, actionsInFlight, bulkActionInFlight, ownerFilterOptions } =- useValues(metricsLogic)+ const {+ metrics,+ allMetrics,+ allMetricsLoading,+ filters,+ actionsInFlight,+ bulkActionInFlight,+ ownerFilterOptions,+ stageCounts,+ } = useValues(metricsLogic)const {setFilters,+ toggleStage,loadMetrics,approveMetric,refreshMetricFromInsight,@@ -80,6 +92,8 @@ export function MetricsTab(): JSX.Element {bulkChangeMetricOwner,} = useActions(metricsLogic)+ const reviewQueueEnabled = useFeatureFlag('DATA_CATALOG_REVIEW_QUEUE')+const bulkBusyReason = bulkActionInFlight ? 'A bulk action is running' : undefined// Reload replaces the whole list and takes no breakpoint, so a load that resolves after a// mutation would repaint pre-mutation rows (e.g. bring back rows a bulk delete just removed).@@ -252,7 +266,12 @@ export function MetricsTab(): JSX.Element {]return (- <div className="flex flex-col gap-4">+ <div className="@container flex flex-col gap-4">+ {/* The explainer describes agent behavior that ships with the review queue, so it shares its flag. */}+ {reviewQueueEnabled && <CatalogExplainer />}+ {reviewQueueEnabled && (+ <LifecycleStrip counts={stageCounts} status={filters.status} onToggle={toggleStage} />+ )}<div className="flex justify-between gap-2 flex-wrap items-center"><LemonInputtype="search"@@ -281,12 +300,14 @@ export function MetricsTab(): JSX.Element {data-attr="data-catalog-metrics-owner-filter"/></div>- <LemonSegmentedButton- value={filters.status}- onChange={(status) => setFilters({ status })}- options={STATUS_FILTER_OPTIONS}- size="small"- />+ {!reviewQueueEnabled && (+ <LemonSegmentedButton+ value={filters.status}+ onChange={(status) => setFilters({ status })}+ options={STATUS_FILTER_OPTIONS}+ size="small"+ />+ )}<LemonButtontype="secondary"icon={<IconRefresh />}