SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat(dashboard-v2): View-modal drill-down + editor "Switch to View Mode" (#12004)
Abhi kumaref8319585bca
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsxindex 67665ee645..927906d354 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsx@@ -11,14 +11,18 @@ import styles from './Header.module.scss';interface HeaderProps {isDirty: boolean;isSaving: boolean;+ showSwitchToView?: boolean;onSave: () => void;+ onSwitchToView?: () => void;onClose: () => void;}function Header({isDirty,isSaving,+ showSwitchToView = false,onSave,+ onSwitchToView,onClose,}: HeaderProps): JSX.Element {const discard = useConfirmableAction(@@ -49,6 +53,16 @@ function Header({<Typography.Text>Configure panel</Typography.Text></div><div className={styles.actions}>+ {showSwitchToView && (+ <Button+ variant="outlined"+ color="secondary"+ data-testid="panel-editor-v2-switch-to-view"+ onClick={onSwitchToView}+ >+ Switch to View Mode+ </Button>+ )}<Buttonvariant="solid"color="primary"diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/PreviewPane/PreviewPane.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/PreviewPane/PreviewPane.tsxindex de2fff139b..cb0fdd7e3a 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/PreviewPane/PreviewPane.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/PreviewPane/PreviewPane.tsx@@ -5,6 +5,7 @@ import { PanelMode } from 'container/DashboardContainer/visualization/panels/typimport DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';import PanelBody from 'pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody';import PanelHeader from 'pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelHeader/PanelHeader';+import type { AnyPanelInteractionProps } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/interactions';import type { RenderablePanelDefinition } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/panelDefinition';import { PANEL_KIND_TO_PANEL_TYPE } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/panelKind';import type { DashboardPreference } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/rendererProps';@@ -42,6 +43,10 @@ interface PreviewPaneProps {dashboardPreference?: DashboardPreference;/** Close the standalone View modal — forwarded to the time-series/bar graph manager. */onCloseStandaloneView?: () => void;+ /** Opens the drill-down context menu; only the View modal wires it (the editor preview omits it). */+ onClick?: AnyPanelInteractionProps['onClick'];+ /** Arms the drill-down click on interactive renderers — the View modal enables it, the editor doesn't. */+ enableDrillDown?: boolean;}/**@@ -64,6 +69,8 @@ function PreviewPane({hideHeader = false,dashboardPreference,onCloseStandaloneView,+ onClick,+ enableDrillDown,}: PreviewPaneProps): JSX.Element {const panelType = PANEL_KIND_TO_PANEL_TYPE[panel.spec.plugin.kind];const queryType = getPanelQueryType(panel);@@ -119,6 +126,8 @@ function PreviewPane({searchTerm={searchable ? searchTerm : undefined}pagination={pagination}onCloseStandaloneView={onCloseStandaloneView}+ onClick={onClick}+ enableDrillDown={enableDrillDown}/></div></div>diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsxindex eec4594f5b..f48283fe31 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsx@@ -48,6 +48,10 @@ jest.mock('../hooks/usePanelEditorSave', () => ({jest.mock('../hooks/useSwitchColumnsOnSignalChange', () => ({useSwitchColumnsOnSignalChange: jest.fn(),}));+const mockOnSwitchToView = jest.fn();+jest.mock('../hooks/useSwitchToViewMode', () => ({+ useSwitchToViewMode: (): (() => void) => mockOnSwitchToView,+}));jest.mock('../hooks/useSeedNewListColumns', () => ({useSeedNewListColumns: jest.fn(),}));@@ -138,13 +142,16 @@ jest.mock('../ListColumnsEditor/ListColumnsEditor', () => ({default: (): JSX.Element => <div data-testid="list-columns" />,}));-function makePanel(kind: string): DashboardtypesPanelDTO {+function makePanel(+ kind: string,+ queries: unknown[] = [],+): DashboardtypesPanelDTO {return {kind: 'Panel',spec: {display: { name: 'CPU' },plugin: { kind, spec: {} },- queries: [],+ queries,},} as unknown as DashboardtypesPanelDTO;}@@ -159,12 +166,13 @@ const baseProps = {function setup(panel: DashboardtypesPanelDTO,overrides?: Partial<React.ComponentProps<typeof PanelEditorContainer>>,+ draftOverrides?: { isSpecDirty?: boolean },): void {mockUseDraft.mockReturnValue({draft: panel,spec: panel.spec,setSpec: mockSetSpec,- isSpecDirty: false,+ isSpecDirty: draftOverrides?.isSpecDirty ?? false,});mockUseQuery.mockReturnValue({data: { response: undefined },@@ -240,12 +248,38 @@ describe('PanelEditorContainer composition', () => {);});- it('marks a new panel dirty and always serializes its query', () => {+ it('keeps a query-less new panel unsaveable but still serializes its seed query', () => {setup(makePanel('signoz/TimeSeriesPanel'), { isNew: true });expect(mockUseQuerySync).toHaveBeenCalledWith(expect.objectContaining({ alwaysSerializeQuery: true }),);+ // No query and no edits yet → nothing to save, so Save stays disabled.+ expect(mockHeaderProps).toHaveBeenCalledWith(+ expect.objectContaining({ isDirty: false }),+ );+ });++ it('marks a new panel that already has a query saveable (e.g. list auto-runs one)', () => {+ const seededQuery = {+ spec: { plugin: { kind: 'signoz/BuilderQuery', spec: { signal: 'logs' } } },+ };+ setup(makePanel('signoz/ListPanel', [seededQuery]), { isNew: true });++ expect(mockHeaderProps).toHaveBeenCalledWith(+ expect.objectContaining({ isDirty: true }),+ );+ });++ it('marks a new panel dirty once the user edits its spec', () => {+ setup(+ makePanel('signoz/TimeSeriesPanel'),+ { isNew: true },+ {+ isSpecDirty: true,+ },+ );+expect(mockHeaderProps).toHaveBeenCalledWith(expect.objectContaining({ isDirty: true }),);@@ -258,10 +292,30 @@ describe('PanelEditorContainer composition', () => {await userEvent.click(screen.getByTestId('editor-save'));await waitFor(() => expect(baseProps.onSaved).toHaveBeenCalled());+expect(mockBuildSaveSpec).toHaveBeenCalledWith(panel.spec);expect(mockSave).toHaveBeenCalledWith(panel.spec);});+ it('offers Switch to View Mode for an existing panel', () => {+ setup(makePanel('signoz/TimeSeriesPanel'));++ expect(mockHeaderProps).toHaveBeenCalledWith(+ expect.objectContaining({+ showSwitchToView: true,+ onSwitchToView: expect.any(Function),+ }),+ );+ });++ it('hides Switch to View Mode for a new (unsaved) panel', () => {+ setup(makePanel('signoz/TimeSeriesPanel'), { isNew: true });++ expect(mockHeaderProps).toHaveBeenCalledWith(+ expect.objectContaining({ showSwitchToView: false }),+ );+ });+it('renders the list-columns editor only for list panels', () => {setup(makePanel('signoz/ListPanel'));expect(screen.getByTestId('list-columns')).toBeInTheDocument();diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/useSwitchToViewMode.test.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/useSwitchToViewMode.test.tsnew file mode 100644index 0000000000..79b945c055--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/useSwitchToViewMode.test.ts@@ -0,0 +1,64 @@+import { renderHook } from '@testing-library/react';+import { PANEL_TYPES } from 'constants/queryBuilder';+import type { Query } from 'types/api/queryBuilder/queryBuilderData';++import { useSwitchToViewMode } from '../useSwitchToViewMode';++const mockSafeNavigate = jest.fn();+jest.mock('hooks/useSafeNavigate', () => ({+ useSafeNavigate: (): { safeNavigate: jest.Mock } => ({+ safeNavigate: mockSafeNavigate,+ }),+}));++let mockSearch = '';+jest.mock('hooks/useUrlQuery', () => ({+ __esModule: true,+ default: (): URLSearchParams => new URLSearchParams(mockSearch),+}));++const query = { queryType: 'builder' } as unknown as Query;++describe('useSwitchToViewMode', () => {+ beforeEach(() => {+ jest.clearAllMocks();+ mockSearch = '';+ });++ function invoke(): void {+ const { result } = renderHook(() =>+ useSwitchToViewMode({+ dashboardId: 'dash-1',+ panelId: 'panel-1',+ panelType: PANEL_TYPES.TIME_SERIES,+ query,+ }),+ );+ result.current();+ }++ it('opens the dashboard with the View modal seeded from the live query', () => {+ invoke();++ expect(mockSafeNavigate).toHaveBeenCalledTimes(1);+ const target = new URL(mockSafeNavigate.mock.calls[0][0], 'http://x');+ expect(target.pathname).toBe('/dashboard/dash-1');+ expect(target.searchParams.get('expandedWidgetId')).toBe('panel-1');+ expect(target.searchParams.get('graphType')).toBe(PANEL_TYPES.TIME_SERIES);+ expect(+ JSON.parse(+ decodeURIComponent(target.searchParams.get('compositeQuery') || ''),+ ),+ ).toStrictEqual(query);+ });++ it('carries dashboard variables through and drops other editor URL state', () => {+ mockSearch = 'variables=%7B%22a%22%3A1%7D&compositeQuery=stale';+ invoke();++ const target = new URL(mockSafeNavigate.mock.calls[0][0], 'http://x');+ expect(target.searchParams.get('variables')).toBe('{"a":1}');+ // The stale editor query is replaced with the live one, not the URL leftover.+ expect(target.searchParams.get('compositeQuery')).not.toBe('stale');+ });+});diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/useSwitchToViewMode.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/useSwitchToViewMode.tsnew file mode 100644index 0000000000..b138fe2097--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/useSwitchToViewMode.ts@@ -0,0 +1,46 @@+import { useCallback } from 'react';+import { generatePath } from 'react-router-dom';+import { QueryParams } from 'constants/query';+import type { PANEL_TYPES } from 'constants/queryBuilder';+import ROUTES from 'constants/routes';+import { useSafeNavigate } from 'hooks/useSafeNavigate';+import useUrlQuery from 'hooks/useUrlQuery';+import type { Query } from 'types/api/queryBuilder/queryBuilderData';++interface UseSwitchToViewModeArgs {+ dashboardId: string;+ panelId: string;+ panelType: PANEL_TYPES;+ query: Query;+}++/**+ * Callback that leaves the editor for the dashboard with this panel expanded in the+ * View modal, seeded with the live (un-saved) query — V1's "Switch to View Mode".+ */+export function useSwitchToViewMode({+ dashboardId,+ panelId,+ panelType,+ query,+}: UseSwitchToViewModeArgs): () => void {+ const { safeNavigate } = useSafeNavigate();+ const urlQuery = useUrlQuery();++ return useCallback((): void => {+ const params = new URLSearchParams();+ const variables = urlQuery.get(QueryParams.variables);+ if (variables) {+ params.set(QueryParams.variables, variables);+ }+ params.set(QueryParams.expandedWidgetId, panelId);+ params.set(QueryParams.graphType, panelType);+ params.set(+ QueryParams.compositeQuery,+ encodeURIComponent(JSON.stringify(query)),+ );+ safeNavigate(+ `${generatePath(ROUTES.DASHBOARD, { dashboardId })}?${params.toString()}`,+ );+ }, [safeNavigate, urlQuery, dashboardId, panelId, panelType, query]);+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsxindex f66cbbd3a2..15fe10b055 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsx@@ -13,6 +13,7 @@ import {TelemetrytypesSignalDTO,} from 'api/generated/services/sigNoz.schemas';import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';+import { PANEL_KIND_TO_PANEL_TYPE } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/panelKind';import { getBuilderQueries } from 'pages/DashboardPageV2/DashboardContainer/Panels/utils/getBuilderQueries';import { getExecStats } from '../queryV5/v5ResponseData';@@ -28,6 +29,7 @@ import { usePanelEditSession } from './hooks/usePanelEditSession';import { usePanelEditorSave } from './hooks/usePanelEditorSave';import { useSeedNewListColumns } from './hooks/useSeedNewListColumns';import { useSwitchColumnsOnSignalChange } from './hooks/useSwitchColumnsOnSignalChange';+import { useSwitchToViewMode } from './hooks/useSwitchToViewMode';import { useTableColumns } from './hooks/useTableColumns';import ListColumnsEditor from './ListColumnsEditor/ListColumnsEditor';@@ -143,9 +145,13 @@ function PanelEditorContainer({onSelectUnit: seedFormattingUnit,});- // Spec and query dirtiness are tracked independently so query re-serialization- // never false-dirties. A new panel is always savable (you're creating it).- const isDirty = isNew || isSpecDirty || isQueryDirty;+ // A new panel is savable once it has a query to run — List auto-seeds one; other+ // kinds open query-less, so there's nothing to save until the user builds one.+ const isDirty = useMemo(+ () => isSpecDirty || isQueryDirty || (isNew && draft.spec.queries.length > 0),+ [isSpecDirty, isQueryDirty, isNew, draft.spec.queries.length],+ );+const isListPanel = panelKind === 'signoz/ListPanel';// The builder-query `signal` literal matches the TelemetrytypesSignalDTO enum// values; cast at this boundary (as ConfigPane does) so the columns editor's@@ -184,6 +190,13 @@ function PanelEditorContainer({return values.length ? Math.min(...values) : undefined;}, [data.response]);+ const onSwitchToView = useSwitchToViewMode({+ dashboardId,+ panelId,+ panelType: PANEL_KIND_TO_PANEL_TYPE[panelKind],+ query: currentQuery,+ });+const onSave = useCallback(async (): Promise<void> => {try {// Bake the live query into the spec so unstaged edits are saved too.@@ -200,7 +213,9 @@ function PanelEditorContainer({<HeaderisDirty={isDirty}isSaving={isSaving}+ showSwitchToView={!isNew}onSave={onSave}+ onSwitchToView={onSwitchToView}onClose={onClose}/><ResizablePanelGroupdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/ListPanel.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/ListPanel.module.scssindex fa45db6ce5..00302ee6a6 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/ListPanel.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/ListPanel.module.scss@@ -21,6 +21,11 @@// Logs: drop the row separators for a denser log view (V1 logs table parity)..logRows {+ // Every row opens the log detail drawer, so flag it as clickable.+ :global(.ant-table-tbody) > tr {+ cursor: pointer;+ }+:global(.ant-table-tbody) > tr > td {border-bottom: none;}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/TablePanel.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/TablePanel.module.scssindex a0af1a7d89..248514cd8e 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/TablePanel.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/TablePanel.module.scss@@ -18,3 +18,11 @@@include custom-scrollbar;}}++.clickableCell {+ cursor: pointer;++ &:hover {+ color: var(--primary-background);+ }+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/tableColumns.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/tableColumns.tsxindex 2e45908339..52f5fecc22 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/tableColumns.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/tableColumns.tsx@@ -10,6 +10,8 @@ import { formatPanelValue } from '../../utils/formatPanelValue';import { getColumnUnit } from '../../utils/getColumnUnit';import { toPanelThreshold } from '../../utils/mapComparisonThreshold';+import styles from './TablePanel.module.scss';+/** A prepared scalar-table row flattened for the antd Table, with the antd key. */export type TableRowData = Record<string, unknown> & { key: number };@@ -120,7 +122,7 @@ export function buildTableColumns({if (onCellClick) {cellProps.onClick = (event): void =>onCellClick({ columnId: key, record, event });- cellProps.style = { ...cellProps.style, cursor: 'pointer' };+ cellProps.className = styles.clickableCell;}return cellProps;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown.tsindex 0432635733..58853120c9 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown.ts@@ -1,5 +1,7 @@import type { TelemetrytypesSignalDTO } from 'api/generated/services/sigNoz.schemas';+import type { PANEL_TYPES } from 'constants/queryBuilder';import type { FilterData } from 'container/QueryTable/Drilldown/drilldownUtils';+import type { Query } from 'types/api/queryBuilder/queryBuilderData';// Drilldown is the click-to-context-menu feature ported from V1. Every renderer turns its native// click into one `DrilldownClickPayload`; the kind-agnostic orchestration layer consumes only that.@@ -34,3 +36,13 @@ export interface DrilldownClickPayload {coordinates: { x: number; y: number };context: DrilldownContext;}++/**+ * Opens the View modal on a refined drilldown query (filter-by-value / breakout). In the grid this+ * navigates to the modal seeded with the query; inside the modal it refines the view in place.+ */+export type OpenDrilldownView = (+ panelId: string,+ query: Query,+ panelType: PANEL_TYPES,+) => void;diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsxindex 6949085852..1fe1f06cf8 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx@@ -2,11 +2,13 @@ import { useMemo } from 'react';import type { DashboardtypesPanelDTO } from 'api/generated/services/sigNoz.schemas';import { PanelMode } from 'container/DashboardContainer/visualization/panels/types';import { DashboardCursorSync } from 'lib/uPlotV2/plugins/TooltipPlugin/types';+import ContextMenu from 'periscope/components/ContextMenu';import PanelEditorQueryBuilder from 'pages/DashboardPageV2/DashboardContainer/PanelEditor/PanelEditorQueryBuilder/PanelEditorQueryBuilder';import PreviewPane from 'pages/DashboardPageV2/DashboardContainer/PanelEditor/PreviewPane/PreviewPane';import type { DashboardPreference } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/rendererProps';import { useOpenPanelEditor } from 'pages/DashboardPageV2/DashboardContainer/hooks/useOpenPanelEditor';+import { useDrilldown } from '../hooks/useDrilldown';import { usePanelInteractions } from '../hooks/usePanelInteractions';import ViewPanelModalHeader from './ViewPanelModalHeader';import { useViewPanelMode } from './useViewPanelMode';@@ -48,9 +50,16 @@ function ViewPanelModalContent({onChangePanelKind,resetQuery,buildSaveSpec,+ applyDrilldownQuery,} = useViewPanelMode({ panel, panelId, time: timeOverride });const { data, isFetching, error, refetch, cancelQuery, pagination } = query;+ // Grid drill-down, but filter-by-value / breakout refine this view in place. Drills the draft+ // so it reflects in-modal edits (and the click's time range follows the per-view window).+ const drilldown = useDrilldown(draft, panelId, {+ openDrilldownView: applyDrilldownQuery,+ });+// Drag-to-zoom stays inside the modal; opt the chart out of the dashboard's// cursor-sync group so a drag here can't replay onto the grid panels.const { dashboardPreference } = usePanelInteractions();@@ -115,9 +124,12 @@ function ViewPanelModalContent({panelMode={PanelMode.STANDALONE_VIEW}dashboardPreference={isolatedPreference}onCloseStandaloneView={onClose}+ onClick={drilldown.onPanelClick}+ enableDrillDown={drilldown.enableDrillDown}hideHeader/></div>+ <ContextMenu {...drilldown.contextMenuProps} /></div>);}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelMode.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelMode.tsindex a99360e7ab..759257547d 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelMode.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelMode.ts@@ -10,6 +10,7 @@ import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueimport { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';import useUrlQuery from 'hooks/useUrlQuery';import { usePanelEditSession } from 'pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/usePanelEditSession';+import type { OpenDrilldownView } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown';import type { RenderablePanelDefinition } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/panelDefinition';import {PANEL_KIND_TO_PANEL_TYPE,@@ -56,6 +57,11 @@ export interface UseViewPanelModeReturn {buildSaveSpec: (spec: DashboardtypesPanelSpecDTO,) => DashboardtypesPanelSpecDTO;+ /**+ * Drill-down handoff for filter-by-value / breakout: refine the view in place (persist to the+ * URL so it survives refresh, and re-run the preview), rather than opening a new View modal.+ */+ applyDrilldownQuery: OpenDrilldownView;}/**@@ -101,6 +107,7 @@ export function useViewPanelMode({onChangePanelKind,buildSaveSpec,reset,+ setSpec,} = usePanelEditSession({ panel: initialPanel, panelId, time });// The query the view opened with, captured once — the Reset target.@@ -119,6 +126,31 @@ export function useViewPanelMode({redirectWithQueryBuilderData(savedQuery);}, [reset, redirectWithQueryBuilderData, savedQuery]);+ // redirectWithQueryBuilderData (not the grid's openViewWithQuery): the cloned query keeps its id,+ // so the QB provider's `stagedQuery.id === url id` guard would skip a plain URL write. setSpec+ // commits into the draft too — filter/breakout aren't a structural change, so it won't auto-commit.+ const applyDrilldownQuery = useCallback<OpenDrilldownView>(+ (viewPanelId, drilldownQuery, drilldownPanelType): void => {+ redirectWithQueryBuilderData(+ drilldownQuery,+ {+ [QueryParams.expandedWidgetId]: viewPanelId,+ [QueryParams.graphType]: drilldownPanelType,+ },+ undefined,+ true,+ );+ setSpec(+ buildViewPanelSpec({+ spec: draft.spec,+ query: drilldownQuery,+ panelType: drilldownPanelType,+ }),+ );+ },+ [redirectWithQueryBuilderData, setSpec, draft.spec],+ );+// Current builder datasource — resolved the same way as the full editor's// ConfigPane so the two selectors stay in sync, then defaulted to the kind's first// signal (PromQL/ClickHouse carry none) so the query builder always has one.@@ -135,5 +167,6 @@ export function useViewPanelMode({onChangePanelKind,resetQuery,buildSaveSpec,+ applyDrilldownQuery,};}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/ViewPanelModal.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/ViewPanelModal.test.tsxindex e41b35d849..dc252ef495 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/ViewPanelModal.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/ViewPanelModal.test.tsx@@ -47,10 +47,28 @@ jest.mock('../ViewPanelModal/useViewPanelMode', () => ({resetQuery: jest.fn(),signal: 'logs',buildSaveSpec: (spec: unknown): unknown => spec,+ applyDrilldownQuery: jest.fn(),};},}));+// Drill-down orchestration (popover, submenus, View-in-X) has its own suite+// (useDrilldown.test.tsx) and pulls in router/redux/react-query; stub it so this+// suite only asserts that the modal arms the preview and renders the menu host.+const mockOnPanelClick = jest.fn();+jest.mock('../hooks/useDrilldown', () => ({+ useDrilldown: (): unknown => ({+ enableDrillDown: true,+ onPanelClick: mockOnPanelClick,+ contextMenuProps: {+ coordinates: null,+ popoverPosition: null,+ items: null,+ onClose: jest.fn(),+ },+ }),+}));+// The View modal reuses the edit page's query builder, which reads the global// QueryBuilder context and pulls in the ClickHouse/PromQL editors; stub it here.jest.mock(@@ -174,4 +192,23 @@ describe('ViewPanelModal', () => {};expect(props.dashboardPreference?.syncMode).toBe(DashboardCursorSync.None);});++ // Parity with the grid: the View modal arms the same drill-down click on the preview.+ it('arms drill-down on the preview', () => {+ mockPreviewPaneRender.mockClear();+ renderWithProvider(+ <ViewPanelModal+ panel={makePanel('signoz/TimeSeriesPanel')}+ panelId="p1"+ open+ onClose={jest.fn()}+ />,+ );+ const props = mockPreviewPaneRender.mock.calls.at(-1)?.[0] as {+ onClick?: unknown;+ enableDrillDown?: boolean;+ };+ expect(props.enableDrillDown).toBe(true);+ expect(props.onClick).toBe(mockOnPanelClick);+ });});diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldown.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldown.tsxindex 5699c379a7..8351c9e625 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldown.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/hooks/useDrilldown.tsx@@ -10,6 +10,7 @@ import type {import type {DrilldownClickPayload,DrilldownContext,+ OpenDrilldownView,} from 'pages/DashboardPageV2/DashboardContainer/Panels/types/drilldown';import { PANEL_KIND_TO_PANEL_TYPE } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/panelKind';import { getPanelDefinition } from 'pages/DashboardPageV2/DashboardContainer/Panels/registry';@@ -54,6 +55,14 @@ export interface UseDrilldownResult {contextMenuProps: DrilldownContextMenuProps;}+export interface UseDrilldownOptions {+ /**+ * How filter-by-value / breakout hand off the refined query. Defaults to navigating to the View+ * modal (grid); the View modal passes its own handler so those actions refine the view in place.+ */+ openDrilldownView?: OpenDrilldownView;+}+/*** Orchestrates panel drill-down: owns the popover + which submenu is open, and routes the clicked* point to the base aggregate menu (View in Logs/Traces), the group filter menu, or the breakout picker.@@ -61,6 +70,7 @@ export interface UseDrilldownResult {export function useDrilldown(panel: DashboardtypesPanelDTO,panelId: string,+ options?: UseDrilldownOptions,): UseDrilldownResult {const kind = panel.spec.plugin.kind;const panelType = PANEL_KIND_TO_PANEL_TYPE[kind];@@ -122,7 +132,9 @@ export function useDrilldown(onClose();}, [onClose]);- const { openViewWithQuery } = useViewPanel();+ // Default handoff navigates to the View modal (grid); the modal overrides this to refine in place.+ const { openViewWithQuery: navigateToView } = useViewPanel();+ const openViewWithQuery = options?.openDrilldownView ?? navigateToView;const breakout = useDrilldownBreakout({panelId,diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useDashboardFetch.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useDashboardFetch.tsindex a7361b72ae..7330bdd69d 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useDashboardFetch.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/hooks/useDashboardFetch.ts@@ -31,9 +31,15 @@ export interface UseDashboardFetchResult {export function useDashboardFetch(dashboardId: string,): UseDashboardFetchResult {- const { data, isLoading, isError, error, refetch } = useGetDashboardV2({- id: dashboardId,- });+ const { data, isLoading, isError, error, refetch } = useGetDashboardV2(+ { id: dashboardId },+ {+ // The spec is kept fresh in-cache by optimistic patches (useOptimisticPatch),+ // so never auto-refetch: it would flash the grid back to server state as+ // observers mount across the panel tree. Explicit refetch() still works.+ query: { staleTime: Infinity, refetchOnMount: false },+ },+ );const dashboard = data?.data;return { dashboard, isLoading, isError, error, refetch };