: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(dashboards): Widget Filters (3/5) (#61749)
Matt Puaf73681de93f9
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 0937572f02d6..ba581ea14ac6 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -1485,33 +1485,37 @@ snapshots:components-verticalnesteddnd--base--light:hash: v1.k794b7964.b210ce352a085f9ed57aed4675cc78d23db5d2312f276ec790040b2ce27e293a.duU6Lgj4ID4h_Qo76s2bErUZYu2IuRIHoy4D7_tCGT4dashboards-dashboard-widgets-overview--all-widget-types--dark:- hash: v1.k794b7964.d8fb73a9d12018dabe304134e94103565a858b3e07b2f8629fee870ab0299d21.3MD1OvLnswqhNYqUY5R1XXeOVqZkGR8Si688strKe6g+ hash: v1.k794b7964.6291f679616a912c2094e61d9e316d0705de8d9ae9223645cf41c459813354a4.fi2ADQ5y2hp5PrFJDVTL7P5r70H1Jy-36_e36EnYLE4dashboards-dashboard-widgets-overview--all-widget-types--light:- hash: v1.k794b7964.c83be8c292d11f14670cbd097912d6d37aa3071e1386152113ba7bcb13166e2a.vFeA7LlQU1EddQ5yACEWeaLfK9HE911ZvL9CUBTUm4Q+ hash: v1.k794b7964.f8aa40d34886eab07d4309b83a42884245600ed9e35e9d9c2ba4f02f9c26da5b.fPTXObVz6IIyi09DiM9bynuxz6Dp91o1V_L4tC00VLw+ dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--default--dark:+ hash: v1.k794b7964.1dca7d9829d631b8cd013d634f56c46488883b12ad5419d9f108f3f434d9c76b.2hKo2ObzPmyWmBD-6e3bFD8qJGQj_yKSEzGZc5hR4nE+ dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--default--light:+ hash: v1.k794b7964.92068de8bdb2211c62f4f7a0cd5717528f8ed4a9e3adf1b9c9d5be58bdf5d138.pMDNaCGXSho4-JybKhQut2pEvdYAmEgi90HQJIMYt0kdashboards-dashboard-widgets-widget-types-error-tracking-top-issues--empty--dark:- hash: v1.k794b7964.37b0f3093591c5d717106e98dc91ca4288d2562cdb240750c1223ae2bce4f8af.K92XY4q1UjFlYZ0DhQ8G02rowmJ7Ed0FxirKIANkTog+ hash: v1.k794b7964.753156ba78ea31cba016557b7f8172cf4ebe57bf63cf738b23be4263562287b1.EF9U84nfeR8wwJiUXwfylYwUVaHqfqlxQyEkyeJKoNodashboards-dashboard-widgets-widget-types-error-tracking-top-issues--empty--light:- hash: v1.k794b7964.6319573b6261dc5806ef63e9765460fa5e49b63d4116eded31491b0d9cab9810.MoYWbJ66y6yiXUNF-4St2zprnYuTj76mxD9xFptTkIk+ hash: v1.k794b7964.53230ae58acc6f98ef9ef9bbd4c18346b2458fe8b2367fcd0f926bf724c57344.2Agmjzgarpu8nhK174awz1r0YUKgH6gekAJVCwLSXnkdashboards-dashboard-widgets-widget-types-error-tracking-top-issues--loading--dark:- hash: v1.k794b7964.35039037025f9bba990032aa2d263730823887ae60825327a5e2d66db1d22d45.YqTpX_cYP6oNt5_bB2VfAjU3oAnxKLZ4Tr2lfGuJg0w+ hash: v1.k794b7964.6335ada7c1cbd1c5d951098d949ee29d773bb84f195c4af0f1eea1b63f4b0ebc.rEl35gV14p2gNMGMGu_yQMYwYZVyLPr3n8ohT-uO5Dgdashboards-dashboard-widgets-widget-types-error-tracking-top-issues--loading--light:- hash: v1.k794b7964.4363c87e0a425bf93e4b83e5d17445a9ef2e0cdff86d09d92eb1e191d765438c.oHuVFS2dJ4GpvncvomHWDobEpXHkT20cYwEMN_whm1Q- dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--populated--dark:- hash: v1.k794b7964.34cf354d8668f81c1ac89a63182f56343d361014bc9c3e3edc21e78066ae5b07.LGwWlcKc4E-NN7Tb82lTuOJiNv4PUYk7dsB4RgyidtY- dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--populated--light:- hash: v1.k794b7964.9ac89b285dc709636e31f6fa6942b0151b874278189c30d19bdf0311841f9ee8.C_vKATvIuNwX0JzOtWOD6L7qHWUo4_FyRI7NAOB15rA+ hash: v1.k794b7964.ee8d84dbf71b16ee09adc980899f018480e31c8a6c1d07dc523cfc263ff5c484.61dMOLhRLGOGW_JJGOUnKKgjAuxMVEEVpIrXlR2ECi8dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--setup-unavailable--dark:- hash: v1.k794b7964.7d69dce6ed2191849537eb642d3c89ac2236362de6063c36b330d8539b7fffb9.N2VC2kWXD-FMFINftmH1CnhNzb6araUv6QuurqnkaI8+ hash: v1.k794b7964.9e6167613ff8baf53b485f9de2bc9fe8ef16ac1180fe65bcab0edb18de697462.Vmmcg5aWlr917g_nVaIW5vbcvOfkyIInLZNyd5Q9l34dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--setup-unavailable--light:- hash: v1.k794b7964.cda0999d77941fe029da1ede20fa2e40c547f0d37abe30a64e2cc4a08026b856.eAPTafX6TgM9_po9UU7H_DOmOXNRP7-af5kVLhpxuBI+ hash: v1.k794b7964.e927ed4eef8a615056f108609d2b44b202d1f91bd01e6d17ba9d138286326e77.lN4oJ1oy6y_8-0C5NgpBbw_exg6VZ6ec4YDKKtm8nrc+ dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--tile-filters-read-only--dark:+ hash: v1.k794b7964.2128a53936d74e788f8fc27cef710d0530c16addf5c4be9fb4a827c9e2c33270.V7FHEFRpNgJY9VydtEbVftkZZmetA7NWxKvSjz_6FNY+ dashboards-dashboard-widgets-widget-types-error-tracking-top-issues--tile-filters-read-only--light:+ hash: v1.k794b7964.2a540c1307a08651b29fbd6fe76cb6751e9b9676ede8f0baaaf281de47cd5b13.ApZhYe8gyRlYOuSlzZlHJaM6OSMoBW5klmGIKHDbCUIdashboards-dashboard-widgets-widget-types-error-tracking-top-issues-widget-settings--before-exception-ingestion--dark:hash: v1.k794b7964.7fee57402c47dc068dd42cb5cd535b5d611b2c89303cb3fa8ae80f90b0551138.3hwCq3JyGd-h6_uCJXZLoaokoWDccig176XCclysC6wdashboards-dashboard-widgets-widget-types-error-tracking-top-issues-widget-settings--before-exception-ingestion--light:hash: v1.k794b7964.da76b1c9007b6158780a5e9c73961fc65f090a41dbc7763202a1a8e80fec8ee8.kOJbsAuAQNeMjEFL80QygA49LKlz4uH0OM7OaxswB2kdashboards-dashboard-widgets-widget-types-error-tracking-top-issues-widget-settings--default--dark:- hash: v1.k794b7964.321b3a05b437647379f82a1396417ca3836e3b8324edb45bdc22681f7dc75e64.GGZFGrydw_LpK5CDXm34dVegUKo1vvp6Rjk5vqcfOvs+ hash: v1.k794b7964.aec959497f395afca3960d2ebf4e82e9f6fe72334c825533722a7a369313efe2.09zUcQOLWCd7nAXBzkR6D0wEFuq4DsXAOYjdFvPJqPQdashboards-dashboard-widgets-widget-types-error-tracking-top-issues-widget-settings--default--light:- hash: v1.k794b7964.589ad6d84fdd1cb75c0a4fc17062f7c8223d922f410a787935dce4ebdf5ddd0e.bxVCTsAm5NufSyxv1SecNVFONuo6SGSz2L_Q53-M29g+ hash: v1.k794b7964.af604b406115bf252f107bd8599029b5e34b473e76cac0c368f12228895186ed.xLjKRF0exewyVhp-Zz52PwMmAJbqO6trsSNRtXbzIEYdashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--empty--dark:hash: v1.k794b7964.0889c484f8f0d9ee048083e9fa2fc738841b146b21b8aa3a94a4c1bc872131b2.IMQafZvuzRCegEV39NlJB0NswElKBpcQBYAomG2lg70dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--empty--light:@@ -1529,9 +1533,9 @@ snapshots:dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings--setup-unavailable--light:hash: v1.k794b7964.6fc2668cd7bab46bf06a6bf27c9932197f83602d8a5bc1235ecf113dd39e498d.qB69GwThpUyt3z_aOk6gUZbTj3vJBfXm3gDR7FzuA50dashboards-dashboard-widgets-widget-types-session-replay-recent-recordings-widget-settings--default--dark:- hash: v1.k794b7964.c5434bc55d32b51eac6a19e9c4aa9704662ab4d738ab6c0e27f09f1f80d61ef3.Y4anfV8zrl54px4sfbVRujK5F1DQ5_448DvdY0cps5I+ hash: v1.k794b7964.7a360d33ee768adcdd8eacfa769a936e2363321adc21eaff60683098c29d847c.N0ylw1z2Ul0sGiYOCkdb1ot4ON-BoCRxW7s3lJS0tmQdashboards-dashboard-widgets-widget-types-session-replay-recent-recordings-widget-settings--default--light:- hash: v1.k794b7964.fa606138cd2e3f82ddfad9a9da33f0982699f92c2ce19346b032c26055880a5f._ocZVep957TFyWHeqMQlWkROMOZl4ICfQwqzVyvQ7X8+ hash: v1.k794b7964.b7d9d2ce3520e09307823e43268a6146b27df0cf47fbef8d9a383b9f396ee784.837NbehGBSlkrvdWDWH0ZyZMxaOJQxynzTmQphDuoqYdashboards-dashboard-widgets-widgetcard--dashboard-tile-populated--dark:hash: v1.k794b7964.131c8ca3c5e54927f05d636bbbf578d239f0caaaaa672df4a3d258a95262b360.kaVLXurdYGG4nDiUKmyMr-vNRYapHr8FBVAqqHnzPpIdashboards-dashboard-widgets-widgetcard--dashboard-tile-populated--light:diff --git a/frontend/src/scenes/dashboard/DashboardItems.tsx b/frontend/src/scenes/dashboard/DashboardItems.tsxindex ba727b7b5119..3cb94de201d7 100644--- a/frontend/src/scenes/dashboard/DashboardItems.tsx+++ b/frontend/src/scenes/dashboard/DashboardItems.tsx@@ -65,6 +65,8 @@ export function DashboardItems(): JSX.Element {duplicateTile,refreshDashboardItem,refreshDashboardWidgets,+ scheduleRefreshDashboardWidgets,+ applyWidgetIssueMetadataChange,moveToDashboard,copyToDashboard,setTileOverride,@@ -490,6 +492,7 @@ export function DashboardItems(): JSX.Element {tile={tile}placement={placement}dashboardId={dashboard?.id}+ canEditDashboard={canEditDashboard}result={runResult?.result}error={getDashboardWidgetFetchDisplayError(runResult?.error ?? refreshState?.error@@ -499,6 +502,15 @@ export function DashboardItems(): JSX.Element {onRefresh={() =>refreshDashboardWidgets({ tileIds: [tile.id], forceRefresh: true })}+ onRefreshWidgetData={scheduleRefreshDashboardWidgets}+ onApplyWidgetIssueMetadataChange={(tileId, issueId, delta, context) => {+ applyWidgetIssueMetadataChange({+ tileId,+ issueId,+ delta,+ context,+ })+ }}onUpdateWidgetTile={async (patch) => {await updateWidgetTile({ tile, ...patch })}}diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsxindex ca5e224ee705..b0bf88af5ba4 100644--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx@@ -22,6 +22,11 @@ import { LemonDialog, lemonToast } from '@posthog/lemon-ui'import type { DashboardWidgetRunResultApi } from '@posthog/products-dashboards/frontend/generated/api.schemas'import { isWidgetConfigValidationError, updateDashboardWidgetTile } from '@posthog/products-dashboards/frontend/utils'import { DASHBOARD_WIDGET_FETCH_ERROR_MESSAGE } from '@posthog/products-dashboards/frontend/widgets/constants'+import {+ applyIssueMetadataToWidgetListResult,+ type WidgetIssueMetadataContext,+ type WidgetIssueMetadataDelta,+} from '@posthog/products-dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange'import api, { ApiMethodOptions, getJSONOrNull } from 'lib/api'import { ApiError } from 'lib/api-error'@@ -43,6 +48,7 @@ import {findNewlyAddedWidgetTiles,WIDGET_CLIENT_TTL_MS,} from 'scenes/dashboard/widgetFetchUtils'+import { createDashboardWidgetTileRefreshScheduler } from 'scenes/dashboard/widgetTileRefreshScheduler'import { dataThemeLogic } from 'scenes/dataThemeLogic'import { MaxContextInput, createMaxContextHelpers } from 'scenes/max/maxTypes'import { Scene } from 'scenes/sceneTypes'@@ -262,6 +268,14 @@ export const dashboardLogic = kea<dashboardLogicType>([forceRefresh?: boolean}) => payload,refreshDashboardWidgets: (payload: { tileIds: number[]; forceRefresh?: boolean }) => payload,+ /** Debounced run_widgets refresh for a single tile (tile filters). */+ scheduleRefreshDashboardWidgets: (tileId: number) => ({ tileId }),+ applyWidgetIssueMetadataChange: (payload: {+ tileId: number+ issueId: string+ delta: WidgetIssueMetadataDelta+ context: WidgetIssueMetadataContext+ }) => payload,setWidgetRunResults: (results: Record<number, DashboardWidgetRunResultApi>) => ({ results }),setWidgetRefreshStatuses: (tileIds: number[], loading: boolean, error?: string | null) => ({tileIds,@@ -724,7 +738,7 @@ export const dashboardLogic = kea<dashboardLogicType>([dashboardsModel.actions.updateDashboardSuccess(dashboard)}if (config !== undefined) {- actions.refreshDashboardWidgets({ tileIds: [tile.id], forceRefresh: true })+ actions.scheduleRefreshDashboardWidgets(tile.id)}return null} catch (e) {@@ -1211,6 +1225,25 @@ export const dashboardLogic = kea<dashboardLogicType>([{} as Record<number, DashboardWidgetRunResultApi>,{setWidgetRunResults: (state, { results }) => ({ ...state, ...results }),+ applyWidgetIssueMetadataChange: (state, { tileId, issueId, delta, context }) => {+ const run = state[tileId]+ if (!run?.result || typeof run.result !== 'object') {+ return state+ }+ const nextResult = applyIssueMetadataToWidgetListResult(+ run.result as Parameters<typeof applyIssueMetadataToWidgetListResult>[0],+ issueId,+ delta,+ context+ )+ return {+ ...state,+ [tileId]: {+ ...run,+ result: nextResult,+ },+ }+ },},],widgetRefreshStatus: [@@ -1796,7 +1829,7 @@ export const dashboardLogic = kea<dashboardLogicType>([},],})),- events(({ actions, props, values }) => ({+ events(({ actions, props, values, cache }) => ({afterMount: () => {// NOTE: initial dashboard load is done after variables are loaded in initialVariablesLoadedif (props.id) {@@ -1840,6 +1873,7 @@ export const dashboardLogic = kea<dashboardLogicType>([}},beforeUnmount: () => {+ cache.widgetTileRefreshScheduler?.cancelAll()actions.abortAnyRunningQuery()},})),@@ -1872,6 +1906,14 @@ export const dashboardLogic = kea<dashboardLogicType>([},})),listeners(({ actions, values, cache, props, sharedListeners }) => ({+ scheduleRefreshDashboardWidgets: ({ tileId }: { tileId: number }) => {+ if (!cache.widgetTileRefreshScheduler) {+ cache.widgetTileRefreshScheduler = createDashboardWidgetTileRefreshScheduler((id) =>+ actions.refreshDashboardWidgets({ tileIds: [id], forceRefresh: true })+ )+ }+ cache.widgetTileRefreshScheduler.schedule(tileId)+ },setAddWidgetModalOpen: ({ open }) => {if (open) {actions.clearAddWidgetSelectedTypes()diff --git a/frontend/src/scenes/dashboard/widgetTileRefreshScheduler.ts b/frontend/src/scenes/dashboard/widgetTileRefreshScheduler.tsnew file mode 100644index 000000000000..52f662748e0a--- /dev/null+++ b/frontend/src/scenes/dashboard/widgetTileRefreshScheduler.ts@@ -0,0 +1,35 @@+import { WIDGET_TILE_REFRESH_DEBOUNCE_MS } from '@posthog/products-dashboards/frontend/widgets/constants'++export type DashboardWidgetTileRefreshScheduler = {+ schedule: (tileId: number) => void+ cancelAll: () => void+}++export function createDashboardWidgetTileRefreshScheduler(+ refreshTile: (tileId: number) => void,+ debounceMs: number = WIDGET_TILE_REFRESH_DEBOUNCE_MS+): DashboardWidgetTileRefreshScheduler {+ const timeouts = new Map<number, ReturnType<typeof setTimeout>>()++ return {+ schedule(tileId: number): void {+ const existing = timeouts.get(tileId)+ if (existing) {+ clearTimeout(existing)+ }+ timeouts.set(+ tileId,+ setTimeout(() => {+ timeouts.delete(tileId)+ refreshTile(tileId)+ }, debounceMs)+ )+ },+ cancelAll(): void {+ for (const timeout of timeouts.values()) {+ clearTimeout(timeout)+ }+ timeouts.clear()+ },+ }+}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a4a34d4a66ea..ee0ccec0e49b 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -446,7 +446,7 @@ importers:version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])'@storybook/react-webpack5':specifier: ^8.6.14- version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])+ version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])'@storybook/test-runner':specifier: ^0.19.1version: 0.19.1([email protected]([email protected]))@@ -500,7 +500,7 @@ importers:version: 2.0.0([email protected])webpack:specifier: 5.88.2+ version: 5.88.2([email protected])([email protected])webpack-cli:specifier: ^5.1.4version: 5.1.4([email protected])@@ -2516,6 +2516,9 @@ importers:clsx:specifier: '*'version: 1.2.1+ fast-deep-equal:+ specifier: 'catalog:'+ version: 3.1.3fuse.js:specifier: '*'version: 6.6.2@@ -2552,7 +2555,7 @@ importers:version: 14.6.1(@testing-library/[email protected])jest:specifier: ^29.7.0- version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))products/data_modeling:dependencies:@@ -3621,7 +3624,7 @@ importers:version: 1.2.1jest:specifier: '*'- version: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ version: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))kea:specifier: 'catalog:'version: 4.0.0-pre.5([email protected])@@ -27028,6 +27031,41 @@ snapshots:- ts-node- utf-8-validate+ '@jest/[email protected]':+ dependencies:+ '@jest/console': 29.7.0+ '@jest/reporters': 29.7.0+ '@jest/test-result': 29.7.0+ '@jest/transform': 29.7.0+ '@jest/types': 29.6.3+ '@types/node': 22.18.8+ ansi-escapes: 4.3.2+ chalk: 4.1.2+ ci-info: 3.8.0+ exit: 0.1.2+ graceful-fs: 4.2.11+ jest-changed-files: 29.7.0+ jest-config: 29.7.0(@types/[email protected])+ jest-haste-map: 29.7.0+ jest-message-util: 29.7.0+ jest-regex-util: 29.6.3+ jest-resolve: 29.7.0+ jest-resolve-dependencies: 29.7.0+ jest-runner: 29.7.0+ jest-runtime: 29.7.0+ jest-snapshot: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ jest-watcher: 29.7.0+ micromatch: 4.0.8+ pretty-format: 29.7.0+ slash: 3.0.0+ strip-ansi: 6.0.1+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color+ - ts-node+'@jest/[email protected]([email protected](@swc/[email protected])(@types/[email protected])([email protected]))':dependencies:'@jest/console': 29.7.0@@ -27169,6 +27207,42 @@ snapshots:- supports-color- ts-node+ '@jest/[email protected]([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))':+ dependencies:+ '@jest/console': 30.0.5+ '@jest/pattern': 30.0.1+ '@jest/reporters': 30.0.5+ '@jest/test-result': 30.0.5+ '@jest/transform': 30.0.5+ '@jest/types': 30.0.5+ '@types/node': 22.18.8+ ansi-escapes: 4.3.2+ chalk: 4.1.2+ ci-info: 4.3.0+ exit-x: 0.2.2+ graceful-fs: 4.2.11+ jest-changed-files: 30.0.5+ jest-config: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest-haste-map: 30.0.5+ jest-message-util: 30.0.5+ jest-regex-util: 30.0.1+ jest-resolve: 30.0.5+ jest-resolve-dependencies: 30.0.5+ jest-runner: 30.0.5+ jest-runtime: 30.0.5+ jest-snapshot: 30.0.5+ jest-util: 30.0.5+ jest-validate: 30.0.5+ jest-watcher: 30.0.5+ micromatch: 4.0.8+ pretty-format: 30.0.5+ slash: 3.0.0+ transitivePeerDependencies:+ - babel-plugin-macros+ - esbuild-register+ - supports-color+ - ts-node+'@jest/[email protected]':dependencies:'@jest/types': 29.6.3@@ -31349,7 +31423,7 @@ snapshots:ts-dedent: 2.2.0vite: 5.4.21(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])- '@storybook/[email protected](@swc/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])':+ '@storybook/[email protected]([email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:'@storybook/core-webpack': 8.6.18([email protected]([email protected]))'@types/semver': 7.7.1@@ -31367,12 +31441,12 @@ snapshots:semver: 7.8.0storybook: 8.6.18([email protected])style-loader: 3.3.3([email protected])- terser-webpack-plugin: 5.6.0(@swc/[email protected])([email protected])([email protected])([email protected])+ terser-webpack-plugin: 5.6.0([email protected])([email protected])ts-dedent: 2.2.0url: 0.11.1util: 0.12.5util-deprecate: 1.0.2+ webpack: 5.88.2([email protected])([email protected])webpack-dev-middleware: 6.1.3([email protected])webpack-hot-middleware: 2.25.4webpack-virtual-modules: 0.6.2@@ -31466,7 +31540,7 @@ snapshots:dependencies:storybook: 8.6.18([email protected])- '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':+ '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:'@storybook/core-webpack': 8.6.18([email protected]([email protected]))'@storybook/react': 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])@@ -31481,7 +31555,7 @@ snapshots:semver: 7.8.0storybook: 8.6.18([email protected])tsconfig-paths: 4.2.0+ webpack: 5.88.2([email protected])([email protected])optionalDependencies:typescript: 6.0.3transitivePeerDependencies:@@ -31515,7 +31589,7 @@ snapshots:react-docgen-typescript: 2.2.2([email protected])tslib: 2.8.1typescript: 6.0.3+ webpack: 5.88.2([email protected])([email protected])transitivePeerDependencies:- supports-color@@ -31553,10 +31627,10 @@ snapshots:- supports-color- typescript- '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':+ '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:- '@storybook/builder-webpack5': 8.6.18(@swc/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])- '@storybook/preset-react-webpack': 8.6.18(@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])+ '@storybook/builder-webpack5': 8.6.18([email protected])([email protected]([email protected]))([email protected])([email protected])+ '@storybook/preset-react-webpack': 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])'@storybook/react': 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])react: 18.3.1react-dom: 18.3.1([email protected])@@ -31650,7 +31724,7 @@ snapshots:'@swc/core': 1.15.18'@swc/jest': 0.2.37(@swc/[email protected])expect-playwright: 0.8.0- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-circus: 29.7.0jest-environment-node: 29.7.0jest-junit: 16.0.0@@ -33915,17 +33989,17 @@ snapshots:dependencies:+ webpack: 5.88.2([email protected])([email protected])webpack-cli: 5.1.4([email protected])dependencies:+ webpack: 5.88.2([email protected])([email protected])webpack-cli: 5.1.4([email protected])dependencies:+ webpack: 5.88.2([email protected])([email protected])webpack-cli: 5.1.4([email protected])'@xmldom/[email protected]': {}@@ -34466,7 +34540,7 @@ snapshots:loader-utils: 2.0.4make-dir: 3.1.0schema-utils: 2.7.1+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -35432,6 +35506,21 @@ snapshots:safe-buffer: 5.2.1sha.js: 2.4.12+ dependencies:+ '@jest/types': 29.6.3+ chalk: 4.1.2+ exit: 0.1.2+ graceful-fs: 4.2.11+ jest-config: 29.7.0+ jest-util: 29.7.0+ prompts: 2.4.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/types': 29.6.3@@ -35561,7 +35650,7 @@ snapshots:postcss-value-parser: 4.2.0schema-utils: 2.7.1semver: 6.3.1+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -35573,7 +35662,7 @@ snapshots:postcss-modules-values: 4.0.0([email protected])postcss-value-parser: 4.2.0semver: 7.8.0+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -37155,7 +37244,7 @@ snapshots:dependencies:loader-utils: 2.0.4schema-utils: 3.3.0+ webpack: 5.88.2([email protected])([email protected])@@ -37274,7 +37363,7 @@ snapshots:semver: 7.8.0tapable: 2.3.0typescript: 6.0.3+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -37937,7 +38026,7 @@ snapshots:dependencies:html-webpack-plugin: 5.5.3([email protected])+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -37946,7 +38035,7 @@ snapshots:lodash: 4.18.1pretty-error: 4.0.0tapable: 2.2.1+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -38676,6 +38765,25 @@ snapshots:- ts-node- utf-8-validate+ dependencies:+ '@jest/core': 29.7.0+ '@jest/test-result': 29.7.0+ '@jest/types': 29.6.3+ chalk: 4.1.2+ create-jest: 29.7.0+ exit: 0.1.2+ import-local: 3.2.0+ jest-config: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ yargs: 17.7.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))@@ -38752,6 +38860,25 @@ snapshots:- supports-color- ts-node+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@jest/core': 30.0.5([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ '@jest/test-result': 30.0.5+ '@jest/types': 30.0.5+ chalk: 4.1.2+ exit-x: 0.2.2+ import-local: 3.2.0+ jest-config: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest-util: 30.0.5+ jest-validate: 30.0.5+ yargs: 17.7.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - esbuild-register+ - supports-color+ - ts-node+[email protected]([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@babel/core': 7.29.0@@ -38786,6 +38913,64 @@ snapshots:- supports-color- utf-8-validate+ dependencies:+ '@babel/core': 7.29.0+ '@jest/test-sequencer': 29.7.0+ '@jest/types': 29.6.3+ babel-jest: 29.7.0(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 3.8.0+ deepmerge: 4.3.1+ glob: 7.2.3+ graceful-fs: 4.2.11+ jest-circus: 29.7.0+ jest-environment-node: 29.7.0+ jest-get-type: 29.6.3+ jest-regex-util: 29.6.3+ jest-resolve: 29.7.0+ jest-runner: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 29.7.0+ slash: 3.0.0+ strip-json-comments: 3.1.1+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color++ [email protected](@types/[email protected]):+ dependencies:+ '@babel/core': 7.29.0+ '@jest/test-sequencer': 29.7.0+ '@jest/types': 29.6.3+ babel-jest: 29.7.0(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 3.8.0+ deepmerge: 4.3.1+ glob: 7.2.3+ graceful-fs: 4.2.11+ jest-circus: 29.7.0+ jest-environment-node: 29.7.0+ jest-get-type: 29.6.3+ jest-regex-util: 29.6.3+ jest-resolve: 29.7.0+ jest-runner: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 29.7.0+ slash: 3.0.0+ strip-json-comments: 3.1.1+ optionalDependencies:+ '@types/node': 22.18.8+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@babel/core': 7.29.0@@ -38944,6 +39129,74 @@ snapshots:- babel-plugin-macros- supports-color+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@babel/core': 7.29.0+ '@jest/get-type': 30.0.1+ '@jest/pattern': 30.0.1+ '@jest/test-sequencer': 30.0.5+ '@jest/types': 30.0.5+ babel-jest: 30.0.5(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 4.3.0+ deepmerge: 4.3.1+ glob: 10.5.0+ graceful-fs: 4.2.11+ jest-circus: 30.0.5+ jest-docblock: 30.0.1+ jest-environment-node: 30.0.5+ jest-regex-util: 30.0.1+ jest-resolve: 30.0.5+ jest-runner: 30.0.5+ jest-util: 30.0.5+ jest-validate: 30.0.5+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 30.0.5+ slash: 3.0.0+ strip-json-comments: 3.1.1+ optionalDependencies:+ '@types/node': 22.18.8+ esbuild-register: 3.6.0([email protected])+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color++ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@babel/core': 7.29.0+ '@jest/get-type': 30.0.1+ '@jest/pattern': 30.0.1+ '@jest/test-sequencer': 30.0.5+ '@jest/types': 30.0.5+ babel-jest: 30.0.5(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 4.3.0+ deepmerge: 4.3.1+ glob: 10.5.0+ graceful-fs: 4.2.11+ jest-circus: 30.0.5+ jest-docblock: 30.0.1+ jest-environment-node: 30.0.5+ jest-regex-util: 30.0.1+ jest-resolve: 30.0.5+ jest-runner: 30.0.5+ jest-util: 30.0.5+ jest-validate: 30.0.5+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 30.0.5+ slash: 3.0.0+ strip-json-comments: 3.1.1+ optionalDependencies:+ '@types/node': 25.8.0+ esbuild-register: 3.6.0([email protected])+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color+dependencies:chalk: 4.1.2@@ -39318,7 +39571,7 @@ snapshots:dependencies:expect-playwright: 0.8.0- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-circus: 29.7.0jest-environment-node: 29.7.0jest-process-manager: 0.4.0@@ -39753,7 +40006,7 @@ snapshots:dependencies:ansi-escapes: 6.0.0chalk: 5.6.2- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-regex-util: 29.6.3jest-watcher: 29.7.0slash: 5.1.0@@ -39825,6 +40078,18 @@ snapshots:- ts-node- utf-8-validate+ dependencies:+ '@jest/core': 29.7.0+ '@jest/types': 29.6.3+ import-local: 3.2.0+ jest-cli: 29.7.0+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))@@ -39874,6 +40139,19 @@ snapshots:- supports-color- ts-node+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@jest/core': 30.0.5([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ '@jest/types': 30.0.5+ import-local: 3.2.0+ jest-cli: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - esbuild-register+ - supports-color+ - ts-node+@@ -40177,7 +40455,7 @@ snapshots:less: 4.2.2loader-utils: 2.0.4schema-utils: 3.3.0+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -42475,7 +42753,7 @@ snapshots:postcss: 8.5.15schema-utils: 3.3.0semver: 7.7.0+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -43262,7 +43540,7 @@ snapshots:dependencies:loader-utils: 2.0.4schema-utils: 3.3.0+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -44305,7 +44583,7 @@ snapshots:neo-async: 2.6.2schema-utils: 3.3.0semver: 7.7.0+ webpack: 5.88.2([email protected])([email protected])optionalDependencies:sass: 1.56.0@@ -44969,11 +45247,11 @@ snapshots:dependencies:loader-utils: 2.0.4schema-utils: 3.3.0+ webpack: 5.88.2([email protected])([email protected])dependencies:+ webpack: 5.88.2([email protected])([email protected])@@ -45338,28 +45616,26 @@ snapshots:ansi-escapes: 4.3.2supports-hyperlinks: 2.3.0- [email protected](@swc/[email protected])([email protected])([email protected])([email protected]):+ [email protected](@swc/[email protected])([email protected])([email protected])([email protected](@swc/[email protected])([email protected])([email protected])):dependencies:'@jridgewell/trace-mapping': 0.3.29jest-worker: 27.5.1schema-utils: 4.3.3terser: 5.46.0optionalDependencies:'@swc/core': 1.15.18- esbuild: 0.25.12+ esbuild: 0.27.7postcss: 8.5.15- [email protected](@swc/[email protected])([email protected])([email protected])([email protected](@swc/[email protected])([email protected])([email protected])):dependencies:'@jridgewell/trace-mapping': 0.3.29jest-worker: 27.5.1schema-utils: 4.3.3terser: 5.46.0+ webpack: 5.88.2([email protected])([email protected])optionalDependencies:- '@swc/core': 1.15.18- esbuild: 0.27.7postcss: 8.5.15@@ -46553,7 +46829,7 @@ snapshots:import-local: 3.1.0interpret: 3.1.1rechoir: 0.8.0+ webpack: 5.88.2([email protected])([email protected])webpack-merge: 5.8.0@@ -46564,7 +46840,7 @@ snapshots:range-parser: 1.2.1schema-utils: 4.3.3optionalDependencies:+ webpack: 5.88.2([email protected])([email protected])dependencies:@@ -46624,7 +46900,7 @@ snapshots:- postcss- uglify-js- [email protected](@swc/[email protected])([email protected])([email protected])([email protected]):dependencies:'@types/eslint-scope': 3.7.7'@types/estree': 1.0.8@@ -46647,7 +46923,7 @@ snapshots:neo-async: 2.6.2schema-utils: 3.3.0tapable: 2.3.0- terser-webpack-plugin: 5.6.0(@swc/[email protected])([email protected])([email protected])([email protected])+ terser-webpack-plugin: 5.6.0([email protected])([email protected])watchpack: 2.5.1webpack-sources: 3.3.4optionalDependencies:diff --git a/products/dashboards/backend/api/dashboard.py b/products/dashboards/backend/api/dashboard.pyindex 9cb03038e0e0..96ba65461632 100644--- a/products/dashboards/backend/api/dashboard.py+++ b/products/dashboards/backend/api/dashboard.py@@ -197,7 +197,12 @@ def _run_widget_query(},) as slo:try:- result = work_item["query_fn"](team, work_item["config"], user=work_item["user"])+ query_fn = work_item["query_fn"]+ result = query_fn(+ team,+ work_item["config"],+ user=work_item["user"],+ )return {"tile_id": tile_id,"widget_type": widget_type,@@ -804,7 +809,12 @@ class DashboardWidgetRunResultSerializer(serializers.Serializer):)result = serializers.JSONField(allow_null=True,- help_text="Live widget query result payload.",+ help_text=(+ "Live widget query result payload. List widgets return results (array), limit (configured page size), "+ "hasMore (boolean), totalCount (matching rows for current filters), totalCountCapped (true when totalCount "+ "hit the widget max and more may exist), and optional offset/nextOffset. error_tracking_list results are "+ "issue summaries; session_replay_list results are recording metadata."+ ),)error = serializers.CharField(allow_null=True,@@ -1424,7 +1434,11 @@ class DashboardSerializer(DashboardMetadataSerializer):raise serializers.ValidationError({"widget": "widget_type cannot be changed."})if "config" in widget_data:- widget.config = validate_widget_config(widget.widget_type, widget_data["config"], team_id=widget.team_id)+ widget.config = validate_widget_config(+ widget.widget_type,+ widget_data["config"],+ team_id=widget.team_id,+ )if "name" in widget_data:widget.name = widget_data["name"] or Noneif "description" in widget_data:@@ -2565,13 +2579,13 @@ class DashboardsViewSet(continueif widget.widget_type == SESSION_REPLAY_LIST_WIDGET_TYPE:- throttle_error = get_replay_listing_throttle_error(request, self)- if throttle_error:+ replay_throttle_error = get_replay_listing_throttle_error(request, self)+ if replay_throttle_error:results_by_id[tile_id] = {"tile_id": tile_id,"widget_type": widget.widget_type,"result": None,- "error": throttle_error,+ "error": replay_throttle_error,}continuediff --git a/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx b/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsxindex 3e663a86e162..6eac61367f16 100644--- a/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx+++ b/products/dashboards/frontend/components/DashboardWidgetItem/DashboardWidgetItem.tsx@@ -20,7 +20,16 @@ import {tryGetDashboardWidgetCatalogEntry,type ResolvedDashboardWidgetCatalogEntry,} from '../../widget_types/catalog'-import { userHasDashboardWidgetProductAccess } from '../../widgetProductAccess'+import { useWidgetAvailability } from '../../widget_types/widgetAvailability'+import {+ userCanMutateErrorTrackingIssuesOnDashboard,+ userHasDashboardWidgetProductAccess,+} from '../../widgetProductAccess'+import { DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON } from '../../widgets/constants'+import type {+ WidgetIssueMetadataContext,+ WidgetIssueMetadataDelta,+} from '../../widgets/error_tracking/applyWidgetIssueMetadataChange'import {getDashboardWidgetDefinition,type DashboardWidgetComponentProps,@@ -35,11 +44,19 @@ type DashboardWidgetItemProps = {tile: DashboardTile<QueryBasedInsightModel>placement: DashboardPlacementdashboardId?: number | null+ canEditDashboard?: booleanresult: unknownloading: booleanerror?: string | nulllastFetchedAt?: numberonRefresh: () => void+ onRefreshWidgetData?: (tileId: number) => void+ onApplyWidgetIssueMetadataChange?: (+ tileId: number,+ issueId: string,+ delta: WidgetIssueMetadataDelta,+ context: WidgetIssueMetadataContext+ ) => voidonUpdateWidgetTile?: (patch: {config?: Record<string, unknown>name?: string@@ -113,10 +130,13 @@ function DashboardWidgetItemContent({error,lastFetchedAt,onRefresh,+ onRefreshWidgetData,+ onApplyWidgetIssueMetadataChange,onUpdateWidgetTile,toggleShowDescription,onDragHandleMouseDown,showEditingControls,+ canEditDashboard,onDuplicate,onRemove,onMoveToDashboard,@@ -140,6 +160,8 @@ function DashboardWidgetItemContent({? headerCatalogEntry.titleHref: undefined+ const canUpdateWidgetTileConfig = !!onUpdateWidgetTile && !!canEditDashboard+const componentProps: DashboardWidgetComponentProps = {tileId: tile.id,config: widget.config,@@ -147,13 +169,22 @@ function DashboardWidgetItemContent({loading,error,onRefresh,- onUpdateConfig: onUpdateWidgetTile+ onRefreshData: onRefreshWidgetData ? () => onRefreshWidgetData(tile.id) : undefined,+ onApplyIssueMetadataChange: onApplyWidgetIssueMetadataChange+ ? (issueId, delta, context) => {+ onApplyWidgetIssueMetadataChange(tile.id, issueId, delta, context)+ }+ : undefined,+ canMutateErrorTrackingIssues: userCanMutateErrorTrackingIssuesOnDashboard(!!canEditDashboard),+ onUpdateConfig: canUpdateWidgetTileConfig? async (config) => {await onUpdateWidgetTile({ config })}: undefined,}+ const TileFilters = definition?.TileFilters+ const { isAvailable: showTileFilters } = useWidgetAvailability(headerCatalogEntry.availability)const EditModal = definition?.EditModalconst hasDashboardSectionActions =@@ -243,6 +274,17 @@ function DashboardWidgetItemContent({}onDragHandleMouseDown={onDragHandleMouseDown}/>+ {!showSharedPlaceholder && hasProductAccess && showTileFilters && TileFilters ? (+ <TileFilters+ tileId={tile.id}+ config={widget.config}+ onUpdateConfig={componentProps.onUpdateConfig}+ canMutateErrorTrackingIssues={componentProps.canMutateErrorTrackingIssues}+ disabledReason={+ canUpdateWidgetTileConfig ? undefined : DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON+ }+ />+ ) : null}{showSharedPlaceholder ? (<WidgetCardSharedPlaceholderBodycopy={headerCatalogEntry.sharedPlaceholder ?? DEFAULT_SHARED_DASHBOARD_WIDGET_PLACEHOLDER}@@ -296,11 +338,14 @@ export const DashboardWidgetItem = React.forwardRef<HTMLDivElement, DashboardWidtile,placement,dashboardId,+ canEditDashboard,result,loading,error,lastFetchedAt,onRefresh,+ onRefreshWidgetData,+ onApplyWidgetIssueMetadataChange,onUpdateWidgetTile,toggleShowDescription,showResizeHandles,@@ -369,7 +414,10 @@ export const DashboardWidgetItem = React.forwardRef<HTMLDivElement, DashboardWiderror={error}lastFetchedAt={lastFetchedAt}onRefresh={onRefresh}+ onRefreshWidgetData={onRefreshWidgetData}+ onApplyWidgetIssueMetadataChange={onApplyWidgetIssueMetadataChange}onUpdateWidgetTile={onUpdateWidgetTile}+ canEditDashboard={canEditDashboard}toggleShowDescription={toggleShowDescription}onDragHandleMouseDown={onDragHandleMouseDown}showEditingControls={showEditingControls}diff --git a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsxindex 557508108d5c..f422dfc9e78a 100644--- a/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx+++ b/products/dashboards/frontend/components/WidgetCard/WidgetCardBody.tsx@@ -212,6 +212,72 @@ export function WidgetCardContent({ children, footer, className }: WidgetCardCon)}+type WidgetContentFooterProps = {+ children: React.ReactNode+ className?: string+}++/** Pinned footer slot for list widgets — sibling of `WidgetCardContent`. */+export function WidgetContentFooter({ children, className }: WidgetContentFooterProps): JSX.Element {+ return (+ <div data-slot="widget-card-content-footer" className={cn('flex shrink-0 justify-center pt-0.5', className)}>+ {children}+ </div>+ )+}++export type WidgetListCountNoun = {+ singular: string+ plural: string+}++export const WIDGET_LIST_COUNT_ISSUES: WidgetListCountNoun = { singular: 'issue', plural: 'issues' }+export const WIDGET_LIST_COUNT_RECORDINGS: WidgetListCountNoun = { singular: 'recording', plural: 'recordings' }++export function formatWidgetListCountFooter(+ shown: number,+ totalCount: number | undefined,+ totalCountIsLowerBound?: boolean,+ noun: WidgetListCountNoun = WIDGET_LIST_COUNT_ISSUES,+ hasMore?: boolean+): string {+ const label = shown === 1 && totalCount === 1 && !totalCountIsLowerBound ? noun.singular : noun.plural++ if (totalCount === undefined) {+ if (hasMore && shown > 0) {+ return `${shown}+ ${shown === 1 ? noun.singular : noun.plural}`+ }+ return `${shown} ${shown === 1 ? noun.singular : noun.plural}`+ }++ const totalLabel = totalCountIsLowerBound ? `${totalCount}+` : String(totalCount)+ return `${shown} of ${totalLabel} ${label}`+}++type WidgetListCountProps = {+ shown: number+ totalCount?: number+ totalCountIsLowerBound?: boolean+ noun?: WidgetListCountNoun+ hasMore?: boolean+ dataAttr: string+}++export function WidgetListCount({+ shown,+ totalCount,+ totalCountIsLowerBound,+ noun = WIDGET_LIST_COUNT_ISSUES,+ hasMore,+ dataAttr,+}: WidgetListCountProps): JSX.Element {+ return (+ <p className="text-xs text-muted m-0 text-center" data-attr={dataAttr}>+ {formatWidgetListCountFooter(shown, totalCount, totalCountIsLowerBound, noun, hasMore)}+ </p>+ )+}+export type WidgetCardSharedPlaceholderCopy = {title: stringmessage: stringdiff --git a/products/dashboards/frontend/components/WidgetCard/index.ts b/products/dashboards/frontend/components/WidgetCard/index.tsindex bca0f3d97207..a7899d87a18a 100644--- a/products/dashboards/frontend/components/WidgetCard/index.ts+++ b/products/dashboards/frontend/components/WidgetCard/index.ts@@ -6,6 +6,10 @@ export {WidgetCardContent,WidgetCardSharedPlaceholderBody,type WidgetCardSharedPlaceholderCopy,+ WidgetContentFooter,+ WidgetListCount,+ WIDGET_LIST_COUNT_ISSUES,+ WIDGET_LIST_COUNT_RECORDINGS,WidgetLoadingState,} from './WidgetCardBody'export {diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.tsindex be5200046aa7..53fd18316692 100644--- a/products/dashboards/frontend/generated/api.schemas.ts+++ b/products/dashboards/frontend/generated/api.schemas.ts@@ -7908,7 +7908,7 @@ export interface DashboardWidgetRunResultApi {* @nullable*/widget_type: string | null- /** Live widget query result payload. */+ /** Live widget query result payload. List widgets return results (array), limit (configured page size), hasMore (boolean), totalCount (matching rows for current filters), totalCountCapped (true when totalCount hit the widget max and more may exist), and optional offset/nextOffset. error_tracking_list results are issue summaries; session_replay_list results are recording metadata. */result: unknown/*** Error message when the widget could not be run.diff --git a/products/dashboards/frontend/widgetProductAccess.ts b/products/dashboards/frontend/widgetProductAccess.tsindex 4e711892205a..fdd6cbbfd08e 100644--- a/products/dashboards/frontend/widgetProductAccess.ts+++ b/products/dashboards/frontend/widgetProductAccess.ts@@ -16,3 +16,8 @@ export function userHasDashboardWidgetProductAccess(productAccess: DashboardWidg}return WIDGET_PRODUCT_ACCESS_CHECKS[productAccess]()}++/** In-tile issue row edits and assignee filter picker: dashboard editor or Error tracking editor. */+export function userCanMutateErrorTrackingIssuesOnDashboard(canEditDashboard: boolean): boolean {+ return canEditDashboard || userHasAccess(AccessControlResourceType.ErrorTracking, AccessControlLevel.Editor)+}diff --git a/products/dashboards/frontend/widget_types/catalog.ts b/products/dashboards/frontend/widget_types/catalog.tsindex 60746f69bf47..43816013162f 100644--- a/products/dashboards/frontend/widget_types/catalog.ts+++ b/products/dashboards/frontend/widget_types/catalog.ts@@ -1,5 +1,7 @@import { urls } from 'scenes/urls'+import { QuickFilterContext } from '~/queries/schema/schema-general'+import type { DashboardWidgetProductAccess } from '../types'import { ErrorTrackingWidgetPreview } from '../widgets/previews/ErrorTrackingWidgetPreview'import { SessionReplayWidgetPreview } from '../widgets/previews/SessionReplayWidgetPreview'@@ -24,6 +26,37 @@ export const DEFAULT_DASHBOARD_WIDGET_HEADER_META = {showDateRange: true,} satisfies DashboardWidgetHeaderMeta+/** Event properties allowed in error tracking list widget `config.widgetFilters`. */+export const ERROR_TRACKING_LIST_TILE_FILTER_PROPERTIES = [+ '$environment',+ '$current_url',+ '$pathname',+ '$team',+ '$posthog_team',+ '$temporal_worker',+ '$temporal_worker_name',+] as const++/** Event properties allowed in session replay list widget `config.widgetFilters`. */+export const SESSION_REPLAY_LIST_TILE_FILTER_PROPERTIES = [+ '$browser',+ '$os',+ '$device_type',+ '$geoip_country_code',+ '$geoip_city_name',+ '$current_url',+ '$pathname',+ '$host',+ '$referring_domain',+ '$lib',+ '$environment',+] as const++export type DashboardWidgetTileFiltersCatalogConfig = {+ quickFilterContext: QuickFilterContext+ allowedPropertyNames: readonly string[]+}+/** Product area labels keyed by catalog `groupId`. New groups: add here. */export const DASHBOARD_WIDGET_GROUP_LABELS = {error_tracking: 'Error tracking',@@ -56,6 +89,8 @@ export type DashboardWidgetCatalogEntry = {}/** Optional project setup requirement surfaced in widget runtime when unmet (see `widgetAvailability.ts`). */availability?: WidgetAvailabilityConfig+ /** Quick filter context + property allowlist for on-tile filter bars. */+ tileFilters?: DashboardWidgetTileFiltersCatalogConfig}/** New widget types: add here. See products/dashboards/CONTRIBUTING.md. */@@ -75,6 +110,10 @@ export const DASHBOARD_WIDGET_CATALOG = {title: 'Top issues',message: 'Log in to PostHog to see which errors are affecting your users.',},+ tileFilters: {+ quickFilterContext: QuickFilterContext.ErrorTrackingIssueFilters,+ allowedPropertyNames: ERROR_TRACKING_LIST_TILE_FILTER_PROPERTIES,+ },},session_replay_list: {groupId: 'session_replay',@@ -99,6 +138,10 @@ export const DASHBOARD_WIDGET_CATALOG = {setupActionLabel: 'Enable session replay',docsHref: 'https://posthog.com/docs/session-replay',},+ tileFilters: {+ quickFilterContext: QuickFilterContext.Dashboards,+ allowedPropertyNames: SESSION_REPLAY_LIST_TILE_FILTER_PROPERTIES,+ },},} as const satisfies Record<string, DashboardWidgetCatalogEntry>diff --git a/products/dashboards/frontend/widgets/EditWidgetModalFiltersSection.tsx b/products/dashboards/frontend/widgets/EditWidgetModalFiltersSection.tsxindex 297df91e5bee..5af7b934fff1 100644--- a/products/dashboards/frontend/widgets/EditWidgetModalFiltersSection.tsx+++ b/products/dashboards/frontend/widgets/EditWidgetModalFiltersSection.tsx@@ -1,29 +1,55 @@+import type { ReactNode } from 'react'+import { TestAccountFilter } from 'scenes/insights/filters/TestAccountFilter'-type EditWidgetModalFiltersSectionProps = {+type EditWidgetModalTestAccountFilterProps = {filterTestAccounts: booleansaving: booleansetFilterTestAccounts: (value: boolean) => void}-export function EditWidgetModalFiltersSection({+export function EditWidgetModalTestAccountFilter({+ filterTestAccounts,+ saving,+ setFilterTestAccounts,+}: EditWidgetModalTestAccountFilterProps): JSX.Element {+ return (+ <div className="sm:col-span-2">+ <TestAccountFilter+ size="small"+ filters={{ filter_test_accounts: filterTestAccounts }}+ onChange={({ filter_test_accounts }) => setFilterTestAccounts(filter_test_accounts ?? false)}+ disabledReason={saving ? 'Saving…' : undefined}+ />+ </div>+ )+}++export type EditWidgetModalFiltersSubsectionProps = EditWidgetModalTestAccountFilterProps & {+ /** Subsection heading under the product group (e.g. "Issue filters"). */+ title: string+ children?: ReactNode+}++/** Test-account filter plus optional fields in a 2-column grid (matches error tracking widget modal). */+export function EditWidgetModalFiltersSubsection({+ title,filterTestAccounts,saving,setFilterTestAccounts,-}: EditWidgetModalFiltersSectionProps): JSX.Element {+ children,+}: EditWidgetModalFiltersSubsectionProps): JSX.Element {return (- <section className="flex flex-col gap-3">- <h5 className="text-sm font-semibold m-0">Filters</h5>+ <div className="flex flex-col gap-3">+ <h6 className="text-xs font-semibold text-muted m-0">{title}</h6><div className="grid grid-cols-1 sm:grid-cols-2 gap-4">- <div className="sm:col-span-2">- <TestAccountFilter- size="small"- filters={{ filter_test_accounts: filterTestAccounts }}- onChange={({ filter_test_accounts }) => setFilterTestAccounts(filter_test_accounts ?? false)}- disabledReason={saving ? 'Saving…' : undefined}- />- </div>+ <EditWidgetModalTestAccountFilter+ filterTestAccounts={filterTestAccounts}+ saving={saving}+ setFilterTestAccounts={setFilterTestAccounts}+ />+ {children}</div>- </section>+ </div>)}diff --git a/products/dashboards/frontend/widgets/WidgetPropertyFiltersSection.tsx b/products/dashboards/frontend/widgets/WidgetPropertyFiltersSection.tsxnew file mode 100644index 000000000000..60fb20cf7191--- /dev/null+++ b/products/dashboards/frontend/widgets/WidgetPropertyFiltersSection.tsx@@ -0,0 +1,50 @@+import { QuickFilterSelector } from 'lib/components/QuickFilters/QuickFilterSelector'++import type { QuickFilter } from '~/types'++import type { WidgetFilterConfigEntry, WidgetFilterConfigRecord } from '../widget_types/configSchemas'++export type WidgetPropertyFiltersSectionProps = {+ filterDefinitions: QuickFilter[]+ widgetFilters: WidgetFilterConfigRecord+ onWidgetFiltersChange: (widgetFilters: WidgetFilterConfigRecord) => void+}++export function WidgetPropertyFiltersSection({+ filterDefinitions,+ widgetFilters,+ onWidgetFiltersChange,+}: WidgetPropertyFiltersSectionProps): JSX.Element {+ return (+ <>+ {filterDefinitions.map((filter) => {+ const entry = widgetFilters[filter.id]+ const selectedOptionId = entry?.optionId ?? null++ return (+ <QuickFilterSelector+ key={filter.id}+ label={filter.name}+ options={filter.options}+ selectedOptionId={selectedOptionId}+ onChange={(option) => {+ const next = { ...widgetFilters }+ if (option === null) {+ delete next[filter.id]+ } else {+ next[filter.id] = {+ filterId: filter.id,+ propertyName: filter.property_name,+ optionId: option.id,+ operator: option.operator as WidgetFilterConfigEntry['operator'],+ value: option.value,+ }+ }+ onWidgetFiltersChange(next)+ }}+ />+ )+ })}+ </>+ )+}diff --git a/products/dashboards/frontend/widgets/constants.test.ts b/products/dashboards/frontend/widgets/constants.test.tsnew file mode 100644index 000000000000..b875d7bdcda2--- /dev/null+++ b/products/dashboards/frontend/widgets/constants.test.ts@@ -0,0 +1,34 @@+import { formatWidgetListCountFooter, WIDGET_LIST_COUNT_RECORDINGS } from '../components/WidgetCard/WidgetCardBody'++describe('formatWidgetListCountFooter', () => {+ it('formats exact totals for issues', () => {+ expect(formatWidgetListCountFooter(1, 1, false)).toBe('1 of 1 issue')+ expect(formatWidgetListCountFooter(3, 12, false)).toBe('3 of 12 issues')+ })++ it('formats capped totals for issues', () => {+ expect(formatWidgetListCountFooter(1, 25, true)).toBe('1 of 25+ issues')+ })++ it('falls back when total is missing', () => {+ expect(formatWidgetListCountFooter(2, undefined)).toBe('2 issues')+ })++ it('shows lower-bound style footer when hasMore and total is omitted', () => {+ expect(formatWidgetListCountFooter(10, undefined, undefined, undefined, true)).toBe('10+ issues')+ expect(formatWidgetListCountFooter(1, undefined, undefined, undefined, true)).toBe('1+ issue')+ })++ it('formats exact totals for recordings', () => {+ expect(formatWidgetListCountFooter(1, 1, false, WIDGET_LIST_COUNT_RECORDINGS)).toBe('1 of 1 recording')+ expect(formatWidgetListCountFooter(3, 12, false, WIDGET_LIST_COUNT_RECORDINGS)).toBe('3 of 12 recordings')+ })++ it('formats capped totals for recordings', () => {+ expect(formatWidgetListCountFooter(2, 25, true, WIDGET_LIST_COUNT_RECORDINGS)).toBe('2 of 25+ recordings')+ })++ it('falls back for recordings when total is missing', () => {+ expect(formatWidgetListCountFooter(2, undefined, undefined, WIDGET_LIST_COUNT_RECORDINGS)).toBe('2 recordings')+ })+})diff --git a/products/dashboards/frontend/widgets/constants.ts b/products/dashboards/frontend/widgets/constants.tsindex 8782e021ca4a..c6d0a92a9f34 100644--- a/products/dashboards/frontend/widgets/constants.ts+++ b/products/dashboards/frontend/widgets/constants.ts@@ -1,6 +1,18 @@/** Shown on the widget tile when run_widgets fails or returns a per-tile error. */export const DASHBOARD_WIDGET_FETCH_ERROR_MESSAGE = 'Failed to load widget data.'+export const WIDGET_LIST_ORDER_DIRECTION_OPTIONS = [+ { value: 'DESC', label: 'Descending' },+ { value: 'ASC', label: 'Ascending' },+] as const++/** Shown on widget tile filter controls when the viewer cannot edit the dashboard. */+export const DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON =+ "You don't have edit permissions for this dashboard. Ask a dashboard collaborator with edit access to add you."++/** Debounce before PATCHing tile config after on-tile filter edits (run_widgets refresh). */+export const WIDGET_TILE_REFRESH_DEBOUNCE_MS = 300+const WIDGET_FETCH_ERROR_PASSTHROUGH_PREFIXES = ['Tile not found','You do not have access',diff --git a/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts b/products/dashboards/frontend/widgets/editWidgetModalBuilders.tsindex 42a830d7718d..0d3bafdb79d2 100644--- a/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts+++ b/products/dashboards/frontend/widgets/editWidgetModalBuilders.ts@@ -1,5 +1,47 @@+import type { DashboardWidgetEditModalProps } from './registry'+type ValidationResult = { success: true } | { success: false; fieldErrors: Record<string, string> }+export type WidgetEditModalTileMetadataProps = Pick<+ DashboardWidgetEditModalProps,+ 'name' | 'description' | 'defaultTitle'+>++export function getWidgetEditModalTileDefaults(props: Pick<DashboardWidgetEditModalProps, 'name' | 'description'>): {+ tileName: string+ tileDescription: string+} {+ return {+ tileName: props.name ?? '',+ tileDescription: props.description ?? '',+ }+}++export type WidgetTileMetadataPatch = {+ name?: string+ description?: string+}++export function buildWidgetTileMetadataPatch(+ props: WidgetEditModalTileMetadataProps,+ tileName: string,+ tileDescription: string+): WidgetTileMetadataPatch {+ const trimmedName = tileName.trim()+ const trimmedDescription = tileDescription.trim()+ const nameChanged = trimmedName !== (props.name ?? '').trim()+ const descriptionChanged = trimmedDescription !== (props.description ?? '').trim()++ const metadata: WidgetTileMetadataPatch = {}+ if (nameChanged) {+ metadata.name = trimmedName === (props.defaultTitle ?? 'Untitled').trim() ? '' : trimmedName+ }+ if (descriptionChanged) {+ metadata.description = trimmedDescription+ }+ return metadata+}+export const widgetEditModalTileActions = {setTileName: (tileName: string) => ({ tileName }),setTileDescription: (tileDescription: string) => ({ tileDescription }),diff --git a/products/dashboards/frontend/widgets/editWidgetModalTileUtils.test.ts b/products/dashboards/frontend/widgets/editWidgetModalTileUtils.test.tsindex e2204453956c..da8f5b5a25e9 100644--- a/products/dashboards/frontend/widgets/editWidgetModalTileUtils.test.ts+++ b/products/dashboards/frontend/widgets/editWidgetModalTileUtils.test.ts@@ -1,6 +1,6 @@-import { buildWidgetTileMetadataPatch, getWidgetEditModalTileDefaults } from './editWidgetModalTileUtils'+import { buildWidgetTileMetadataPatch, getWidgetEditModalTileDefaults } from './editWidgetModalBuilders'-describe('editWidgetModalTileUtils', () => {+describe('editWidgetModalBuilders tile metadata', () => {it('getWidgetEditModalTileDefaults returns empty strings when metadata is missing', () => {expect(getWidgetEditModalTileDefaults({})).toEqual({tileName: '',diff --git a/products/dashboards/frontend/widgets/editWidgetModalTileUtils.ts b/products/dashboards/frontend/widgets/editWidgetModalTileUtils.tsdeleted file mode 100644index 21d91b835461..000000000000--- a/products/dashboards/frontend/widgets/editWidgetModalTileUtils.ts+++ /dev/null@@ -1,41 +0,0 @@-import type { DashboardWidgetEditModalProps } from './registry'--export type WidgetEditModalTileMetadataProps = Pick<- DashboardWidgetEditModalProps,- 'name' | 'description' | 'defaultTitle'->--export function getWidgetEditModalTileDefaults(props: Pick<DashboardWidgetEditModalProps, 'name' | 'description'>): {- tileName: string- tileDescription: string-} {- return {- tileName: props.name ?? '',- tileDescription: props.description ?? '',- }-}--export type WidgetTileMetadataPatch = {- name?: string- description?: string-}--export function buildWidgetTileMetadataPatch(- props: WidgetEditModalTileMetadataProps,- tileName: string,- tileDescription: string-): WidgetTileMetadataPatch {- const trimmedName = tileName.trim()- const trimmedDescription = tileDescription.trim()- const nameChanged = trimmedName !== (props.name ?? '').trim()- const descriptionChanged = trimmedDescription !== (props.description ?? '').trim()-- const metadata: WidgetTileMetadataPatch = {}- if (nameChanged) {- metadata.name = trimmedName === (props.defaultTitle ?? 'Untitled').trim() ? '' : trimmedName- }- if (descriptionChanged) {- metadata.description = trimmedDescription- }- return metadata-}diff --git a/products/dashboards/frontend/widgets/error_tracking/EditErrorTrackingWidgetModal.tsx b/products/dashboards/frontend/widgets/error_tracking/EditErrorTrackingWidgetModal.tsxindex 76639856bd58..5b7eca194a11 100644--- a/products/dashboards/frontend/widgets/error_tracking/EditErrorTrackingWidgetModal.tsx+++ b/products/dashboards/frontend/widgets/error_tracking/EditErrorTrackingWidgetModal.tsx@@ -8,8 +8,8 @@ import { LemonModal } from 'lib/lemon-ui/LemonModal'import { LemonSelect } from 'lib/lemon-ui/LemonSelect'import { getDashboardWidgetGroupLabel } from '../../widget_types/catalog'-import { WIDGET_DATE_RANGE_SELECT_OPTIONS } from '../../widget_types/configSchemas'-import { EditWidgetModalFiltersSection } from '../EditWidgetModalFiltersSection'+import { WIDGET_LIST_ORDER_DIRECTION_OPTIONS } from '../constants'+import { EditWidgetModalFiltersSubsection } from '../EditWidgetModalFiltersSection'import { EditWidgetModalTileDetailsSection } from '../EditWidgetModalTileDetailsSection'import type { DashboardWidgetEditModalProps } from '../registry'import { editErrorTrackingWidgetModalLogic } from './editErrorTrackingWidgetModalLogic'@@ -20,7 +20,7 @@ function EditErrorTrackingWidgetModalContents(): JSX.Element {showIssueSettings,limit,orderBy,- dateFrom,+ orderDirection,tileName,tileDescription,filterTestAccounts,@@ -33,7 +33,7 @@ function EditErrorTrackingWidgetModalContents(): JSX.Element {const {setLimit,setOrderBy,- setDateFrom,+ setOrderDirection,setTileName,setTileDescription,setFilterTestAccounts,@@ -85,65 +85,67 @@ function EditErrorTrackingWidgetModalContents(): JSX.Element {{showIssueSettings ? (<>{showTileDetails ? <LemonDivider className="my-0" /> : null}- <EditWidgetModalFiltersSection- filterTestAccounts={filterTestAccounts}- saving={saving}- setFilterTestAccounts={setFilterTestAccounts}- />- <LemonDivider className="my-0" /><section className="flex flex-col gap-3"><h5 className="text-sm font-semibold m-0">{getDashboardWidgetGroupLabel('error_tracking')}</h5>- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">- <LemonField.Pure- label="Date range"- help="Only include issues seen in this period."- error={activeFieldErrors.dateFrom}+ <div className="flex flex-col gap-4">+ <EditWidgetModalFiltersSubsection+ title="Issue filters"+ filterTestAccounts={filterTestAccounts}+ saving={saving}+ setFilterTestAccounts={setFilterTestAccounts}>- <LemonSelect- fullWidth- value={dateFrom}- onChange={(value) => {- setDateFrom(value)- clearFieldError('dateFrom')- }}- options={WIDGET_DATE_RANGE_SELECT_OPTIONS}- />- </LemonField.Pure>- <LemonField.Pure- label="Number of issues"- help="Show up to 25 issues on the tile."- error={activeFieldErrors.limit}- >- <LemonInput- type="number"- min={1}- max={25}- fullWidth- value={limit}- onChange={(value) => {- setLimit(Number(value))- clearFieldError('limit')- }}- />- </LemonField.Pure>- <LemonField.Pure- className="sm:col-span-2"- label="Sort by"- help="Order issues by this metric within the date range."- error={activeFieldErrors.orderBy}- >- <LemonSelect- fullWidth- value={orderBy}- onChange={(value) => {- setOrderBy(value)- clearFieldError('orderBy')- }}- options={[...ERROR_TRACKING_WIDGET_ORDER_BY_OPTIONS]}- />- </LemonField.Pure>+ <p className="text-sm text-muted m-0 sm:col-span-2">+ Date range, status, and assignee are on the tile filter bar (collapsible on the+ tile). Use this modal for test-account filtering, list size, and sort.+ </p>+ <LemonField.Pure+ label="Number of issues"+ help="Show up to 25 issues on the tile."+ error={activeFieldErrors.limit}+ >+ <LemonInput+ type="number"+ min={1}+ max={25}+ fullWidth+ value={limit}+ onChange={(value) => {+ setLimit(Number(value))+ clearFieldError('limit')+ }}+ />+ </LemonField.Pure>+ </EditWidgetModalFiltersSubsection>+ <div className="flex flex-col gap-3">+ <h6 className="text-xs font-semibold text-muted m-0">Sorting</h6>+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">+ <LemonField.Pure label="Sort direction" help="Ascending or descending sort.">+ <LemonSelect+ fullWidth+ value={orderDirection}+ onChange={(value) => setOrderDirection(value)}+ options={[...WIDGET_LIST_ORDER_DIRECTION_OPTIONS]}+ />+ </LemonField.Pure>+ <LemonField.Pure+ label="Sort by"+ help="Order issues by this metric within the date range."+ error={activeFieldErrors.orderBy}+ >+ <LemonSelect+ fullWidth+ value={orderBy}+ onChange={(value) => {+ setOrderBy(value)+ clearFieldError('orderBy')+ }}+ options={[...ERROR_TRACKING_WIDGET_ORDER_BY_OPTIONS]}+ />+ </LemonField.Pure>+ </div>+ </div></div></section></>diff --git a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.stories.tsx b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.stories.tsxindex e0c105c06c3e..e2c630f6db02 100644--- a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.stories.tsx+++ b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.stories.tsx@@ -14,8 +14,11 @@ import {} from '../../components/WidgetCard/widgetCardStoryFixtures'import { errorTrackingSampleIssues } from '../../components/WidgetCard/widgetOverviewStoryFixtures'import { getDashboardWidgetCatalogEntry, getDashboardWidgetGroupLabel } from '../../widget_types/catalog'+import { useWidgetAvailability } from '../../widget_types/widgetAvailability'+import { DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON } from '../constants'import type { DashboardWidgetComponentProps } from '../registry'import { ErrorTrackingWidget } from './ErrorTrackingWidget'+import { ErrorTrackingWidgetTileFilters } from './ErrorTrackingWidgetTileFilters'const ERROR_TRACKING_CATALOG = getDashboardWidgetCatalogEntry('error_tracking_list')!const DEFAULT_CONFIG = ERROR_TRACKING_CATALOG.defaultConfig as Record<string, unknown>@@ -25,6 +28,8 @@ type ErrorTrackingWidgetTileStoryProps = DashboardWidgetComponentProps & {description?: stringshowDescription?: booleanbody?: ReactNode+ /** When true, tile filter bar matches view-only dashboard access (no edit permissions). */+ tileFiltersReadOnly?: boolean}function ErrorTrackingWidgetTileStory({@@ -32,10 +37,12 @@ function ErrorTrackingWidgetTileStory({description = 'Track the most common errors affecting your users.',showDescription = true,body,+ tileFiltersReadOnly = false,...widgetProps}: ErrorTrackingWidgetTileStoryProps): JSX.Element {const widgetTypeLabel = getDashboardWidgetGroupLabel(ERROR_TRACKING_CATALOG.groupId)const defaultTitle = ERROR_TRACKING_CATALOG.headerTitle ?? ERROR_TRACKING_CATALOG.label+ const { isAvailable: showTileFilters } = useWidgetAvailability(ERROR_TRACKING_CATALOG.availability)return (<WidgetCard className="h-full">@@ -53,6 +60,14 @@ function ErrorTrackingWidgetTileStory({shouldHideMoreButton={widgetCardShouldHideMoreButton(DashboardPlacement.Dashboard, false)}moreButtonOverlay={mockMoreOverlay}/>+ {showTileFilters ? (+ <ErrorTrackingWidgetTileFilters+ tileId={widgetProps.tileId}+ config={widgetProps.config}+ onUpdateConfig={tileFiltersReadOnly ? undefined : widgetProps.onUpdateConfig}+ disabledReason={tileFiltersReadOnly ? DASHBOARD_WIDGET_TILE_FILTERS_READONLY_REASON : undefined}+ />+ ) : null}<WidgetCardBody>{body ?? <ErrorTrackingWidget {...widgetProps} />}</WidgetCardBody></WidgetCard>)@@ -81,7 +96,33 @@ export default metatype Story = StoryObj<typeof ErrorTrackingWidgetTileStory>-export const Populated: Story = {+export const TileFiltersReadOnly: Story = {+ decorators: [withErrorTrackingProjectState(true)],+ args: {+ title: 'Top issues',+ config: {+ ...DEFAULT_CONFIG,+ status: 'resolved',+ dateRange: { date_from: '-30d' },+ },+ tileFiltersReadOnly: true,+ loading: false,+ result: {+ results: errorTrackingSampleIssues,+ hasMore: true,+ limit: 10,+ },+ },+ parameters: {+ docs: {+ description: {+ story: 'Tile filter bar when the viewer lacks dashboard edit access — filters shown as read-only values.',+ },+ },+ },+}++export const Default: Story = {decorators: [withErrorTrackingProjectState(true)],args: {title: 'Top issues',diff --git a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.test.tsx b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.test.tsxindex 05ea91941ee2..c8eca16c3552 100644--- a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.test.tsx+++ b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.test.tsx@@ -52,11 +52,51 @@ describe('ErrorTrackingWidget', () => {tileId={1}config={{ limit: 10 }}loading={false}- result={{ results: [issue], hasMore: true, limit: 10 }}+ result={{ results: [issue], hasMore: false, limit: 10, totalCount: 1, totalCountCapped: false }}/>)expect(screen.getByText('Issue list')).toBeInTheDocument()+ expect(screen.getByText('1 of 1 issue')).toBeInTheDocument()+ })++ it('shows capped total in footer when more issues exist than the count cap', () => {+ render(+ <ErrorTrackingWidget+ tileId={1}+ config={{ limit: 1, status: 'active', dateRange: { date_from: '-7d' } }}+ loading={false}+ result={{ results: [issue], hasMore: true, limit: 1, totalCount: 25, totalCountCapped: true }}+ />+ )++ expect(screen.getByText('1 of 25+ issues')).toBeInTheDocument()+ })++ it('shows lower-bound footer when hasMore and total count was not fetched', () => {+ render(+ <ErrorTrackingWidget+ tileId={1}+ config={{ limit: 1 }}+ loading={false}+ result={{ results: [issue], hasMore: true, limit: 1 }}+ />+ )++ expect(screen.getByText('1+ issue')).toBeInTheDocument()+ })++ it('shows exact total in footer when hasMore and total is known', () => {+ render(+ <ErrorTrackingWidget+ tileId={1}+ config={{ limit: 1 }}+ loading={false}+ result={{ results: [issue], hasMore: true, limit: 1, totalCount: 4, totalCountCapped: false }}+ />+ )++ expect(screen.getByText('1 of 4 issues')).toBeInTheDocument()})it('renders a celebratory empty state when there are no issues', () => {diff --git a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.tsx b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.tsxindex b51ad5444a7c..36c19c4e73cd 100644--- a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.tsx+++ b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidget.tsx@@ -1,4 +1,4 @@-import { useValues } from 'kea'+import { BindLogic, useValues } from 'kea'import type { ReactNode } from 'react'import { Spinner } from '@posthog/lemon-ui'@@ -13,18 +13,36 @@ import { ErrorTrackingIssueListSkeleton } from 'products/error_tracking/frontendimport { exceptionIngestionLogic } from 'products/error_tracking/frontend/components/SetupPrompt/exceptionIngestionLogic'import { ErrorTrackingIngestionPrompt } from 'products/error_tracking/frontend/components/SetupPrompt/SetupPrompt'-import { WidgetCardBodyMessage, WidgetCardContent } from '../../components/WidgetCard'+import {+ WidgetCardBodyMessage,+ WidgetCardContent,+ WidgetContentFooter,+ WidgetListCount,+} from '../../components/WidgetCard'import { WidgetCardProductIntroduction } from '../../components/WidgetCardProductIntroduction/WidgetCardProductIntroduction'import type { DashboardWidgetComponentProps } from '../registry'+import type { WidgetIssueMetadataDelta } from './applyWidgetIssueMetadataChange'+import { parseErrorTrackingWidgetConfig } from './errorTrackingWidgetConfigValidation'+import { errorTrackingWidgetLogic } from './errorTrackingWidgetLogic'import { canConfigureErrorTrackingWidgetIssues } from './utils'type ErrorTrackingWidgetResult = {results?: ErrorTrackingIssue[]hasMore?: booleanlimit?: number+ totalCount?: number+ totalCountCapped?: boolean}-export function ErrorTrackingWidget({ result, loading }: DashboardWidgetComponentProps): JSX.Element {+export function ErrorTrackingWidget({+ tileId,+ result,+ loading,+ config,+ onRefreshData,+ onApplyIssueMetadataChange,+ canMutateErrorTrackingIssues = false,+}: DashboardWidgetComponentProps): JSX.Element {if (loading) {return (<WidgetCardContent>@@ -35,7 +53,28 @@ export function ErrorTrackingWidget({ result, loading }: DashboardWidgetComponenreturn (<ErrorTrackingWidgetSetupGate>- <ErrorTrackingWidgetBody result={result} />+ <BindLogic+ logic={errorTrackingWidgetLogic}+ props={{+ tileId,+ onApplyIssueMetadataChange: onApplyIssueMetadataChange+ ? (issueId: string, delta: WidgetIssueMetadataDelta) => {+ const parsed = parseErrorTrackingWidgetConfig(config)+ onApplyIssueMetadataChange(issueId, delta, {+ statusFilter: parsed.status ?? 'active',+ assigneeFilter: parsed.assignee ?? null,+ })+ }+ : undefined,+ onRefreshData,+ }}+ >+ <ErrorTrackingWidgetBody+ result={result}+ config={config}+ canMutateIssues={canMutateErrorTrackingIssues}+ />+ </BindLogic></ErrorTrackingWidgetSetupGate>)}@@ -70,9 +109,18 @@ function ErrorTrackingWidgetSetupGate({ children }: { children: ReactNode }): JSreturn <>{children}</>}-function ErrorTrackingWidgetBody({ result }: { result: DashboardWidgetComponentProps['result'] }): JSX.Element {+function ErrorTrackingWidgetBody({+ result,+ config,+ canMutateIssues,+}: {+ result: DashboardWidgetComponentProps['result']+ config: DashboardWidgetComponentProps['config']+ canMutateIssues: boolean+}): JSX.Element {const payload = result as ErrorTrackingWidgetResult | null | undefinedconst rows = payload?.results ?? []+ const orderBy = parseErrorTrackingWidgetConfig(config).orderByif (rows.length === 0) {return (@@ -94,8 +142,19 @@ function ErrorTrackingWidgetBody({ result }: { result: DashboardWidgetComponentP}return (- <WidgetCardContent>- <ErrorTrackingIssueList issues={rows} />- </WidgetCardContent>+ <>+ <WidgetCardContent>+ <ErrorTrackingIssueList issues={rows} orderBy={orderBy} canMutateIssues={canMutateIssues} />+ </WidgetCardContent>+ <WidgetContentFooter>+ <WidgetListCount+ shown={rows.length}+ totalCount={payload?.totalCount}+ totalCountIsLowerBound={payload?.totalCountCapped}+ hasMore={payload?.hasMore}+ dataAttr="error-tracking-widget-count"+ />+ </WidgetContentFooter>+ </>)}diff --git a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFilters.test.tsx b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFilters.test.tsxnew file mode 100644index 000000000000..8109c354c6d9--- /dev/null+++ b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFilters.test.tsx@@ -0,0 +1,39 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen } from '@testing-library/react'++import { ErrorTrackingWidgetTileFilters } from './ErrorTrackingWidgetTileFilters'++describe('ErrorTrackingWidgetTileFilters', () => {+ afterEach(() => {+ cleanup()+ })++ it('renders filter controls', () => {+ render(+ <ErrorTrackingWidgetTileFilters+ tileId={1}+ config={{ limit: 10, status: 'active', dateRange: { date_from: '-7d' } }}+ onUpdateConfig={jest.fn()}+ />+ )++ expect(screen.getByText('Last 7 days')).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Hide filters' })).not.toBeInTheDocument()+ })++ it('shows read-only filter values without dropdowns when onUpdateConfig is omitted', () => {+ const { container } = render(+ <ErrorTrackingWidgetTileFilters+ tileId={1}+ config={{ limit: 10, status: 'resolved', dateRange: { date_from: '-7d' } }}+ disabledReason="Read only"+ />+ )++ expect(container.querySelector('[data-attr="error-tracking-widget-tile-filters-readonly"]')).toBeInTheDocument()+ expect(screen.getByText('Last 7 days')).toBeInTheDocument()+ expect(screen.getByText('Resolved')).toBeInTheDocument()+ expect(screen.queryByRole('combobox')).not.toBeInTheDocument()+ })+})diff --git a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFilters.tsx b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFilters.tsxnew file mode 100644index 000000000000..a6f92a0288c8--- /dev/null+++ b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFilters.tsx@@ -0,0 +1,137 @@+import equal from 'fast-deep-equal'+import { useValues } from 'kea'+import { useMemo, useRef } from 'react'++import { quickFiltersLogic } from 'lib/components/QuickFilters/quickFiltersLogic'+import { LemonSelect } from 'lib/lemon-ui/LemonSelect'++import type { ErrorTrackingIssue } from '~/queries/schema/schema-general'++import { ErrorTrackingAssigneeSelectButton } from 'products/error_tracking/frontend/components/Assignee/ErrorTrackingAssigneeSelectButton'+import {+ ErrorTrackingStatusSelect,+ type ErrorTrackingStatusSelectValue,+} from 'products/error_tracking/frontend/components/IssueFilters/Status'++import { WIDGET_DATE_RANGE_SELECT_OPTIONS, type WidgetDateFromValue } from '../../widget_types/configSchemas'+import type { DashboardWidgetTileFiltersProps } from '../registry'+import { WidgetPropertyFiltersSection } from '../WidgetPropertyFiltersSection'+import { getWidgetTileFiltersSetup, useWidgetTileConfigPersist } from '../widgetTileFiltersHooks'+import {+ WidgetDateRangeReadOnlyValue,+ WidgetPropertyFiltersReadOnlyValues,+ WidgetTileFiltersBar,+} from '../widgetTileFiltersReadOnly'+import {+ patchErrorTrackingWidgetFilterFields,+ parseErrorTrackingWidgetConfig,+} from './errorTrackingWidgetConfigValidation'+import {+ ErrorTrackingAssigneeReadOnlyValue,+ ErrorTrackingStatusReadOnlyValue,+} from './ErrorTrackingWidgetTileFiltersReadOnly'++export type ErrorTrackingWidgetTileFiltersProps = DashboardWidgetTileFiltersProps++export function ErrorTrackingWidgetTileFilters({+ config,+ onUpdateConfig,+ disabledReason,+ canMutateErrorTrackingIssues = false,+}: ErrorTrackingWidgetTileFiltersProps): JSX.Element {+ const { context: filterDefinitionsContext, isAllowed } = getWidgetTileFiltersSetup('error_tracking_list')+ const parsed = parseErrorTrackingWidgetConfig(config)+ const dateFrom = (parsed.dateRange?.date_from ?? '-7d') as WidgetDateFromValue+ const status = (parsed.status ?? 'active') as ErrorTrackingStatusSelectValue+ const assignee = parsed.assignee ?? null+ const widgetFilters = parsed.widgetFilters ?? {}++ const { quickFilters: projectFilterDefinitions } = useValues(+ quickFiltersLogic({ context: filterDefinitionsContext })+ )+ const filterDefinitions = useMemo(+ () => projectFilterDefinitions.filter(isAllowed),+ [projectFilterDefinitions, isAllowed]+ )++ const configRef = useRef(config)+ configRef.current = config+ const { persistConfigDebounced, persistConfigNow } = useWidgetTileConfigPersist(onUpdateConfig)++ const controlDisabledReason = disabledReason+ const canUpdate = !!onUpdateConfig && !controlDisabledReason++ const applyPatch = async (patch: Parameters<typeof patchErrorTrackingWidgetFilterFields>[1]): Promise<void> => {+ const nextConfig = patchErrorTrackingWidgetFilterFields(configRef.current, patch)+ configRef.current = nextConfig+ await persistConfigNow(nextConfig)+ }++ const applyWidgetFilters = (nextWidgetFilters: typeof widgetFilters): void => {+ const nextConfig = patchErrorTrackingWidgetFilterFields(configRef.current, { widgetFilters: nextWidgetFilters })+ const current = parseErrorTrackingWidgetConfig(configRef.current)+ if (equal(current.widgetFilters ?? {}, nextWidgetFilters)) {+ return+ }+ configRef.current = nextConfig+ persistConfigDebounced(nextConfig)+ }++ if (!onUpdateConfig) {+ return (+ <WidgetTileFiltersBar dataAttr="error-tracking-widget-tile-filters-readonly">+ <WidgetDateRangeReadOnlyValue dateFrom={dateFrom} />+ <ErrorTrackingStatusReadOnlyValue status={status} />+ <ErrorTrackingAssigneeReadOnlyValue assignee={assignee} />+ {filterDefinitions.length > 0 ? (+ <WidgetPropertyFiltersReadOnlyValues+ filterDefinitions={filterDefinitions}+ widgetFilters={widgetFilters}+ />+ ) : null}+ </WidgetTileFiltersBar>+ )+ }++ return (+ <WidgetTileFiltersBar dataAttr="error-tracking-widget-tile-filters">+ <LemonSelect+ size="small"+ value={dateFrom}+ disabled={!canUpdate}+ disabledReason={controlDisabledReason}+ options={WIDGET_DATE_RANGE_SELECT_OPTIONS}+ onChange={(value) => {+ if (value) {+ void applyPatch({ dateFrom: value })+ }+ }}+ />+ <ErrorTrackingStatusSelect+ value={status}+ disabled={!canUpdate}+ disabledReason={controlDisabledReason}+ onChange={(value) => {+ void applyPatch({ status: value })+ }}+ />+ {canMutateErrorTrackingIssues ? (+ <ErrorTrackingAssigneeSelectButton+ assignee={assignee}+ onChange={(value: ErrorTrackingIssue['assignee']) => {+ void applyPatch({ assignee: value ?? null })+ }}+ />+ ) : (+ <ErrorTrackingAssigneeReadOnlyValue assignee={assignee} />+ )}+ {filterDefinitions.length > 0 ? (+ <WidgetPropertyFiltersSection+ filterDefinitions={filterDefinitions}+ widgetFilters={widgetFilters}+ onWidgetFiltersChange={applyWidgetFilters}+ />+ ) : null}+ </WidgetTileFiltersBar>+ )+}diff --git a/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFiltersReadOnly.tsx b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFiltersReadOnly.tsxnew file mode 100644index 000000000000..1ab4f3000e9b--- /dev/null+++ b/products/dashboards/frontend/widgets/error_tracking/ErrorTrackingWidgetTileFiltersReadOnly.tsx@@ -0,0 +1,50 @@+import type { ErrorTrackingIssue } from '~/queries/schema/schema-general'++import {+ AssigneeIconDisplay,+ AssigneeLabelDisplay,+ AssigneeResolver,+} from 'products/error_tracking/frontend/components/Assignee/AssigneeDisplay'+import { LabelIndicator, StatusIndicator } from 'products/error_tracking/frontend/components/Indicators'+import type { ErrorTrackingStatusSelectValue } from 'products/error_tracking/frontend/components/IssueFilters/Status'++import { WidgetTileFilterReadOnlyValue } from '../widgetTileFiltersReadOnly'++export function ErrorTrackingStatusReadOnlyValue({ status }: { status: ErrorTrackingStatusSelectValue }): JSX.Element {+ if (status === 'all') {+ return (+ <WidgetTileFilterReadOnlyValue>+ <LabelIndicator intent="muted" label="All" size="small" />+ </WidgetTileFilterReadOnlyValue>+ )+ }+ return (+ <WidgetTileFilterReadOnlyValue>+ <StatusIndicator status={status} size="small" />+ </WidgetTileFilterReadOnlyValue>+ )+}++export function ErrorTrackingAssigneeReadOnlyValue({+ assignee,+}: {+ assignee: ErrorTrackingIssue['assignee']+}): JSX.Element {+ return (+ <WidgetTileFilterReadOnlyValue>+ <AssigneeResolver assignee={assignee}>+ {({ assignee: resolvedAssignee }) => (+ <>+ <AssigneeIconDisplay assignee={resolvedAssignee} size="small" />+ <AssigneeLabelDisplay+ assignee={resolvedAssignee}+ placeholder="Any assignee"+ size="small"+ className="text-primary"+ />+ </>+ )}+ </AssigneeResolver>+ </WidgetTileFilterReadOnlyValue>+ )+}diff --git a/products/dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange.test.ts b/products/dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange.test.tsnew file mode 100644index 000000000000..51880a5af40f--- /dev/null+++ b/products/dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange.test.ts@@ -0,0 +1,65 @@+import type { ErrorTrackingIssue } from '~/queries/schema/schema-general'++import { errorTrackingSampleIssues } from '../../components/WidgetCard/widgetOverviewStoryFixtures'+import { applyIssueMetadataToWidgetListResult } from './applyWidgetIssueMetadataChange'++describe('applyIssueMetadataToWidgetListResult', () => {+ const baseResult = {+ results: errorTrackingSampleIssues.slice(0, 2).map((issue, index) => ({+ ...issue,+ id: index === 0 ? 'a' : 'b',+ name: index === 0 ? 'Error A' : 'Error B',+ })) as ErrorTrackingIssue[],+ hasMore: false,+ }++ it('updates assignee in place', () => {+ const assignee = { type: 'user' as const, id: 7 }+ const next = applyIssueMetadataToWidgetListResult(baseResult, 'a', { assignee }, { statusFilter: 'active' })+ expect(next.results?.[0]?.assignee).toEqual(assignee)+ expect(next.results?.[1]?.assignee).toBeNull()+ })++ it('removes the issue when status no longer matches the tile filter', () => {+ const next = applyIssueMetadataToWidgetListResult(+ { ...baseResult, totalCount: 2 },+ 'a',+ { status: 'resolved' },+ { statusFilter: 'active' }+ )+ expect(next.results).toHaveLength(1)+ expect(next.results?.[0]?.id).toBe('b')+ expect(next.totalCount).toBe(1)+ })++ it('keeps resolved issues when tile filter is all', () => {+ const next = applyIssueMetadataToWidgetListResult(+ baseResult,+ 'a',+ { status: 'resolved' },+ { statusFilter: 'all' }+ )+ expect(next.results?.[0]?.status).toBe('resolved')+ })++ it('removes the issue when assignee no longer matches the tile filter', () => {+ const next = applyIssueMetadataToWidgetListResult(+ {+ ...baseResult,+ results: [+ {+ ...errorTrackingSampleIssues[0],+ id: 'a',+ status: 'active',+ assignee: { type: 'user', id: 1 },+ name: 'Error A',+ } as ErrorTrackingIssue,+ ],+ },+ 'a',+ { assignee: { type: 'user', id: 2 } },+ { statusFilter: 'active', assigneeFilter: { type: 'user', id: 1 } }+ )+ expect(next.results).toEqual([])+ })+})diff --git a/products/dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange.ts b/products/dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange.tsnew file mode 100644index 000000000000..daabe07eee63--- /dev/null+++ b/products/dashboards/frontend/widgets/error_tracking/applyWidgetIssueMetadataChange.ts@@ -0,0 +1,69 @@+import type { ErrorTrackingIssue } from '~/queries/schema/schema-general'++export type ErrorTrackingWidgetListResult = {+ results?: ErrorTrackingIssue[]+ hasMore?: boolean+ limit?: number+ totalCount?: number+ totalCountCapped?: boolean+}++export type WidgetIssueMetadataDelta = {+ status?: ErrorTrackingIssue['status']+ assignee?: ErrorTrackingIssue['assignee'] | null+}++export type WidgetIssueMetadataContext = {+ statusFilter: string+ assigneeFilter?: ErrorTrackingIssue['assignee'] | null+}++function issueAssigneeMatchesFilter(+ issueAssignee: ErrorTrackingIssue['assignee'] | null | undefined,+ assigneeFilter: ErrorTrackingIssue['assignee'] | null | undefined+): boolean {+ if (!assigneeFilter) {+ return true+ }+ if (!issueAssignee) {+ return false+ }+ return issueAssignee.type === assigneeFilter.type && issueAssignee.id === assigneeFilter.id+}++export function issueMatchesWidgetTileFilters(+ issue: Pick<ErrorTrackingIssue, 'status' | 'assignee'>,+ context: WidgetIssueMetadataContext+): boolean {+ if (context.statusFilter !== 'all' && issue.status !== context.statusFilter) {+ return false+ }+ return issueAssigneeMatchesFilter(issue.assignee, context.assigneeFilter)+}++export function applyIssueMetadataToWidgetListResult(+ result: ErrorTrackingWidgetListResult,+ issueId: string,+ delta: WidgetIssueMetadataDelta,+ context: WidgetIssueMetadataContext+): ErrorTrackingWidgetListResult {+ const results = result.results ?? []+ if (!results.some((issue) => issue.id === issueId)) {+ return result+ }++ const updated = results.map((issue) => (issue.id === issueId ? { ...issue, ...delta } : issue))++ const patchedIssue = updated.find((issue) => issue.id === issueId)+ const shouldRemoveFromFilteredList =+ patchedIssue !== undefined && !issueMatchesWidgetTileFilters(patchedIssue, context)++ return {+ ...result,+ results: shouldRemoveFromFilteredList ? updated.filter((issue) => issue.id !== issueId) : updated,+ totalCount:+ shouldRemoveFromFilteredList && result.totalCount !== undefined+ ? Math.max(0, result.totalCount - 1)+ : result.totalCount,+ }+}diff --git a/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts b/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.tsindex 11ea648afa06..d5ada4f6b82d 100644--- a/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts+++ b/products/dashboards/frontend/widgets/error_tracking/editErrorTrackingWidgetModalLogic.ts@@ -6,18 +6,15 @@ import { teamLogic } from 'scenes/teamLogic'import { exceptionIngestionLogic } from 'products/error_tracking/frontend/components/SetupPrompt/exceptionIngestionLogic'import { isWidgetConfigValidationError } from '../../utils'-import {- resolveWidgetFilterTestAccounts,- type ErrorTrackingWidgetConfig,- type WidgetDateFromValue,-} from '../../widget_types/configSchemas'+import { resolveWidgetFilterTestAccounts, type ErrorTrackingWidgetConfig } from '../../widget_types/configSchemas'import {widgetEditModalFilterTestAccountsActions,widgetEditModalListFieldActions,widgetEditModalPropSelectors,widgetEditModalTileActions,+ buildWidgetTileMetadataPatch,+ getWidgetEditModalTileDefaults,} from '../editWidgetModalBuilders'-import { buildWidgetTileMetadataPatch, getWidgetEditModalTileDefaults } from '../editWidgetModalTileUtils'import type { DashboardWidgetEditModalProps } from '../registry'import type { editErrorTrackingWidgetModalLogicType } from './editErrorTrackingWidgetModalLogicType'import {@@ -41,7 +38,7 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModadescription: '',} as EditErrorTrackingWidgetModalLogicProps),- connect({+ connect(() => ({values: [teamLogic,['currentTeam'],@@ -50,10 +47,11 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModaexceptionIngestionLogic,['hasSentExceptionEvent', 'hasSentExceptionEventLoading'],],- }),+ })),actions({setOrderBy: (orderBy: string) => ({ orderBy }),+ setOrderDirection: (orderDirection: ErrorTrackingWidgetConfig['orderDirection']) => ({ orderDirection }),...widgetEditModalListFieldActions,...widgetEditModalTileActions,...widgetEditModalFilterTestAccountsActions,@@ -74,17 +72,19 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModa): ErrorTrackingWidgetConfig['orderBy'] => orderBy as ErrorTrackingWidgetConfig['orderBy'],},],- limit: [- 10,+ orderDirection: [+ 'DESC' as ErrorTrackingWidgetConfig['orderDirection'],{- setLimit: (_: number, { limit }: { limit: number }) => limit,+ setOrderDirection: (+ _: ErrorTrackingWidgetConfig['orderDirection'],+ { orderDirection }: { orderDirection: ErrorTrackingWidgetConfig['orderDirection'] }+ ): ErrorTrackingWidgetConfig['orderDirection'] => orderDirection,},],- dateFrom: [- '-7d',+ limit: [+ 10,{- setDateFrom: (_: WidgetDateFromValue, { dateFrom }: { dateFrom: string }): WidgetDateFromValue =>- dateFrom as WidgetDateFromValue,+ setLimit: (_: number, { limit }: { limit: number }) => limit,},],tileName: [@@ -129,9 +129,9 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModasaving: [false,{- submit: (_state: boolean, _payload: { value: true }) => true,- submitSuccess: (_state: boolean, _payload: { value: true }) => false,- submitFailure: (_state: boolean, _payload: { value: true }) => false,+ submit: () => true,+ submitSuccess: () => false,+ submitFailure: () => false,},],}),@@ -150,12 +150,12 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModa],...widgetEditModalPropSelectors,validation: [- (s) => [s.limit, s.orderBy, s.dateFrom, s.filterTestAccounts, s.widgetConfig],- (limit, orderBy, dateFrom, filterTestAccounts, widgetConfig) =>+ (s) => [s.limit, s.orderBy, s.orderDirection, s.filterTestAccounts, s.widgetConfig],+ (limit, orderBy, orderDirection, filterTestAccounts, widgetConfig) =>validateErrorTrackingWidgetConfigInput({limit,orderBy,- dateFrom,+ orderDirection,filterTestAccounts,baseConfig: widgetConfig,}),@@ -185,11 +185,10 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModadefaults(({ props, values }) => {const baseConfig = parseErrorTrackingWidgetConfig(props.config)-return {limit: baseConfig.limit,orderBy: baseConfig.orderBy,- dateFrom: baseConfig.dateRange?.date_from ?? '-7d',+ orderDirection: baseConfig.orderDirection,...getWidgetEditModalTileDefaults(props),filterTestAccounts: resolveWidgetFilterTestAccounts(baseConfig.filterTestAccounts,@@ -202,13 +201,7 @@ export const editErrorTrackingWidgetModalLogic = kea<editErrorTrackingWidgetModalisteners(({ actions, props, values }) => ({submit: async () => {- const result = validateErrorTrackingWidgetConfigInput({- limit: values.limit,- orderBy: values.orderBy,- dateFrom: values.dateFrom,- filterTestAccounts: values.filterTestAccounts,- baseConfig: values.widgetConfig,- })+ const result = values.validationif (!result.success) {actions.setFieldErrors(result.fieldErrors)diff --git a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.test.ts b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.test.tsindex b9734eabee43..214a25ebe646 100644--- a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.test.ts+++ b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.test.ts@@ -1,8 +1,11 @@import { ApiError } from 'lib/api-error'+import { PropertyOperator } from '~/types'+import { errorTrackingWidgetConfigSchema } from '../../widget_types/configSchemas'import {parseErrorTrackingWidgetConfigApiError,+ patchErrorTrackingWidgetFilterFields,validateErrorTrackingWidgetConfigInput,} from './errorTrackingWidgetConfigValidation'@@ -11,7 +14,7 @@ describe('validateErrorTrackingWidgetConfigInput', () => {const result = validateErrorTrackingWidgetConfigInput({limit: 30,orderBy: 'occurrences',- dateFrom: '-7d',+ orderDirection: 'DESC',filterTestAccounts: true,baseConfig: errorTrackingWidgetConfigSchema.parse({}),})@@ -26,15 +29,19 @@ describe('validateErrorTrackingWidgetConfigInput', () => {const result = validateErrorTrackingWidgetConfigInput({limit: 10,orderBy: 'occurrences',- dateFrom: '-7d',+ orderDirection: 'DESC',filterTestAccounts: true,- baseConfig: errorTrackingWidgetConfigSchema.parse({}),+ baseConfig: errorTrackingWidgetConfigSchema.parse({+ dateRange: { date_from: '-30d' },+ status: 'resolved',+ }),})expect(result.success).toBe(true)if (result.success) {expect(result.config.limit).toBe(10)- expect(result.config.dateRange).toEqual({ date_from: '-7d' })+ expect(result.config.dateRange).toEqual({ date_from: '-30d' })+ expect(result.config.status).toBe('resolved')expect(result.config.filterTestAccounts).toBe(true)}})@@ -51,21 +58,6 @@ describe('validateErrorTrackingWidgetConfigInput', () => {expect(result.data.filterTestAccounts).toBeUndefined()}})-- it('accepts short date range', () => {- const result = validateErrorTrackingWidgetConfigInput({- limit: 10,- orderBy: 'occurrences',- dateFrom: '-1h',- filterTestAccounts: true,- baseConfig: errorTrackingWidgetConfigSchema.parse({}),- })-- expect(result.success).toBe(true)- if (result.success) {- expect(result.config.dateRange).toEqual({ date_from: '-1h' })- }- })})describe('parseErrorTrackingWidgetConfigApiError', () => {@@ -78,6 +70,8 @@ describe('parseErrorTrackingWidgetConfigApiError', () => {parseErrorTrackingWidgetConfigApiError(error, {limit: 30,orderBy: 'occurrences',+ orderDirection: 'DESC',+ status: 'active',dateRange: { date_from: '-7d' },})).toEqual({@@ -85,3 +79,39 @@ describe('parseErrorTrackingWidgetConfigApiError', () => {})})})++describe('patchErrorTrackingWidgetFilterFields', () => {+ it('updates status while preserving sort fields', () => {+ const base = errorTrackingWidgetConfigSchema.parse({+ limit: 5,+ orderBy: 'users',+ status: 'active',+ dateRange: { date_from: '-7d' },+ })+ const next = patchErrorTrackingWidgetFilterFields(base, { status: 'resolved' })+ expect(next.status).toBe('resolved')+ expect(next.limit).toBe(5)+ expect(next.orderBy).toBe('users')+ })++ it('persists widgetFilters patch on tile config', () => {+ const base = errorTrackingWidgetConfigSchema.parse({+ limit: 5,+ orderBy: 'occurrences',+ status: 'active',+ dateRange: { date_from: '-7d' },+ })+ const next = patchErrorTrackingWidgetFilterFields(base, {+ widgetFilters: {+ 'qf-1': {+ filterId: 'qf-1',+ propertyName: '$environment',+ optionId: 'opt-1',+ value: 'production',+ operator: PropertyOperator.Exact,+ },+ },+ })+ expect(next.widgetFilters?.['qf-1']?.propertyName).toBe('$environment')+ })+})diff --git a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.ts b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.tsindex 858566b76748..8a1d8ba053f9 100644--- a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.ts+++ b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetConfigValidation.ts@@ -1,47 +1,99 @@import { z } from 'zod'+import type { ErrorTrackingQuery } from '~/queries/schema/schema-general'+import {errorTrackingWidgetConfigSchema,errorTrackingWidgetFormSchema,type ErrorTrackingWidgetConfig,+ type StoredWidgetFilter,} from '../../widget_types/configSchemas'++export type ErrorTrackingWidgetFormStatus = NonNullable<ErrorTrackingQuery['status']> | 'all'import {- buildWidgetConfigFromForm,+ fieldErrorsFromZodError,parseWidgetConfig,parseWidgetConfigApiError,type WidgetListFormInput,- validateWidgetConfigInput as validateWidgetConfigInputShared,} from '../widgetConfigValidation'type ErrorTrackingWidgetFormField = keyof z.infer<typeof errorTrackingWidgetFormSchema>export type ErrorTrackingWidgetFieldErrors = Partial<Record<ErrorTrackingWidgetFormField, string>>+export type ErrorTrackingWidgetFormInput = WidgetListFormInput & {+ orderDirection: ErrorTrackingWidgetConfig['orderDirection']+}++const errorTrackingConfigDefaults = errorTrackingWidgetConfigSchema.parse({})+export function parseErrorTrackingWidgetConfig(config: Record<string, unknown>): ErrorTrackingWidgetConfig {return parseWidgetConfig(errorTrackingWidgetConfigSchema, config)}+export function patchErrorTrackingWidgetFilterFields(+ config: Record<string, unknown>,+ patch: {+ dateFrom?: string+ status?: ErrorTrackingWidgetFormStatus+ assignee?: ErrorTrackingWidgetConfig['assignee'] | null+ widgetFilters?: Record<string, StoredWidgetFilter>+ }+): ErrorTrackingWidgetConfig {+ const base = parseErrorTrackingWidgetConfig(config)++ return errorTrackingWidgetConfigSchema.parse({+ ...base,+ dateRange: { date_from: patch.dateFrom ?? base.dateRange?.date_from ?? '-7d' },+ status: patch.status ?? base.status ?? errorTrackingConfigDefaults.status,+ assignee: patch.assignee !== undefined ? (patch.assignee ?? undefined) : base.assignee,+ widgetFilters: patch.widgetFilters ?? base.widgetFilters ?? {},+ })+}+export function buildErrorTrackingWidgetConfig(- formInput: WidgetListFormInput,+ formInput: ErrorTrackingWidgetFormInput,baseConfig: ErrorTrackingWidgetConfig): ErrorTrackingWidgetConfig {- return buildWidgetConfigFromForm(errorTrackingWidgetConfigSchema, formInput, baseConfig)+ return errorTrackingWidgetConfigSchema.parse({+ ...baseConfig,+ limit: formInput.limit,+ orderBy: formInput.orderBy,+ orderDirection: formInput.orderDirection,+ filterTestAccounts: formInput.filterTestAccounts,+ })}export function validateErrorTrackingWidgetConfigInput(input: {limit: numberorderBy: string- dateFrom: string+ orderDirection: stringfilterTestAccounts: booleanbaseConfig: ErrorTrackingWidgetConfig}):| { success: true; config: ErrorTrackingWidgetConfig }| { success: false; fieldErrors: ErrorTrackingWidgetFieldErrors } {- return validateWidgetConfigInputShared({- formSchema: errorTrackingWidgetFormSchema,- buildConfig: buildErrorTrackingWidgetConfig,- input,+ const parsed = errorTrackingWidgetFormSchema.safeParse({+ limit: input.limit,+ orderBy: input.orderBy,+ dateFrom: input.baseConfig.dateRange?.date_from ?? '-7d',+ filterTestAccounts: input.filterTestAccounts,})++ if (!parsed.success) {+ return { success: false, fieldErrors: fieldErrorsFromZodError(parsed.error) }+ }++ return {+ success: true,+ config: buildErrorTrackingWidgetConfig(+ {+ ...parsed.data,+ orderDirection: input.orderDirection as ErrorTrackingWidgetConfig['orderDirection'],+ },+ input.baseConfig+ ),+ }}export function parseErrorTrackingWidgetConfigApiError(@@ -53,6 +105,6 @@ export function parseErrorTrackingWidgetConfigApiError(config,configSchema: errorTrackingWidgetConfigSchema,formSchema: errorTrackingWidgetFormSchema,- defaultOrderBy: 'occurrences',+ defaultOrderBy: errorTrackingConfigDefaults.orderBy,})}diff --git a/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.tsnew file mode 100644index 000000000000..660bb5de5ad6--- /dev/null+++ b/products/dashboards/frontend/widgets/error_tracking/errorTrackingWidgetLogic.ts@@ -0,0 +1,44 @@+import { connect, kea, key, listeners, path, props } from 'kea'++import { issueActionsLogic } from 'products/error_tracking/frontend/components/IssueActions/issueActionsLogic'++import type { WidgetIssueMetadataDelta } from './applyWidgetIssueMetadataChange'+import type { errorTrackingWidgetLogicType } from './errorTrackingWidgetLogicType'++export type ErrorTrackingWidgetLogicProps = {+ tileId: number+ onApplyIssueMetadataChange?: (issueId: string, delta: WidgetIssueMetadataDelta) => void+ onRefreshData?: () => void+}++const ISSUE_METADATA_MUTATIONS = new Set(['updateIssueStatus', 'updateIssueAssignee'])++export const errorTrackingWidgetLogic = kea<errorTrackingWidgetLogicType>([+ path(['products', 'dashboards', 'widgets', 'error_tracking', 'errorTrackingWidgetLogic']),+ key((props) => String(props.tileId)),++ props({+ tileId: 0,+ onApplyIssueMetadataChange: undefined,+ onRefreshData: undefined,+ } as ErrorTrackingWidgetLogicProps),++ connect({+ actions: [issueActionsLogic, ['updateIssueStatus', 'updateIssueAssignee', 'mutationFailure']],+ }),++ listeners(({ props }) => ({+ updateIssueStatus: ({ id, status }) => {+ props.onApplyIssueMetadataChange?.(id, { status })+ },+ updateIssueAssignee: ({ id, assignee }) => {+ props.onApplyIssueMetadataChange?.(id, { assignee })+ },+ mutationFailure: ({ mutationName }) => {+ if (!props.onRefreshData || !ISSUE_METADATA_MUTATIONS.has(mutationName)) {+ return+ }+ props.onRefreshData()+ },+ })),+])diff --git a/products/dashboards/frontend/widgets/registry.test.tsx b/products/dashboards/frontend/widgets/registry.test.tsxindex 84eae7ce92aa..82aa3c92b1a9 100644--- a/products/dashboards/frontend/widgets/registry.test.tsx+++ b/products/dashboards/frontend/widgets/registry.test.tsx@@ -21,6 +21,8 @@ describe('dashboard widget registry', () => {const definition = getDashboardWidgetDefinition('error_tracking_list')expect(definition?.Component).toBeTruthy()expect(definition?.EditModal).toBeTruthy()+ expect(definition?.TileFilters).toBeTruthy()+ expect(DASHBOARD_WIDGET_CATALOG.error_tracking_list.tileFilters).toBeTruthy()expect(definition?.productAccess).toBe('error_tracking')expect(definition?.parseConfigApiError).toBeTruthy()expect(posthog.captureException).not.toHaveBeenCalled()@@ -30,10 +32,22 @@ describe('dashboard widget registry', () => {const definition = getDashboardWidgetDefinition('session_replay_list')expect(definition?.Component).toBeTruthy()expect(definition?.EditModal).toBeTruthy()+ expect(definition?.TileFilters).toBeTruthy()+ expect(DASHBOARD_WIDGET_CATALOG.session_replay_list.tileFilters).toBeTruthy()expect(definition?.productAccess).toBe('session_recording')expect(definition?.parseConfigApiError).toBeTruthy()})+ it('defines tileFilters catalog config for every widget with TileFilters', () => {+ for (const key of Object.keys(DASHBOARD_WIDGET_CATALOG) as Array<keyof typeof DASHBOARD_WIDGET_CATALOG>) {+ const definition = getDashboardWidgetDefinition(key)+ if (!definition?.TileFilters) {+ continue+ }+ expect(DASHBOARD_WIDGET_CATALOG[key].tileFilters?.allowedPropertyNames.length).toBeGreaterThan(0)+ }+ })+it('delegates config api error parsing to the widget registry entry', () => {expect(parseDashboardWidgetConfigApiError('unknown_widget_type', new Error('nope'), {})).toBeNull()expect(parseDashboardWidgetConfigApiError('error_tracking_list', new Error('nope'), {})).toBeNull()diff --git a/products/dashboards/frontend/widgets/registry.tsx b/products/dashboards/frontend/widgets/registry.tsxindex 77f33681b84a..df0f7b81724b 100644--- a/products/dashboards/frontend/widgets/registry.tsx+++ b/products/dashboards/frontend/widgets/registry.tsx@@ -4,12 +4,25 @@ import type { ComponentType } from 'react'import type { DashboardWidgetProductAccess } from '../types'import { DASHBOARD_WIDGET_CATALOG, type DashboardWidgetCatalogKey } from '../widget_types/catalog'import type { WidgetAvailabilityConfig } from '../widget_types/widgetAvailability'+export type DashboardWidgetTileFiltersProps = {+ tileId: number+ config: Record<string, unknown>+ onUpdateConfig?: (config: Record<string, unknown>) => void | Promise<void>+ disabledReason?: string | null+ canMutateErrorTrackingIssues?: boolean+}+import type {+ WidgetIssueMetadataContext,+ WidgetIssueMetadataDelta,+} from './error_tracking/applyWidgetIssueMetadataChange'import { EditErrorTrackingWidgetModal } from './error_tracking/EditErrorTrackingWidgetModal'import { ErrorTrackingWidget } from './error_tracking/ErrorTrackingWidget'import { parseErrorTrackingWidgetConfigApiError } from './error_tracking/errorTrackingWidgetConfigValidation'+import { ErrorTrackingWidgetTileFilters } from './error_tracking/ErrorTrackingWidgetTileFilters'import { EditSessionReplayWidgetModal } from './session_replay/EditSessionReplayWidgetModal'import { SessionReplayWidget } from './session_replay/SessionReplayWidget'import { parseSessionReplayWidgetConfigApiError } from './session_replay/sessionReplayWidgetConfigValidation'+import { SessionReplayWidgetTileFilters } from './session_replay/SessionReplayWidgetTileFilters'export type DashboardWidgetConfigApiErrorParser = (error: unknown,@@ -60,6 +73,7 @@ function reportMissingDashboardWidgetRegistryEntry(export type DashboardWidgetDefinition = {Component: ComponentType<DashboardWidgetComponentProps>+ TileFilters?: ComponentType<DashboardWidgetTileFiltersProps>EditModal?: ComponentType<DashboardWidgetEditModalProps>productAccess?: DashboardWidgetProductAccess/** Maps dashboard PATCH API errors to edit-modal field errors for this widget type. */@@ -75,6 +89,16 @@ export type DashboardWidgetComponentProps = {loading: booleanerror?: string | nullonRefresh?: () => void+ /** Debounced run_widgets refresh after tile data changes (filters). */+ onRefreshData?: () => void+ /** Error tracking list only — optimistic row patch after status/assignee edits. */+ onApplyIssueMetadataChange?: (+ issueId: string,+ delta: WidgetIssueMetadataDelta,+ context: WidgetIssueMetadataContext+ ) => void+ /** Error tracking list only — status/assignee controls when false stay read-only. */+ canMutateErrorTrackingIssues?: booleanonUpdateConfig?: (config: Record<string, unknown>) => void | Promise<void>}@@ -101,12 +125,14 @@ export type DashboardWidgetEditModalProps = {export const DASHBOARD_WIDGET_REGISTRY = {error_tracking_list: {Component: ErrorTrackingWidget,+ TileFilters: ErrorTrackingWidgetTileFilters,EditModal: EditErrorTrackingWidgetModal,productAccess: 'error_tracking',parseConfigApiError: parseErrorTrackingWidgetConfigApiError,},session_replay_list: {Component: SessionReplayWidget,+ TileFilters: SessionReplayWidgetTileFilters,EditModal: EditSessionReplayWidgetModal,productAccess: 'session_recording',parseConfigApiError: parseSessionReplayWidgetConfigApiError,diff --git a/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.test.tsx b/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.test.tsxindex f7da41f02236..6d4f55b6e5f0 100644--- a/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.test.tsx+++ b/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.test.tsx@@ -57,6 +57,7 @@ describe('EditSessionReplayWidgetModal', () => {expect.objectContaining({limit: 10,orderBy: 'start_time',+ orderDirection: 'DESC',filterTestAccounts: true,dateRange: { date_from: '-7d' },}),diff --git a/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.tsx b/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.tsxindex ce2b7eb0dd72..7219b92e51c4 100644--- a/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.tsx+++ b/products/dashboards/frontend/widgets/session_replay/EditSessionReplayWidgetModal.tsx@@ -8,18 +8,25 @@ import { LemonModal } from 'lib/lemon-ui/LemonModal'import { LemonSelect } from 'lib/lemon-ui/LemonSelect'import { getDashboardWidgetGroupLabel } from '../../widget_types/catalog'-import { WIDGET_DATE_RANGE_SELECT_OPTIONS } from '../../widget_types/configSchemas'-import { EditWidgetModalFiltersSection } from '../EditWidgetModalFiltersSection'+import { WIDGET_LIST_ORDER_DIRECTION_OPTIONS } from '../constants'+import { EditWidgetModalFiltersSubsection } from '../EditWidgetModalFiltersSection'import { EditWidgetModalTileDetailsSection } from '../EditWidgetModalTileDetailsSection'import type { DashboardWidgetEditModalProps } from '../registry'import { editSessionReplayWidgetModalLogic } from './editSessionReplayWidgetModalLogic'-import { SESSION_REPLAY_WIDGET_ORDER_BY_OPTIONS } from './utils'++export const SESSION_REPLAY_WIDGET_ORDER_BY_OPTIONS = [+ { value: 'start_time', label: 'Start time' },+ { value: 'activity_score', label: 'Activity score' },+ { value: 'recording_duration', label: 'Duration' },+ { value: 'click_count', label: 'Clicks' },+ { value: 'console_error_count', label: 'Console errors' },+] as constfunction EditSessionReplayWidgetModalContents(): JSX.Element {const {limit,orderBy,- dateFrom,+ orderDirection,tileName,tileDescription,filterTestAccounts,@@ -32,7 +39,7 @@ function EditSessionReplayWidgetModalContents(): JSX.Element {const {setLimit,setOrderBy,- setDateFrom,+ setOrderDirection,setTileName,setTileDescription,setFilterTestAccounts,@@ -78,63 +85,65 @@ function EditSessionReplayWidgetModalContents(): JSX.Element {/>) : null}{showTileDetails ? <LemonDivider className="my-0" /> : null}- <EditWidgetModalFiltersSection- filterTestAccounts={filterTestAccounts}- saving={saving}- setFilterTestAccounts={setFilterTestAccounts}- />- <LemonDivider className="my-0" /><section className="flex flex-col gap-3"><h5 className="text-sm font-semibold m-0">{getDashboardWidgetGroupLabel('session_replay')}</h5>- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">- <LemonField.Pure- label="Date range"- help="Only include recordings started in this period."- error={activeFieldErrors.dateFrom}- >- <LemonSelect- fullWidth- value={dateFrom}- onChange={(value) => {- setDateFrom(value)- clearFieldError('dateFrom')- }}- options={WIDGET_DATE_RANGE_SELECT_OPTIONS}- />- </LemonField.Pure>- <LemonField.Pure- label="Number of recordings"- help="Show up to 25 recordings on the tile."- error={activeFieldErrors.limit}- >- <LemonInput- type="number"- min={1}- max={25}- fullWidth- value={limit}- onChange={(value) => {- setLimit(Number(value))- clearFieldError('limit')- }}- />- </LemonField.Pure>- <LemonField.Pure- className="sm:col-span-2"- label="Sort by"- help="Order recordings by this metric within the date range."- error={activeFieldErrors.orderBy}+ <div className="flex flex-col gap-4">+ <EditWidgetModalFiltersSubsection+ title="Recording filters"+ filterTestAccounts={filterTestAccounts}+ saving={saving}+ setFilterTestAccounts={setFilterTestAccounts}>- <LemonSelect- fullWidth- value={orderBy}- onChange={(value) => {- setOrderBy(value)- clearFieldError('orderBy')- }}- options={[...SESSION_REPLAY_WIDGET_ORDER_BY_OPTIONS]}- />- </LemonField.Pure>+ <p className="text-sm text-muted m-0 sm:col-span-2">+ Date range and property filters are on the tile filter bar (collapsible on the tile).+ Use this modal for test-account filtering, list size, and sort.+ </p>+ <LemonField.Pure+ label="Number of recordings"+ help="Show up to 25 recordings on the tile."+ error={activeFieldErrors.limit}+ >+ <LemonInput+ type="number"+ min={1}+ max={25}+ fullWidth+ value={limit}+ onChange={(value) => {+ setLimit(Number(value))+ clearFieldError('limit')+ }}+ />+ </LemonField.Pure>+ </EditWidgetModalFiltersSubsection>+ <div className="flex flex-col gap-3">+ <h6 className="text-xs font-semibold text-muted m-0">Sorting</h6>+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">+ <LemonField.Pure label="Sort direction" help="Ascending or descending sort.">+ <LemonSelect+ fullWidth+ value={orderDirection}+ onChange={(value) => setOrderDirection(value)}+ options={[...WIDGET_LIST_ORDER_DIRECTION_OPTIONS]}+ />+ </LemonField.Pure>+ <LemonField.Pure+ label="Sort by"+ help="Order recordings by this metric within the date range."+ error={activeFieldErrors.orderBy}+ >+ <LemonSelect+ fullWidth+ value={orderBy}+ onChange={(value) => {+ setOrderBy(value)+ clearFieldError('orderBy')+ }}+ options={[...SESSION_REPLAY_WIDGET_ORDER_BY_OPTIONS]}+ />+ </LemonField.Pure>+ </div>+ </div></div></section></div>diff --git a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidgetTileFilters.test.tsx b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidgetTileFilters.test.tsxnew file mode 100644index 000000000000..47757a9073eb--- /dev/null+++ b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidgetTileFilters.test.tsx@@ -0,0 +1,38 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen } from '@testing-library/react'++import { SessionReplayWidgetTileFilters } from './SessionReplayWidgetTileFilters'++describe('SessionReplayWidgetTileFilters', () => {+ afterEach(() => {+ cleanup()+ })++ it('renders date range control', () => {+ render(+ <SessionReplayWidgetTileFilters+ tileId={42}+ config={{ limit: 10, dateRange: { date_from: '-7d' } }}+ onUpdateConfig={jest.fn()}+ />+ )++ expect(screen.getByText('Last 7 days')).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Hide filters' })).not.toBeInTheDocument()+ })++ it('shows read-only filter values without dropdowns when onUpdateConfig is omitted', () => {+ const { container } = render(+ <SessionReplayWidgetTileFilters+ tileId={42}+ config={{ limit: 10, dateRange: { date_from: '-30d' } }}+ disabledReason="Read only"+ />+ )++ expect(container.querySelector('[data-attr="session-replay-widget-tile-filters-readonly"]')).toBeInTheDocument()+ expect(screen.getByText('Last 30 days')).toBeInTheDocument()+ expect(screen.queryByRole('combobox')).not.toBeInTheDocument()+ })+})diff --git a/products/dashboards/frontend/widgets/session_replay/SessionReplayWidgetTileFilters.tsx b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidgetTileFilters.tsxnew file mode 100644index 000000000000..253e20d201d7--- /dev/null+++ b/products/dashboards/frontend/widgets/session_replay/SessionReplayWidgetTileFilters.tsx@@ -0,0 +1,102 @@+import equal from 'fast-deep-equal'+import { useValues } from 'kea'+import { useMemo, useRef } from 'react'++import { quickFiltersLogic } from 'lib/components/QuickFilters/quickFiltersLogic'+import { LemonSelect } from 'lib/lemon-ui/LemonSelect'++import { WIDGET_DATE_RANGE_SELECT_OPTIONS, type WidgetDateFromValue } from '../../widget_types/configSchemas'+import type { DashboardWidgetTileFiltersProps } from '../registry'+import { WidgetPropertyFiltersSection } from '../WidgetPropertyFiltersSection'+import { getWidgetTileFiltersSetup, useWidgetTileConfigPersist } from '../widgetTileFiltersHooks'+import {+ WidgetDateRangeReadOnlyValue,+ WidgetPropertyFiltersReadOnlyValues,+ WidgetTileFiltersBar,+} from '../widgetTileFiltersReadOnly'+import {+ patchSessionReplayWidgetFilterFields,+ parseSessionReplayWidgetConfig,+} from './sessionReplayWidgetConfigValidation'++export type SessionReplayWidgetTileFiltersProps = DashboardWidgetTileFiltersProps++export function SessionReplayWidgetTileFilters({+ config,+ onUpdateConfig,+ disabledReason,+}: SessionReplayWidgetTileFiltersProps): JSX.Element {+ const { context: filterDefinitionsContext, isAllowed } = getWidgetTileFiltersSetup('session_replay_list')+ const parsed = parseSessionReplayWidgetConfig(config)+ const dateFrom = (parsed.dateRange?.date_from ?? '-7d') as WidgetDateFromValue+ const widgetFilters = parsed.widgetFilters ?? {}++ const { quickFilters: projectFilterDefinitions } = useValues(+ quickFiltersLogic({ context: filterDefinitionsContext })+ )+ const filterDefinitions = useMemo(+ () => projectFilterDefinitions.filter(isAllowed),+ [projectFilterDefinitions, isAllowed]+ )++ const configRef = useRef(config)+ configRef.current = config+ const { persistConfigDebounced, persistConfigNow } = useWidgetTileConfigPersist(onUpdateConfig)++ const controlDisabledReason = disabledReason+ const canUpdate = !!onUpdateConfig && !controlDisabledReason++ const applyDateFrom = async (value: WidgetDateFromValue): Promise<void> => {+ const nextConfig = patchSessionReplayWidgetFilterFields(configRef.current, { dateFrom: value })+ configRef.current = nextConfig+ await persistConfigNow(nextConfig)+ }++ const applyWidgetFilters = (nextWidgetFilters: typeof widgetFilters): void => {+ const nextConfig = patchSessionReplayWidgetFilterFields(configRef.current, { widgetFilters: nextWidgetFilters })+ const current = parseSessionReplayWidgetConfig(configRef.current)+ if (equal(current.widgetFilters ?? {}, nextWidgetFilters)) {+ return+ }+ configRef.current = nextConfig+ persistConfigDebounced(nextConfig)+ }++ if (!onUpdateConfig) {+ return (+ <WidgetTileFiltersBar dataAttr="session-replay-widget-tile-filters-readonly">+ <WidgetDateRangeReadOnlyValue dateFrom={dateFrom} />+ {filterDefinitions.length > 0 ? (+ <WidgetPropertyFiltersReadOnlyValues+ filterDefinitions={filterDefinitions}+ widgetFilters={widgetFilters}+ />+ ) : null}+ </WidgetTileFiltersBar>+ )+ }++ return (+ <WidgetTileFiltersBar dataAttr="session-replay-widget-tile-filters">+ <LemonSelect+ size="small"+ value={dateFrom}+ disabled={!canUpdate}+ disabledReason={controlDisabledReason}+ options={WIDGET_DATE_RANGE_SELECT_OPTIONS}+ onChange={(value) => {+ if (value) {+ void applyDateFrom(value)+ }+ }}+ />+ {filterDefinitions.length > 0 ? (+ <WidgetPropertyFiltersSection+ filterDefinitions={filterDefinitions}+ widgetFilters={widgetFilters}+ onWidgetFiltersChange={applyWidgetFilters}+ />+ ) : null}+ </WidgetTileFiltersBar>+ )+}diff --git a/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts b/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.tsindex 08c925eb3181..aaf8d80a83aa 100644--- a/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts+++ b/products/dashboards/frontend/widgets/session_replay/editSessionReplayWidgetModalLogic.ts@@ -3,18 +3,15 @@ import { actions, connect, defaults, kea, listeners, path, props, reducers, seleimport { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'import { isWidgetConfigValidationError } from '../../utils'-import {- resolveWidgetFilterTestAccounts,- type SessionReplayWidgetConfig,- type WidgetDateFromValue,-} from '../../widget_types/configSchemas'+import { resolveWidgetFilterTestAccounts, type SessionReplayWidgetConfig } from '../../widget_types/configSchemas'import {widgetEditModalFilterTestAccountsActions,widgetEditModalListFieldActions,widgetEditModalPropSelectors,widgetEditModalTileActions,+ buildWidgetTileMetadataPatch,+ getWidgetEditModalTileDefaults,} from '../editWidgetModalBuilders'-import { buildWidgetTileMetadataPatch, getWidgetEditModalTileDefaults } from '../editWidgetModalTileUtils'import type { DashboardWidgetEditModalProps } from '../registry'import type { editSessionReplayWidgetModalLogicType } from './editSessionReplayWidgetModalLogicType'import {@@ -37,12 +34,13 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModadescription: '',} as EditSessionReplayWidgetModalLogicProps),- connect({+ connect(() => ({values: [filterTestAccountsDefaultsLogic, ['filterTestAccountsDefault']],- }),+ })),actions({setOrderBy: (orderBy: string) => ({ orderBy }),+ setOrderDirection: (orderDirection: SessionReplayWidgetConfig['orderDirection']) => ({ orderDirection }),...widgetEditModalListFieldActions,...widgetEditModalTileActions,...widgetEditModalFilterTestAccountsActions,@@ -63,17 +61,19 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModa): SessionReplayWidgetConfig['orderBy'] => orderBy as SessionReplayWidgetConfig['orderBy'],},],- limit: [- 10,+ orderDirection: [+ 'DESC' as SessionReplayWidgetConfig['orderDirection'],{- setLimit: (_: number, { limit }: { limit: number }) => limit,+ setOrderDirection: (+ _: SessionReplayWidgetConfig['orderDirection'],+ { orderDirection }: { orderDirection: SessionReplayWidgetConfig['orderDirection'] }+ ): SessionReplayWidgetConfig['orderDirection'] => orderDirection,},],- dateFrom: [- '-7d',+ limit: [+ 10,{- setDateFrom: (_: WidgetDateFromValue, { dateFrom }: { dateFrom: string }): WidgetDateFromValue =>- dateFrom as WidgetDateFromValue,+ setLimit: (_: number, { limit }: { limit: number }) => limit,},],tileName: [@@ -132,12 +132,12 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModa],...widgetEditModalPropSelectors,validation: [- (s) => [s.limit, s.orderBy, s.dateFrom, s.filterTestAccounts, s.widgetConfig],- (limit, orderBy, dateFrom, filterTestAccounts, widgetConfig) =>+ (s) => [s.limit, s.orderBy, s.orderDirection, s.filterTestAccounts, s.widgetConfig],+ (limit, orderBy, orderDirection, filterTestAccounts, widgetConfig) =>validateSessionReplayWidgetConfigInput({limit,orderBy,- dateFrom,+ orderDirection,filterTestAccounts,baseConfig: widgetConfig,}),@@ -171,7 +171,7 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModareturn {limit: baseConfig.limit,orderBy: baseConfig.orderBy,- dateFrom: baseConfig.dateRange?.date_from ?? '-7d',+ orderDirection: baseConfig.orderDirection,...getWidgetEditModalTileDefaults(props),filterTestAccounts: resolveWidgetFilterTestAccounts(baseConfig.filterTestAccounts,@@ -184,13 +184,7 @@ export const editSessionReplayWidgetModalLogic = kea<editSessionReplayWidgetModalisteners(({ actions, props, values }) => ({submit: async () => {- const result = validateSessionReplayWidgetConfigInput({- limit: values.limit,- orderBy: values.orderBy,- dateFrom: values.dateFrom,- filterTestAccounts: values.filterTestAccounts,- baseConfig: values.widgetConfig,- })+ const result = values.validationif (!result.success) {actions.setFieldErrors(result.fieldErrors)diff --git a/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.test.ts b/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.test.tsindex ba77bf9b01d3..29346660c577 100644--- a/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.test.ts+++ b/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.test.ts@@ -3,6 +3,7 @@ import { ApiError } from 'lib/api-error'import { sessionReplayWidgetConfigSchema } from '../../widget_types/configSchemas'import {parseSessionReplayWidgetConfigApiError,+ patchSessionReplayWidgetFilterFields,validateSessionReplayWidgetConfigInput,} from './sessionReplayWidgetConfigValidation'@@ -11,7 +12,7 @@ describe('validateSessionReplayWidgetConfigInput', () => {const result = validateSessionReplayWidgetConfigInput({limit: 30,orderBy: 'start_time',- dateFrom: '-7d',+ orderDirection: 'DESC',filterTestAccounts: true,baseConfig: sessionReplayWidgetConfigSchema.parse({}),})@@ -22,36 +23,59 @@ describe('validateSessionReplayWidgetConfigInput', () => {}})- it('accepts valid config', () => {+ it('accepts valid config and preserves tile filter fields from base config', () => {const result = validateSessionReplayWidgetConfigInput({limit: 10,orderBy: 'start_time',- dateFrom: '-7d',+ orderDirection: 'ASC',filterTestAccounts: true,- baseConfig: sessionReplayWidgetConfigSchema.parse({}),+ baseConfig: sessionReplayWidgetConfigSchema.parse({+ dateRange: { date_from: '-30d' },+ widgetFilters: {+ 'qf-1': {+ filterId: 'qf-1',+ propertyName: '$browser',+ optionId: 'opt-1',+ operator: 'exact',+ value: 'Chrome',+ },+ },+ }),})expect(result.success).toBe(true)if (result.success) {expect(result.config.limit).toBe(10)- expect(result.config.dateRange).toEqual({ date_from: '-7d' })+ expect(result.config.orderDirection).toBe('ASC')+ expect(result.config.dateRange).toEqual({ date_from: '-30d' })expect(result.config.filterTestAccounts).toBe(true)+ expect(result.config.widgetFilters?.['qf-1']).toMatchObject({+ propertyName: '$browser',+ value: 'Chrome',+ })}})+})- it('accepts short date range', () => {- const result = validateSessionReplayWidgetConfigInput({- limit: 10,- orderBy: 'start_time',- dateFrom: '-1h',- filterTestAccounts: true,- baseConfig: sessionReplayWidgetConfigSchema.parse({}),+describe('patchSessionReplayWidgetFilterFields', () => {+ it('updates date range without clearing widget filters', () => {+ const config = sessionReplayWidgetConfigSchema.parse({+ dateRange: { date_from: '-7d' },+ widgetFilters: {+ 'qf-1': {+ filterId: 'qf-1',+ propertyName: '$browser',+ optionId: 'opt-1',+ operator: 'exact',+ value: 'Chrome',+ },+ },})- expect(result.success).toBe(true)- if (result.success) {- expect(result.config.dateRange).toEqual({ date_from: '-1h' })- }+ const next = patchSessionReplayWidgetFilterFields(config, { dateFrom: '-30d' })++ expect(next.dateRange).toEqual({ date_from: '-30d' })+ expect(next.widgetFilters?.['qf-1']).toMatchObject({ value: 'Chrome' })})})diff --git a/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.ts b/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.tsindex 6a520b350a2c..23fe8b1cbf73 100644--- a/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.ts+++ b/products/dashboards/frontend/widgets/session_replay/sessionReplayWidgetConfigValidation.ts@@ -4,43 +4,85 @@ import {sessionReplayWidgetConfigSchema,sessionReplayWidgetFormSchema,type SessionReplayWidgetConfig,+ type StoredWidgetFilter,+ type WidgetDateFromValue,} from '../../widget_types/configSchemas'import {- buildWidgetConfigFromForm,parseWidgetConfig,parseWidgetConfigApiError,+ validateWidgetConfigInput,type WidgetListFormInput,- validateWidgetConfigInput as validateWidgetConfigInputShared,} from '../widgetConfigValidation'type SessionReplayWidgetFormField = keyof z.infer<typeof sessionReplayWidgetFormSchema>export type SessionReplayWidgetFieldErrors = Partial<Record<SessionReplayWidgetFormField, string>>+export type SessionReplayWidgetFormInput = WidgetListFormInput & {+ orderDirection: SessionReplayWidgetConfig['orderDirection']+}++const sessionReplayConfigDefaults = sessionReplayWidgetConfigSchema.parse({})+export function parseSessionReplayWidgetConfig(config: Record<string, unknown>): SessionReplayWidgetConfig {return parseWidgetConfig(sessionReplayWidgetConfigSchema, config)}+export function patchSessionReplayWidgetFilterFields(+ config: Record<string, unknown>,+ patch: {+ dateFrom?: WidgetDateFromValue+ widgetFilters?: Record<string, StoredWidgetFilter>+ }+): SessionReplayWidgetConfig {+ const base = parseSessionReplayWidgetConfig(config)++ return sessionReplayWidgetConfigSchema.parse({+ ...base,+ dateRange: { date_from: patch.dateFrom ?? base.dateRange?.date_from ?? '-7d' },+ widgetFilters: patch.widgetFilters ?? base.widgetFilters ?? {},+ })+}+export function buildSessionReplayWidgetConfig(- formInput: WidgetListFormInput,+ formInput: SessionReplayWidgetFormInput,baseConfig: SessionReplayWidgetConfig): SessionReplayWidgetConfig {- return buildWidgetConfigFromForm(sessionReplayWidgetConfigSchema, formInput, baseConfig)+ return sessionReplayWidgetConfigSchema.parse({+ ...baseConfig,+ limit: formInput.limit,+ orderBy: formInput.orderBy,+ orderDirection: formInput.orderDirection,+ filterTestAccounts: formInput.filterTestAccounts,+ })}export function validateSessionReplayWidgetConfigInput(input: {limit: numberorderBy: string- dateFrom: string+ orderDirection: stringfilterTestAccounts: booleanbaseConfig: SessionReplayWidgetConfig}):| { success: true; config: SessionReplayWidgetConfig }| { success: false; fieldErrors: SessionReplayWidgetFieldErrors } {- return validateWidgetConfigInputShared({+ return validateWidgetConfigInput({formSchema: sessionReplayWidgetFormSchema,- buildConfig: buildSessionReplayWidgetConfig,- input,+ buildConfig: (formInput) =>+ buildSessionReplayWidgetConfig(+ {+ ...formInput,+ orderDirection: input.orderDirection as SessionReplayWidgetConfig['orderDirection'],+ },+ input.baseConfig+ ),+ input: {+ limit: input.limit,+ orderBy: input.orderBy,+ dateFrom: input.baseConfig.dateRange?.date_from ?? '-7d',+ filterTestAccounts: input.filterTestAccounts,+ baseConfig: input.baseConfig,+ },})}@@ -53,6 +95,6 @@ export function parseSessionReplayWidgetConfigApiError(config,configSchema: sessionReplayWidgetConfigSchema,formSchema: sessionReplayWidgetFormSchema,- defaultOrderBy: 'start_time',+ defaultOrderBy: sessionReplayConfigDefaults.orderBy,})}diff --git a/products/dashboards/frontend/widgets/session_replay/utils.ts b/products/dashboards/frontend/widgets/session_replay/utils.tsdeleted file mode 100644index c0d8c54dec32..000000000000--- a/products/dashboards/frontend/widgets/session_replay/utils.ts+++ /dev/null@@ -1,7 +0,0 @@-export const SESSION_REPLAY_WIDGET_ORDER_BY_OPTIONS = [- { value: 'start_time', label: 'Start time' },- { value: 'activity_score', label: 'Activity score' },- { value: 'recording_duration', label: 'Duration' },- { value: 'click_count', label: 'Clicks' },- { value: 'console_error_count', label: 'Console errors' },-] as constdiff --git a/products/dashboards/frontend/widgets/widgetConfigValidation.ts b/products/dashboards/frontend/widgets/widgetConfigValidation.tsindex 0005bcf87c43..b02fe7cb1045 100644--- a/products/dashboards/frontend/widgets/widgetConfigValidation.ts+++ b/products/dashboards/frontend/widgets/widgetConfigValidation.ts@@ -140,11 +140,16 @@ export function parseWidgetConfigApiError<TField extends string, TConfig>({return null}+ const configDefaults = configSchema.parse({}) as {+ limit?: number+ orderBy?: string+ filterTestAccounts?: boolean+ }const formInput: WidgetListFormInput = {- limit: (config.limit as number) ?? 0,- orderBy: (config.orderBy as string) ?? defaultOrderBy,+ limit: (config.limit as number) ?? configDefaults.limit ?? 0,+ orderBy: (config.orderBy as string) ?? defaultOrderBy ?? configDefaults.orderBy ?? '',dateFrom: (config.dateRange as { date_from?: string } | undefined)?.date_from ?? '-7d',- filterTestAccounts: (config.filterTestAccounts as boolean) ?? false,+ filterTestAccounts: (config.filterTestAccounts as boolean) ?? configDefaults.filterTestAccounts ?? false,}const parsedForm = formSchema.safeParse(formInput)if (!parsedForm.success) {diff --git a/products/dashboards/frontend/widgets/widgetTileFiltersHooks.ts b/products/dashboards/frontend/widgets/widgetTileFiltersHooks.tsnew file mode 100644index 000000000000..bef40f4d534d--- /dev/null+++ b/products/dashboards/frontend/widgets/widgetTileFiltersHooks.ts@@ -0,0 +1,81 @@+import { useCallback, useEffect, useRef } from 'react'++import type { QuickFilter } from '~/types'++import {+ DASHBOARD_WIDGET_CATALOG,+ type DashboardWidgetCatalogKey,+ type DashboardWidgetTileFiltersCatalogConfig,+} from '../widget_types/catalog'+import { WIDGET_TILE_REFRESH_DEBOUNCE_MS } from './constants'++export type WidgetFilterDefinitionsSetup = {+ /** Loads saved property-filter definitions for tile pickers (project Quick Filter records). */+ context: DashboardWidgetTileFiltersCatalogConfig['quickFilterContext']+ isAllowed: (filter: Pick<QuickFilter, 'name' | 'property_name'>) => boolean+}++export function widgetTileFiltersSetupFromCatalog(+ config: DashboardWidgetTileFiltersCatalogConfig+): WidgetFilterDefinitionsSetup {+ const allowedPropertyNames = new Set(+ config.allowedPropertyNames.map((propertyName) => propertyName.trim().toLowerCase())+ )+ return {+ context: config.quickFilterContext,+ isAllowed: (filter) => allowedPropertyNames.has(filter.property_name.trim().toLowerCase()),+ }+}++export function getWidgetTileFiltersSetup(widgetType: DashboardWidgetCatalogKey): WidgetFilterDefinitionsSetup {+ const tileFilters = DASHBOARD_WIDGET_CATALOG[widgetType].tileFilters+ if (!tileFilters) {+ throw new Error(`Dashboard widget catalog entry ${widgetType} is missing tileFilters config`)+ }+ return widgetTileFiltersSetupFromCatalog(tileFilters)+}++export function useWidgetTileConfigPersist(+ onUpdateConfig?: (config: Record<string, unknown>) => void | Promise<void>+): {+ persistConfigDebounced: (config: Record<string, unknown>) => void+ persistConfigNow: (config: Record<string, unknown>) => Promise<void>+} {+ const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)+ const onUpdateConfigRef = useRef(onUpdateConfig)+ onUpdateConfigRef.current = onUpdateConfig++ const persistConfigNow = useCallback(async (config: Record<string, unknown>): Promise<void> => {+ if (debounceRef.current) {+ clearTimeout(debounceRef.current)+ debounceRef.current = null+ }+ await onUpdateConfigRef.current?.(config)+ }, [])++ const persistConfigDebounced = useCallback(+ (config: Record<string, unknown>): void => {+ if (!onUpdateConfigRef.current) {+ return+ }+ if (debounceRef.current) {+ clearTimeout(debounceRef.current)+ }+ debounceRef.current = setTimeout(() => {+ debounceRef.current = null+ void persistConfigNow(config)+ }, WIDGET_TILE_REFRESH_DEBOUNCE_MS)+ },+ [persistConfigNow]+ )++ useEffect(() => {+ return () => {+ if (debounceRef.current) {+ clearTimeout(debounceRef.current)+ }+ }+ }, [])++ return { persistConfigDebounced, persistConfigNow }+}diff --git a/products/dashboards/frontend/widgets/widgetTileFiltersReadOnly.tsx b/products/dashboards/frontend/widgets/widgetTileFiltersReadOnly.tsxnew file mode 100644index 000000000000..4bb0e5ea66b4--- /dev/null+++ b/products/dashboards/frontend/widgets/widgetTileFiltersReadOnly.tsx@@ -0,0 +1,72 @@+import type { ReactNode } from 'react'+import { useMemo } from 'react'++import type { QuickFilter } from '~/types'++import type { WidgetFilterConfigRecord } from '../widget_types/configSchemas'+import { WIDGET_DATE_RANGE_SELECT_OPTIONS, type WidgetDateFromValue } from '../widget_types/configSchemas'++export function WidgetTileFiltersBar({ children, dataAttr }: { children: ReactNode; dataAttr: string }): JSX.Element {+ return (+ <div+ className="flex min-w-0 flex-wrap items-center gap-2 px-3 py-2 border-b border-primary"+ data-attr={dataAttr}+ onMouseDown={(event) => event.stopPropagation()}+ >+ {children}+ </div>+ )+}++export function WidgetTileFilterReadOnlyValue({ children }: { children: ReactNode }): JSX.Element {+ return <span className="inline-flex items-center gap-1.5 text-xs text-primary">{children}</span>+}++export function WidgetDateRangeReadOnlyValue({ dateFrom }: { dateFrom: WidgetDateFromValue }): JSX.Element {+ const label = WIDGET_DATE_RANGE_SELECT_OPTIONS.find((option) => option.value === dateFrom)?.label ?? dateFrom+ return <WidgetTileFilterReadOnlyValue>{label}</WidgetTileFilterReadOnlyValue>+}++function widgetFilterReadOnlyLabel(+ filter: QuickFilter,+ entry: { optionId: string; value?: string | string[] | null }+): string {+ const option = filter.options.find((opt) => opt.id === entry.optionId)+ return option?.label ?? String(entry.value ?? '')+}++export function WidgetPropertyFiltersReadOnlyValues({+ filterDefinitions,+ widgetFilters,+}: {+ filterDefinitions: QuickFilter[]+ widgetFilters: WidgetFilterConfigRecord | undefined+}): JSX.Element | null {+ const stored = widgetFilters ?? {}++ const labels = useMemo(() => {+ return filterDefinitions+ .map((filter) => {+ const entry = stored[filter.id]+ if (!entry) {+ return null+ }+ return { id: filter.id, name: filter.name, value: widgetFilterReadOnlyLabel(filter, entry) }+ })+ .filter((item): item is { id: string; name: string; value: string } => item != null)+ }, [filterDefinitions, stored])++ if (labels.length === 0) {+ return null+ }++ return (+ <>+ {labels.map((item) => (+ <WidgetTileFilterReadOnlyValue key={item.id}>+ <span className="text-secondary">{item.name}:</span> {item.value}+ </WidgetTileFilterReadOnlyValue>+ ))}+ </>+ )+}diff --git a/products/dashboards/package.json b/products/dashboards/package.jsonindex abed922431be..cba8c4b51dc0 100644--- a/products/dashboards/package.json+++ b/products/dashboards/package.json@@ -4,6 +4,7 @@"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"},"dependencies": {+ "fast-deep-equal": "catalog:","kea": "catalog:","kea-loaders": "catalog:","kea-router": "catalog:",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 869b4fd7d248..6fc551dcf57b 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -12599,7 +12599,7 @@ export namespace Schemas {* @nullable*/widget_type: string | null;- /** Live widget query result payload. */+ /** Live widget query result payload. List widgets return results (array), limit (configured page size), hasMore (boolean), totalCount (matching rows for current filters), totalCountCapped (true when totalCount hit the widget max and more may exist), and optional offset/nextOffset. error_tracking_list results are issue summaries; session_replay_list results are recording metadata. */result: unknown;/*** Error message when the widget could not be run.