Skip to content

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.

feat(dashboard-v2): extend time window from empty panel state (#11999)

Abhi kumar82c833044d0b
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/NoData.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/NoData.tsx
index 914a42d3ba..d7b50d69d9 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/NoData.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/NoData.tsx
@@ -1,37 +1,60 @@
-import { Clock, RotateCw } from '@signozhq/icons';
+import { CalendarRange, Clock, RotateCw } from '@signozhq/icons';
-import PanelMessage from '../PanelMessage/PanelMessage';
+import {
+ selectViewPanelExtendWindow,
+ useViewPanelStore,
+} from '../../../store/useViewPanelStore';
+import PanelLoader from '../PanelLoader/PanelLoader';
+import PanelMessage, { PanelMessageAction } from '../PanelMessage/PanelMessage';
+import { useExtendTimeWindow } from './useExtendTimeWindow';
interface NoDataProps {
- /** Title override. Defaults to the time-range empty-state copy. */
title?: string;
- /** Description override. Defaults to the "widen the range" hint. */
description?: string;
+ /** In flight over empty data → show the loader, not the empty state. */
+ isFetching?: boolean;
/** When provided, renders a Retry button that re-runs the query. */
onRetry?: () => void;
'data-testid'?: string;
}
/**
- * Shared empty-state for panel renderers: wraps `PanelMessage` so every panel
- * kind surfaces the same "no data" affordance when a query returns nothing.
+ * Shared empty-state for panel renderers. The query succeeded but returned nothing,
+ * so we offer to widen the time window — global by default, or the View modal's
+ * local window when it publishes one to the store — alongside a Retry that re-runs
+ * the query.
*/
function NoData({
title = 'No data in this time range',
description = 'Nothing in the selected window. Try widening the range.',
+ isFetching = false,
onRetry,
'data-testid': testId = 'panel-no-data',
}: NoDataProps): JSX.Element {
+ const viewExtend = useViewPanelStore(selectViewPanelExtendWindow);
+ const globalExtend = useExtendTimeWindow();
+ const { canExtend, actionLabel, extend } = viewExtend ?? globalExtend;
+
+ if (isFetching) {
+ return <PanelLoader />;
+ }
+
+ const extendAction: PanelMessageAction | undefined =
+ canExtend && actionLabel
+ ? { label: actionLabel, onClick: extend, icon: <CalendarRange size={14} /> }
+ : undefined;
+
+ const retryAction: PanelMessageAction | undefined = onRetry
+ ? { label: 'Retry', onClick: onRetry, icon: <RotateCw size={14} /> }
+ : undefined;
+
return (
<PanelMessage
icon={<Clock size={18} />}
title={title}
description={description}
- action={
- onRetry
- ? { label: 'Retry', onClick: onRetry, icon: <RotateCw size={14} /> }
- : undefined
- }
+ action={extendAction ?? retryAction}
+ secondaryAction={extendAction ? retryAction : undefined}
data-testid={testId}
/>
);
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/__tests__/NoData.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/__tests__/NoData.test.tsx
new file mode 100644
index 0000000000..fc67513d41
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/__tests__/NoData.test.tsx
@@ -0,0 +1,122 @@
+import { fireEvent, render, screen } from '@testing-library/react';
+
+import { useViewPanelStore } from '../../../../store/useViewPanelStore';
+import { ExtendTimeWindow } from '../extendWindow';
+import NoData from '../NoData';
+
+const mockUseExtendTimeWindow = jest.fn();
+jest.mock('../useExtendTimeWindow', () => ({
+ useExtendTimeWindow: (): ExtendTimeWindow => mockUseExtendTimeWindow(),
+}));
+
+const inert: ExtendTimeWindow = {
+ canExtend: false,
+ actionLabel: null,
+ extend: jest.fn(),
+};
+
+function extender(over?: Partial<ExtendTimeWindow>): ExtendTimeWindow {
+ return {
+ canExtend: true,
+ actionLabel: 'Extend time range',
+ extend: jest.fn(),
+ ...over,
+ };
+}
+
+describe('NoData', () => {
+ beforeEach(() => {
+ mockUseExtendTimeWindow.mockReturnValue(inert);
+ useViewPanelStore.setState({ viewPanelExtendWindow: null });
+ });
+
+ it('renders the empty-state title and hint', () => {
+ render(<NoData />);
+
+ expect(screen.getByTestId('panel-no-data')).toBeInTheDocument();
+ expect(screen.getByText('No data in this time range')).toBeInTheDocument();
+ expect(
+ screen.getByText('Nothing in the selected window. Try widening the range.'),
+ ).toBeInTheDocument();
+ });
+
+ it('offers to extend the window as the primary action', () => {
+ mockUseExtendTimeWindow.mockReturnValue(extender());
+ render(<NoData />);
+
+ const action = screen.getByTestId('panel-no-data-action');
+ expect(action).toHaveTextContent('Extend time range');
+ // No retry handler → no secondary Retry button.
+ expect(
+ screen.queryByTestId('panel-no-data-secondary-action'),
+ ).not.toBeInTheDocument();
+ });
+
+ it('renders both Extend (primary) and Retry (secondary) when a retry handler is given', () => {
+ const onRetry = jest.fn();
+ mockUseExtendTimeWindow.mockReturnValue(extender());
+ render(<NoData onRetry={onRetry} />);
+
+ expect(screen.getByTestId('panel-no-data-action')).toHaveTextContent(
+ 'Extend time range',
+ );
+ const retry = screen.getByTestId('panel-no-data-secondary-action');
+ expect(retry).toHaveTextContent('Retry');
+
+ fireEvent.click(retry);
+ expect(onRetry).toHaveBeenCalledTimes(1);
+ });
+
+ it('falls back to Retry as the sole action when the window cannot be widened', () => {
+ const onRetry = jest.fn();
+ render(<NoData onRetry={onRetry} />);
+
+ const action = screen.getByTestId('panel-no-data-action');
+ expect(action).toHaveTextContent('Retry');
+ expect(
+ screen.queryByTestId('panel-no-data-secondary-action'),
+ ).not.toBeInTheDocument();
+
+ fireEvent.click(action);
+ expect(onRetry).toHaveBeenCalledTimes(1);
+ });
+
+ it('prefers the View modal extender (store) over the global one', () => {
+ const globalExtend = jest.fn();
+ const storeExtend = jest.fn();
+ mockUseExtendTimeWindow.mockReturnValue(extender({ extend: globalExtend }));
+ useViewPanelStore.setState({
+ viewPanelExtendWindow: extender({ extend: storeExtend }),
+ });
+ render(<NoData />);
+
+ fireEvent.click(screen.getByTestId('panel-no-data-action'));
+ expect(storeExtend).toHaveBeenCalledTimes(1);
+ expect(globalExtend).not.toHaveBeenCalled();
+ });
+
+ it('renders no action when nothing can be widened and no retry handler', () => {
+ render(<NoData />);
+
+ expect(screen.queryByTestId('panel-no-data-action')).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId('panel-no-data-secondary-action'),
+ ).not.toBeInTheDocument();
+ });
+
+ it('shows the panel loader (not the empty state) while refetching', () => {
+ mockUseExtendTimeWindow.mockReturnValue(extender());
+ render(<NoData isFetching />);
+
+ expect(screen.getByTestId('panel-loading')).toBeInTheDocument();
+ expect(screen.queryByTestId('panel-no-data')).not.toBeInTheDocument();
+ expect(screen.queryByTestId('panel-no-data-action')).not.toBeInTheDocument();
+ });
+
+ it('honours the data-testid override for the number panel', () => {
+ mockUseExtendTimeWindow.mockReturnValue(extender());
+ render(<NoData data-testid="number-panel-no-data" />);
+
+ expect(screen.getByTestId('number-panel-no-data')).toBeInTheDocument();
+ });
+});
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/__tests__/useExtendTimeWindow.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/__tests__/useExtendTimeWindow.test.tsx
new file mode 100644
index 0000000000..ad63acb8f0
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/__tests__/useExtendTimeWindow.test.tsx
@@ -0,0 +1,96 @@
+import { act, renderHook } from '@testing-library/react';
+import { ReactNode } from 'react';
+// eslint-disable-next-line no-restricted-imports
+import { Provider } from 'react-redux';
+import { MemoryRouter } from 'react-router-dom';
+import { UPDATE_TIME_INTERVAL } from 'types/actions/globalTime';
+import { GlobalReducer } from 'types/reducer/globalTime';
+import configureStore from 'redux-mock-store';
+import thunk from 'redux-thunk';
+
+import { useExtendTimeWindow } from '../useExtendTimeWindow';
+
+const mockSafeNavigate = jest.fn();
+jest.mock('hooks/useSafeNavigate', () => ({
+ useSafeNavigate: (): { safeNavigate: jest.Mock } => ({
+ safeNavigate: mockSafeNavigate,
+ }),
+}));
+
+const NS_PER_MS = 1e6;
+const MINUTE_MS = 60 * 1000;
+const DAY_MS = 24 * 60 * MINUTE_MS;
+
+// A window anchored in the past so the zoom-out ladder is deterministic (real
+// Date.now() is far ahead, so it always center-anchors into a custom range).
+const PAST_END_MS = 1_600_003_600_000;
+
+const mockStore = configureStore([thunk]);
+
+function globalTimeState(
+ partial: Pick<GlobalReducer, 'selectedTime' | 'minTime' | 'maxTime'>,
+): GlobalReducer {
+ return {
+ loading: false,
+ isAutoRefreshDisabled: false,
+ selectedAutoRefreshInterval: '',
+ ...partial,
+ };
+}
+
+function setup(globalTime: GlobalReducer): {
+ result: { current: ReturnType<typeof useExtendTimeWindow> };
+ store: ReturnType<typeof mockStore>;
+} {
+ const store = mockStore({ globalTime });
+ const { result } = renderHook(() => useExtendTimeWindow(), {
+ wrapper: ({ children }: { children: ReactNode }): JSX.Element => (
+ <Provider store={store}>
+ <MemoryRouter>{children}</MemoryRouter>
+ </Provider>
+ ),
+ });
+ return { result, store };
+}
+
+describe('useExtendTimeWindow', () => {
+ beforeEach(() => {
+ mockSafeNavigate.mockClear();
+ });
+
+ it('reports it can extend and dispatches a wider range', () => {
+ const { result, store } = setup(
+ globalTimeState({
+ selectedTime: '30m',
+ minTime: (PAST_END_MS - 30 * MINUTE_MS) * NS_PER_MS,
+ maxTime: PAST_END_MS * NS_PER_MS,
+ }),
+ );
+
+ expect(result.current.canExtend).toBe(true);
+ expect(result.current.actionLabel).toBe('Extend time range');
+
+ act(() => result.current.extend());
+
+ const [action] = store.getActions();
+ expect(action.type).toBe(UPDATE_TIME_INTERVAL);
+ expect(mockSafeNavigate).toHaveBeenCalledTimes(1);
+ });
+
+ it('cannot extend past the widest window', () => {
+ const { result, store } = setup(
+ globalTimeState({
+ selectedTime: 'custom',
+ minTime: (PAST_END_MS - 40 * DAY_MS) * NS_PER_MS,
+ maxTime: PAST_END_MS * NS_PER_MS,
+ }),
+ );
+
+ expect(result.current.canExtend).toBe(false);
+ expect(result.current.actionLabel).toBeNull();
+
+ act(() => result.current.extend());
+ expect(store.getActions()).toHaveLength(0);
+ expect(mockSafeNavigate).not.toHaveBeenCalled();
+ });
+});
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/extendWindow.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/extendWindow.ts
new file mode 100644
index 0000000000..cbe0c98b98
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/extendWindow.ts
@@ -0,0 +1,26 @@
+import type { ZoomOutResult } from 'lib/zoomOutUtils';
+
+export interface ExtendTimeWindow {
+ canExtend: boolean;
+ /** Button copy; null when the window can't be widened further. */
+ actionLabel: string | null;
+ extend: () => void;
+}
+
+const EXTEND_ACTION_LABEL = 'Extend time range';
+
+/**
+ * Adapts a zoom-out ladder result (`getNextZoomOutRange`) plus its apply callback
+ * into the panel empty-state extender. A `null` result means the window is already
+ * at the widest ladder step, so there is nothing to extend to.
+ */
+export function buildExtendWindow(
+ result: ZoomOutResult | null,
+ extend: () => void,
+): ExtendTimeWindow {
+ return {
+ canExtend: result !== null,
+ actionLabel: result ? EXTEND_ACTION_LABEL : null,
+ extend,
+ };
+}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/useExtendTimeWindow.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/useExtendTimeWindow.ts
new file mode 100644
index 0000000000..4f3d8bf2d8
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/useExtendTimeWindow.ts
@@ -0,0 +1,26 @@
+// eslint-disable-next-line no-restricted-imports -- global time lives in redux; V2 time dispatch is not yet migrated
+import { useSelector } from 'react-redux';
+import { useZoomOut } from 'hooks/useZoomOut';
+import { getNextZoomOutRange } from 'lib/zoomOutUtils';
+import { AppState } from 'store/reducers';
+import { GlobalReducer } from 'types/reducer/globalTime';
+
+import { buildExtendWindow, ExtendTimeWindow } from './extendWindow';
+import { NANO_SECOND_MULTIPLIER } from '@/store/globalTime';
+
+/**
+ * Default empty-state extender: widen the dashboard's global time via the shared
+ * zoom-out ladder. Dispatch + URL sync live in `useZoomOut`; the View modal
+ * overrides this with its own local extender via the store.
+ */
+export function useExtendTimeWindow(): ExtendTimeWindow {
+ const { minTime, maxTime } = useSelector<AppState, GlobalReducer>(
+ (state) => state.globalTime,
+ );
+ const extend = useZoomOut();
+ const result = getNextZoomOutRange(
+ Math.floor(minTime / NANO_SECOND_MULTIPLIER),
+ Math.floor(maxTime / NANO_SECOND_MULTIPLIER),
+ );
+ return buildExtendWindow(result, extend);
+}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader.module.scss
new file mode 100644
index 0000000000..7c97e35dff
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader.module.scss
@@ -0,0 +1,10 @@
+// Centred full-body spinner (first-fetch + refetch-over-empty).
+.loader {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 12px;
+ min-height: 0;
+ min-width: 0;
+}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader.tsx
new file mode 100644
index 0000000000..417fda02f8
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader.tsx
@@ -0,0 +1,21 @@
+import { Spin } from 'antd';
+import { Loader } from '@signozhq/icons';
+
+import styles from './PanelLoader.module.scss';
+
+interface PanelLoaderProps {
+ 'data-testid'?: string;
+}
+
+/** Centred full-panel spinner shown while a query is in flight with nothing to display yet. */
+function PanelLoader({
+ 'data-testid': testId = 'panel-loading',
+}: PanelLoaderProps): JSX.Element {
+ return (
+ <div className={styles.loader} data-testid={testId}>
+ <Spin indicator={<Loader size={14} className="animate-spin" />} />
+ </div>
+ );
+}
+
+export default PanelLoader;
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.module.scss
index 2d5e031f5d..68bbab8451 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.module.scss
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.module.scss
@@ -45,6 +45,10 @@
overflow-wrap: anywhere;
}
-.action {
+.actions {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ gap: 8px;
margin-top: 8px;
}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.tsx
index c5fd11bccc..1869e14c38 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage.tsx
@@ -20,6 +20,8 @@ interface PanelMessageProps {
description?: string;
/** Optional call-to-action (e.g. Retry). Omitted → no button. */
action?: PanelMessageAction;
+ /** Second call-to-action rendered beside `action` (e.g. Extend + Retry). */
+ secondaryAction?: PanelMessageAction;
/** `danger` tints the icon for failure states; `neutral` for empty states. */
tone?: 'neutral' | 'danger';
'data-testid'?: string;
@@ -34,9 +36,18 @@ function PanelMessage({
title,
description,
action,
+ secondaryAction,
tone = 'neutral',
'data-testid': testId,
}: PanelMessageProps): JSX.Element {
+ const actions: Array<{ suffix: string; action: PanelMessageAction }> = [];
+ if (action) {
+ actions.push({ suffix: 'action', action });
+ }
+ if (secondaryAction) {
+ actions.push({ suffix: 'secondary-action', action: secondaryAction });
+ }
+
return (
<div className={styles.message} data-testid={testId}>
<div className={cx(styles.icon, { [styles.iconDanger]: tone === 'danger' })}>
@@ -48,18 +59,22 @@ function PanelMessage({
{description}
</Typography.Text>
)}
- {action && (
- <Button
- variant="outlined"
- color="secondary"
- size="sm"
- prefix={action.icon}
- onClick={action.onClick}
- className={styles.action}
- data-testid={testId ? `${testId}-action` : undefined}
- >
- {action.label}
- </Button>
+ {actions.length > 0 && (
+ <div className={styles.actions}>
+ {actions.map(({ suffix, action: item }) => (
+ <Button
+ key={suffix}
+ variant="outlined"
+ color="secondary"
+ size="sm"
+ prefix={item.icon}
+ onClick={item.onClick}
+ data-testid={testId ? `${testId}-${suffix}` : undefined}
+ >
+ {item.label}
+ </Button>
+ ))}
+ </div>
)}
</div>
);
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/__tests__/PanelMessage.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/__tests__/PanelMessage.test.tsx
index 9ba528e86b..ae7c56eb4a 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/__tests__/PanelMessage.test.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/__tests__/PanelMessage.test.tsx
@@ -43,4 +43,28 @@ describe('PanelMessage', () => {
fireEvent.click(button);
expect(onClick).toHaveBeenCalledTimes(1);
});
+
+ it('renders both actions side by side and wires each onClick', () => {
+ const onPrimary = jest.fn();
+ const onSecondary = jest.fn();
+ render(
+ <PanelMessage
+ icon={null}
+ title="No data in this time range"
+ action={{ label: 'Extend time range', onClick: onPrimary }}
+ secondaryAction={{ label: 'Retry', onClick: onSecondary }}
+ data-testid="panel-no-data"
+ />,
+ );
+
+ const primary = screen.getByTestId('panel-no-data-action');
+ const secondary = screen.getByTestId('panel-no-data-secondary-action');
+ expect(primary).toHaveTextContent('Extend time range');
+ expect(secondary).toHaveTextContent('Retry');
+
+ fireEvent.click(primary);
+ fireEvent.click(secondary);
+ expect(onPrimary).toHaveBeenCalledTimes(1);
+ expect(onSecondary).toHaveBeenCalledTimes(1);
+ });
});
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/BarChartPanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/BarChartPanel/Renderer.tsx
index 5d591ce422..1e7dd508ad 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/BarChartPanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/BarChartPanel/Renderer.tsx
@@ -35,6 +35,7 @@ function BarPanelRenderer({
panelId,
panel,
data,
+ isFetching,
refetch,
onClick,
onDragSelect,
@@ -186,7 +187,9 @@ function BarPanelRenderer({
data-testid="bar-panel-renderer"
className={PanelStyles.panelContainer}
>
- {flatSeries.length === 0 && <NoData onRetry={refetch} />}
+ {flatSeries.length === 0 && (
+ <NoData isFetching={isFetching} onRetry={refetch} />
+ )}
{flatSeries.length > 0 &&
containerDimensions.width > 0 &&
containerDimensions.height > 0 && (
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/HistogramPanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/HistogramPanel/Renderer.tsx
index e1156f4c76..6f0dc9d821 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/HistogramPanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/HistogramPanel/Renderer.tsx
@@ -25,6 +25,7 @@ function HistogramPanelRenderer({
panelId,
panel,
data,
+ isFetching,
refetch,
panelMode,
}: PanelRendererProps<'signoz/HistogramPanel'>): JSX.Element {
@@ -104,7 +105,9 @@ function HistogramPanelRenderer({
data-testid="histogram-panel-renderer"
className={PanelStyles.panelContainer}
>
- {flatSeries.length === 0 && <NoData onRetry={refetch} />}
+ {flatSeries.length === 0 && (
+ <NoData isFetching={isFetching} onRetry={refetch} />
+ )}
{flatSeries.length > 0 &&
containerDimensions.width > 0 &&
containerDimensions.height > 0 && (
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/Renderer.tsx
index 8c818c12ac..cbdcb29054 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/ListPanel/Renderer.tsx
@@ -33,6 +33,7 @@ function ListPanelRenderer({
panelId,
panel,
data,
+ isFetching,
refetch,
searchTerm = '',
pagination,
@@ -142,7 +143,7 @@ function ListPanelRenderer({
className={PanelStyles.panelContainer}
>
{!table || dataSource.length === 0 ? (
- <NoData onRetry={refetch} />
+ <NoData isFetching={isFetching} onRetry={refetch} />
) : (
<>
<div
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/NumberPanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/NumberPanel/Renderer.tsx
index 3109a1464b..0d742f779a 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/NumberPanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/NumberPanel/Renderer.tsx
@@ -24,6 +24,7 @@ import ValueDisplay from './components/ValueDisplay/ValueDisplay';
function NumberPanelRenderer({
panel,
data,
+ isFetching,
refetch,
onClick,
enableDrillDown,
@@ -125,7 +126,11 @@ function NumberPanelRenderer({
: {})}
>
{value === null ? (
- <NoData data-testid="number-panel-no-data" onRetry={refetch} />
+ <NoData
+ data-testid="number-panel-no-data"
+ isFetching={isFetching}
+ onRetry={refetch}
+ />
) : (
<ValueDisplay
value={formattedValue}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/PieChartPanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/PieChartPanel/Renderer.tsx
index 26253a4b7e..b2991f74d0 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/PieChartPanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/PieChartPanel/Renderer.tsx
@@ -27,6 +27,7 @@ function PiePanelRenderer({
panelId,
panel,
data,
+ isFetching,
refetch,
onClick,
enableDrillDown,
@@ -94,7 +95,7 @@ function PiePanelRenderer({
return (
<div data-testid="pie-panel-renderer" className={PanelStyles.panelContainer}>
{slices.length === 0 ? (
- <NoData onRetry={refetch} />
+ <NoData isFetching={isFetching} onRetry={refetch} />
) : (
<Pie
data={slices}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/Renderer.tsx
index 6048a1703e..606acbcd5d 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TablePanel/Renderer.tsx
@@ -35,6 +35,7 @@ function TablePanelRenderer({
panelId,
panel,
data,
+ isFetching,
refetch,
searchTerm = '',
onClick,
@@ -159,7 +160,7 @@ function TablePanelRenderer({
className={PanelStyles.panelContainer}
>
{!table || dataSource.length === 0 ? (
- <NoData onRetry={refetch} />
+ <NoData isFetching={isFetching} onRetry={refetch} />
) : (
<div className={styles.container}>
<Table
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TimeSeriesPanel/Renderer.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TimeSeriesPanel/Renderer.tsx
index e167465e0c..64f83aa724 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TimeSeriesPanel/Renderer.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/Panels/kinds/TimeSeriesPanel/Renderer.tsx
@@ -35,6 +35,7 @@ function TimeSeriesPanelRenderer({
panelId,
panel,
data,
+ isFetching,
refetch,
onClick,
onDragSelect,
@@ -187,7 +188,9 @@ function TimeSeriesPanelRenderer({
data-testid="time-series-renderer"
className={PanelStyles.panelContainer}
>
- {flatSeries.length === 0 && <NoData onRetry={refetch} />}
+ {flatSeries.length === 0 && (
+ <NoData isFetching={isFetching} onRetry={refetch} />
+ )}
{flatSeries.length > 0 &&
containerDimensions.width > 0 &&
containerDimensions.height > 0 && (
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.module.scss
index 6a84cbda7e..ce295b39f7 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.module.scss
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.module.scss
@@ -1,18 +1,4 @@
-// Generic centred body — used by the loading indicator.
-.body {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 12px;
- color: var(--l2-foreground);
- font-size: 12px;
- text-align: center;
-}
-
-// Container for the rendered chart — fills the panel below the header and lets
-// the chart shrink (min-* 0) so it resizes with the grid cell.
-.chartContainer {
+.panelContainer {
flex: 1;
display: flex;
min-height: 0;
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.tsx
index 81badd62b0..5a0ab2884a 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/PanelBody/PanelBody.tsx
@@ -1,7 +1,7 @@
-import { Spin } from 'antd';
-import { Loader, RotateCw, SquarePlus, TriangleAlert } from '@signozhq/icons';
+import { RotateCw, SquarePlus, TriangleAlert } from '@signozhq/icons';
import type { DashboardtypesPanelDTO } from 'api/generated/services/sigNoz.schemas';
import { PanelMode } from 'container/DashboardContainer/visualization/panels/types';
+import PanelLoader from 'pages/DashboardPageV2/DashboardContainer/Panels/components/PanelLoader/PanelLoader';
import PanelMessage from 'pages/DashboardPageV2/DashboardContainer/Panels/components/PanelMessage/PanelMessage';
import type { AnyPanelInteractionProps } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/interactions';
import type { RenderablePanelDefinition } from 'pages/DashboardPageV2/DashboardContainer/Panels/types/panelDefinition';
@@ -106,17 +106,13 @@ function PanelBody({
}
// Full-panel loader only on first fetch; a refetch over existing data keeps the renderer
- // mounted (e.g. list page change) with the header carrying the in-flight indicator.
+ // mounted (e.g. list page change). A refetch over empty data loads via NoData.
if (isFetching && !hasData) {
- return (
- <div className={styles.body} data-testid="panel-loading">
- <Spin indicator={<Loader size={14} className="animate-spin" />} />
- </div>
- );
+ return <PanelLoader />;
}
return (
- <div className={styles.chartContainer}>
+ <div className={styles.panelContainer}>
<panelDefinition.Renderer
panelId={panelId}
panel={panel}
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx
index 1fe1f06cf8..334b2efa36 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/ViewPanelModalContent.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from 'react';
+import { useEffect, 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';
@@ -6,6 +6,7 @@ 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 { useViewPanelStore } from 'pages/DashboardPageV2/DashboardContainer/store/useViewPanelStore';
import { useOpenPanelEditor } from 'pages/DashboardPageV2/DashboardContainer/hooks/useOpenPanelEditor';
import { useDrilldown } from '../hooks/useDrilldown';
@@ -38,6 +39,7 @@ function ViewPanelModalContent({
onTimeChange,
refreshWindow,
onDragSelect,
+ extendWindow,
} = useViewPanelTimeWindow();
const {
@@ -69,6 +71,15 @@ function ViewPanelModalContent({
);
const openPanelEditor = useOpenPanelEditor();
+ // Publish the modal's local extender for the nested no-data state; cleared on close.
+ const setViewPanelExtendWindow = useViewPanelStore(
+ (s) => s.setViewPanelExtendWindow,
+ );
+ useEffect(() => {
+ setViewPanelExtendWindow(extendWindow);
+ return (): void => setViewPanelExtendWindow(null);
+ }, [extendWindow, setViewPanelExtendWindow]);
+
// The View action only appears for registered kinds, so this is defensive.
if (!panelDefinition) {
return null;
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelTimeWindow.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelTimeWindow.ts
index 2b9e6c9e3c..aab5750602 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelTimeWindow.ts
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/ViewPanelModal/useViewPanelTimeWindow.ts
@@ -6,11 +6,15 @@ import type {
Time,
} from 'container/TopNav/DateTimeSelectionV2/types';
import GetMinMax from 'lib/getMinMax';
+import {
+ buildExtendWindow,
+ ExtendTimeWindow,
+} from 'pages/DashboardPageV2/DashboardContainer/Panels/components/NoData/extendWindow';
+import { getNextZoomOutRange } from 'lib/zoomOutUtils';
import type { PanelQueryTimeOverride } from 'pages/DashboardPageV2/DashboardContainer/hooks/usePanelQuery';
import { AppState } from 'store/reducers';
import { GlobalReducer } from 'types/reducer/globalTime';
-
-const NS_PER_MS = 1e6;
+import { NANO_SECOND_MULTIPLIER } from '@/store/globalTime';
export interface ViewPanelTimeWindow {
/** Absolute window (epoch ms) to pass to usePanelQuery as a time override. */
@@ -26,6 +30,8 @@ export interface ViewPanelTimeWindow {
refreshWindow: () => void;
/** Drag-to-zoom on a time chart → set a custom window locally (not the dashboard's). */
onDragSelect: (start: number, end: number) => void;
+ /** Widens this local window in place — powers the empty-state "extend" action. */
+ extendWindow: ExtendTimeWindow;
}
/**
@@ -45,8 +51,8 @@ export function useViewPanelTimeWindow(): ViewPanelTimeWindow {
>(selectedTime as Time);
const [timeOverride, setTimeOverride] = useState<PanelQueryTimeOverride>(
() => ({
- startMs: Math.floor(minTime / NS_PER_MS),
- endMs: Math.floor(maxTime / NS_PER_MS),
+ startMs: Math.floor(minTime / NANO_SECOND_MULTIPLIER),
+ endMs: Math.floor(maxTime / NANO_SECOND_MULTIPLIER),
}),
);
@@ -64,8 +70,8 @@ export function useViewPanelTimeWindow(): ViewPanelTimeWindow {
// GetMinMax returns nanoseconds — convert to the ms window we work in.
const { minTime: startNs, maxTime: endNs } = GetMinMax(interval);
setTimeOverride({
- startMs: Math.floor(startNs / NS_PER_MS),
- endMs: Math.floor(endNs / NS_PER_MS),
+ startMs: Math.floor(startNs / NANO_SECOND_MULTIPLIER),
+ endMs: Math.floor(endNs / NANO_SECOND_MULTIPLIER),
});
},
[],
@@ -78,8 +84,8 @@ export function useViewPanelTimeWindow(): ViewPanelTimeWindow {
}
const { minTime: startNs, maxTime: endNs } = GetMinMax(selectedInterval);
setTimeOverride({
- startMs: Math.floor(startNs / NS_PER_MS),
- endMs: Math.floor(endNs / NS_PER_MS),
+ startMs: Math.floor(startNs / NANO_SECOND_MULTIPLIER),
+ endMs: Math.floor(endNs / NANO_SECOND_MULTIPLIER),
});
}, [selectedInterval]);
@@ -95,6 +101,22 @@ export function useViewPanelTimeWindow(): ViewPanelTimeWindow {
setTimeOverride({ startMs, endMs });
}, []);
+ // Empty-state extender that widens this local window via onTimeChange (not global time).
+ const extendWindow = useMemo<ExtendTimeWindow>(() => {
+ const result = getNextZoomOutRange(timeOverride.startMs, timeOverride.endMs);
+ return buildExtendWindow(result, (): void => {
+ if (!result) {
+ return;
+ }
+ const [startMs, endMs] = result.range;
+ if (result.preset) {
+ onTimeChange(result.preset);
+ } else {
+ onTimeChange('custom', [startMs, endMs]);
+ }
+ });
+ }, [timeOverride, onTimeChange]);
+
return useMemo(
() => ({
timeOverride,
@@ -102,7 +124,15 @@ export function useViewPanelTimeWindow(): ViewPanelTimeWindow {
onTimeChange,
refreshWindow,
onDragSelect,
+ extendWindow,
}),
- [timeOverride, selectedInterval, onTimeChange, refreshWindow, onDragSelect],
+ [
+ timeOverride,
+ selectedInterval,
+ onTimeChange,
+ refreshWindow,
+ onDragSelect,
+ extendWindow,
+ ],
);
}
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.tsx
index dc252ef495..5ba040442e 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
@@ -103,6 +103,7 @@ jest.mock('../ViewPanelModal/useViewPanelTimeWindow', () => ({
onTimeChange: jest.fn(),
refreshWindow: jest.fn(),
onDragSelect: jest.fn(),
+ extendWindow: { canExtend: false, actionLabel: null, extend: jest.fn() },
}),
}));
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/useViewPanelTimeWindow.test.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/useViewPanelTimeWindow.test.ts
index 2ffe707d87..4ec23c72bb 100644
--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/useViewPanelTimeWindow.test.ts
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelsAndSectionsLayout/Panel/__tests__/useViewPanelTimeWindow.test.ts
@@ -90,4 +90,35 @@ describe('useViewPanelTimeWindow', () => {
expect(result.current.timeOverride).toStrictEqual(initial);
});
+
+ it('widens the local window in place via the zoom-out ladder', () => {
+ const { result } = renderHook(() => useViewPanelTimeWindow());
+ act(() => result.current.onDragSelect(1000, 5000));
+
+ expect(result.current.extendWindow.canExtend).toBe(true);
+ expect(result.current.extendWindow.actionLabel).toBe('Extend time range');
+
+ act(() => result.current.extendWindow.extend());
+
+ // A past 4s window (< 15m) zooms out 3× around its centre (3000): [-3000, 9000].
+ expect(result.current.selectedInterval).toBe('custom');
+ expect(result.current.timeOverride).toStrictEqual({
+ startMs: -3000,
+ endMs: 9000,
+ });
+ });
+
+ it('cannot extend a window already at the widest ladder step', () => {
+ const { result } = renderHook(() => useViewPanelTimeWindow());
+ // 40 days > the ladder's 1-month max.
+ act(() => result.current.onDragSelect(0, 40 * 24 * 60 * 60 * 1000));
+
+ expect(result.current.extendWindow.canExtend).toBe(false);
+ expect(result.current.extendWindow.actionLabel).toBeNull();
+
+ // extend() is a no-op — the window is unchanged.
+ const before = result.current.timeOverride;
+ act(() => result.current.extendWindow.extend());
+ expect(result.current.timeOverride).toStrictEqual(before);
+ });
});
diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/store/useViewPanelStore.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/store/useViewPanelStore.ts
new file mode 100644
index 0000000000..ff4aee9967
--- /dev/null
+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/store/useViewPanelStore.ts
@@ -0,0 +1,24 @@
+import { create } from 'zustand';
+
+import type { ExtendTimeWindow } from '../Panels/components/NoData/extendWindow';
+
+/**
+ * Kept out of `useDashboardStore` (never persisted): the View modal publishes its
+ * local-window extender here so the deeply-nested `NoData` state reads it without
+ * prop threading. Set while the modal is open, cleared on close.
+ */
+export interface ViewPanelStore {
+ viewPanelExtendWindow: ExtendTimeWindow | null;
+ setViewPanelExtendWindow: (extendWindow: ExtendTimeWindow | null) => void;
+}
+
+export const useViewPanelStore = create<ViewPanelStore>((set) => ({
+ viewPanelExtendWindow: null,
+ setViewPanelExtendWindow: (viewPanelExtendWindow): void => {
+ set({ viewPanelExtendWindow });
+ },
+}));
+
+export const selectViewPanelExtendWindow = (
+ state: ViewPanelStore,
+): ExtendTimeWindow | null => state.viewPanelExtendWindow;