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
fix(dashboard-v2): keep new-panel Save enabled after running the query (#12311)
Abhi kumara28b95da3584
diff --git a/frontend/src/pages/DashboardsListPageV2/components/DeleteConfirmModal/DeleteConfirmModal.module.scss b/frontend/src/components/DeleteConfirmModal/DeleteConfirmModal.module.scsssimilarity index 100%rename from frontend/src/pages/DashboardsListPageV2/components/DeleteConfirmModal/DeleteConfirmModal.module.scssrename to frontend/src/components/DeleteConfirmModal/DeleteConfirmModal.module.scssdiff --git a/frontend/src/pages/DashboardsListPageV2/components/DeleteConfirmModal/useDeleteConfirm.tsx b/frontend/src/components/DeleteConfirmModal/useDeleteConfirm.tsxsimilarity index 100%rename from frontend/src/pages/DashboardsListPageV2/components/DeleteConfirmModal/useDeleteConfirm.tsxrename to frontend/src/components/DeleteConfirmModal/useDeleteConfirm.tsxdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.module.scss b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.module.scssindex 5ac8da8689..71b97b66e1 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.module.scss+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.module.scss@@ -11,3 +11,9 @@border: 1px solid var(--l3-border) !important;box-shadow: none !important;}++/* Highlights the dashboard name inside the delete-confirm title. */+.deleteName {+ color: var(--danger-background);+ font-weight: var(--font-weight-medium);+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.tsxindex 909e351715..5d17a98e99 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/DashboardActions.tsx@@ -27,16 +27,13 @@ import logEvent from 'api/common/logEvent';import { cloneDashboardV2 } from 'api/generated/services/dashboard';import type { DashboardtypesGettableDashboardV2DTO } from 'api/generated/services/sigNoz.schemas';import ROUTES from 'constants/routes';-import { useDeleteDashboard } from 'hooks/dashboard/useDeleteDashboard';import { useSafeNavigate } from 'hooks/useSafeNavigate';-import history from 'lib/history';import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';import { useAppContext } from 'providers/App/App';import { useErrorModal } from 'providers/ErrorModalProvider';import APIError from 'types/api/error';import { USER_ROLES } from 'types/roles';-import ConfirmDeleteDialog from '../../components/ConfirmDeleteDialog/ConfirmDeleteDialog';import DisabledControlTooltip from '../../components/DisabledControlTooltip/DisabledControlTooltip';import DisabledMenuItemLabel from '../../components/DisabledMenuItemLabel/DisabledMenuItemLabel';import DashboardSettings from '../../DashboardSettings';@@ -45,6 +42,7 @@ import SectionTitleModal from '../../PanelsAndSectionsLayout/Section/SectionTitlimport JsonEditorDrawer from '../JsonEditorDrawer/JsonEditorDrawer';import SettingsDrawer from '../SettingsDrawer';import styles from './DashboardActions.module.scss';+import { useDeleteDashboardAction } from './useDeleteDashboardAction';import { DASHBOARD_LOCKED_REASON } from '../../hooks/useDashboardEditGuard';import { useDashboardStore } from '../../store/useDashboardStore';@@ -84,8 +82,12 @@ function DashboardActions({const [isCloning, setIsCloning] = useState<boolean>(false);const [isNewSectionOpen, setIsNewSectionOpen] = useState<boolean>(false);- const [isDeleteOpen, setIsDeleteOpen] = useState<boolean>(false);- const deleteDashboardMutation = useDeleteDashboard(dashboard.id);+ const { contextHolder: deleteConfirmHolder, confirmDeleteDashboard } =+ useDeleteDashboardAction({+ dashboardId: dashboard.id,+ dashboardName: title,+ panelCount: Object.keys(dashboard.spec.panels).length,+ });// Open the settings drawer when something in the tree requests it (e.g. the// variables bar's "Add variable" button).@@ -132,19 +134,6 @@ function DashboardActions({}}, [dashboard.id, title, safeNavigate, showErrorModal]);- const handleConfirmDelete = useCallback((): void => {- deleteDashboardMutation.mutate(undefined, {- onSuccess: () => {- void logEvent(DashboardDetailEvents.Deleted, {- dashboardId: dashboard.id,- panelCount: Object.keys(dashboard.spec.panels).length,- });- setIsDeleteOpen(false);- history.replace(ROUTES.ALL_DASHBOARD);- },- });- }, [deleteDashboardMutation, dashboard.id, dashboard.spec.panels]);-const handleOpenSettings = useCallback((): void => {void logEvent(DashboardDetailEvents.SettingsOpened, {dashboardId: dashboard.id,@@ -248,7 +237,7 @@ function DashboardActions({icon: <Trash2 size={14} />,danger: true,disabled: isLocked,- onClick: (): void => setIsDeleteOpen(true),+ onClick: confirmDeleteDashboard,},);}@@ -266,6 +255,7 @@ function DashboardActions({handleClone,onLockToggle,handleEnterFullScreen,+ confirmDeleteDashboard,]);return (@@ -348,14 +338,7 @@ function DashboardActions({isOpen={isJsonEditorOpen}onClose={(): void => setIsJsonEditorOpen(false)}/>- <ConfirmDeleteDialog- open={isDeleteOpen}- title={`Delete dashboard"?`}- description={`Are you sure you want to delete this dashboard - "${title}"? This action cannot be undone.`}- isLoading={deleteDashboardMutation.isLoading}- onConfirm={handleConfirmDelete}- onClose={(): void => setIsDeleteOpen(false)}- />+ {deleteConfirmHolder}<SectionTitleModalopen={isNewSectionOpen}heading="New section"diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/useDeleteDashboardAction.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/useDeleteDashboardAction.tsxnew file mode 100644index 0000000000..095e985774--- /dev/null+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/DashboardPageToolbar/DashboardActions/useDeleteDashboardAction.tsx@@ -0,0 +1,89 @@+import { type ReactNode, useCallback } from 'react';+import { useQueryClient } from 'react-query';+import { toast } from '@signozhq/ui/sonner';+import { Typography } from '@signozhq/ui/typography';+import logEvent from 'api/common/logEvent';+import {+ invalidateListDashboardsForUserV2,+ useDeleteDashboardV2,+} from 'api/generated/services/dashboard';+import { useDeleteConfirm } from 'components/DeleteConfirmModal/useDeleteConfirm';+import ROUTES from 'constants/routes';+import { useDashboardPreferencesStore } from 'hooks/dashboard/useDashboardPreference';+import history from 'lib/history';+import { DashboardDetailEvents } from 'pages/DashboardPageV2/constants/events';+import { useErrorModal } from 'providers/ErrorModalProvider';+import APIError from 'types/api/error';++import styles from './DashboardActions.module.scss';++interface UseDeleteDashboardActionArgs {+ dashboardId: string;+ dashboardName: string;+ panelCount: number;+}++interface UseDeleteDashboardAction {+ /** Must be rendered in the calling component for the modal to appear. */+ contextHolder: ReactNode;+ confirmDeleteDashboard: () => void;+}++/**+ * Deletes the open dashboard through the v2 endpoint behind the shared+ * destructive confirmation, then drops its local preferences, refreshes the+ * dashboard list cache and sends the user back to the list.+ */+export function useDeleteDashboardAction({+ dashboardId,+ dashboardName,+ panelCount,+}: UseDeleteDashboardActionArgs): UseDeleteDashboardAction {+ const queryClient = useQueryClient();+ const { showErrorModal } = useErrorModal();+ const { contextHolder, confirmDelete } = useDeleteConfirm();+ const removePreferences = useDashboardPreferencesStore(+ (state) => state.removePreferences,+ );++ const { mutate: deleteDashboard } = useDeleteDashboardV2({+ mutation: {+ onSuccess: async (): Promise<void> => {+ void logEvent(DashboardDetailEvents.Deleted, { dashboardId, panelCount });+ removePreferences(dashboardId);+ await invalidateListDashboardsForUserV2(queryClient);+ toast.success('Dashboard deleted successfully');+ history.replace(ROUTES.ALL_DASHBOARD);+ },+ onError: (error: unknown): void => {+ showErrorModal(error as APIError);+ },+ },+ });++ const confirmDeleteDashboard = useCallback((): void => {+ confirmDelete({+ title: (+ <Typography.Title level={5}>+ Are you sure you want to delete the+ <Typography.Text className={styles.deleteName}>+ {' '}+ {dashboardName}{' '}+ </Typography.Text>+ dashboard?+ </Typography.Title>+ ),+ content: 'This action cannot be undone.',+ // Keeps the Delete button loading until the mutation settles, then closes.+ onConfirm: () =>+ new Promise<void>((resolve) => {+ deleteDashboard(+ { pathParams: { id: dashboardId } },+ { onSettled: () => resolve() },+ );+ }),+ });+ }, [confirmDelete, dashboardName, deleteDashboard, dashboardId]);++ return { contextHolder, confirmDeleteDashboard };+}diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsxindex 43a7804a50..4a949c8122 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/Header.tsx@@ -1,5 +1,6 @@import { useCallback } from 'react';import { SolidAlertTriangle, X } from '@signozhq/icons';+import { Badge } from '@signozhq/ui/badge';import { Button } from '@signozhq/ui/button';import { DialogWrapper } from '@signozhq/ui/dialog';import { Divider } from '@signozhq/ui/divider';@@ -13,6 +14,7 @@ import DisabledControlTooltip from '../../components/DisabledControlTooltip/Disaimport styles from './Header.module.scss';interface HeaderProps {+ /** Unsaved edits exist — shows the "Unsaved Changes" badge and gates the discard confirmation on close (not the Save button). */isDirty: boolean;isSaving: boolean;showSwitchToView?: boolean;@@ -66,6 +68,11 @@ function Header({/><Divider type="vertical" /><Typography.Text>Configure panel</Typography.Text>+ {isDirty && (+ <Badge color="warning" data-testid="panel-editor-v2-unsaved-badge">+ Unsaved Changes+ </Badge>+ )}</div><div className={styles.actions}><HeaderRightSection@@ -88,7 +95,7 @@ function Header({variant="solid"color="primary"data-testid="panel-editor-v2-save"- disabled={readOnly || !isDirty || isSaving}+ disabled={readOnly || isSaving}loading={!readOnly && isSaving}onClick={readOnly ? undefined : onSave}>diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/__tests__/Header.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/__tests__/Header.test.tsxindex 545a7009c1..ed747e7f3e 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/__tests__/Header.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/Header/__tests__/Header.test.tsx@@ -1,3 +1,4 @@+import type { ComponentProps } from 'react';import { MemoryRouter } from 'react-router-dom';import { render, screen } from '@testing-library/react';import { TooltipProvider } from '@signozhq/ui/tooltip';@@ -23,7 +24,9 @@ jest.mock('api/common/logEvent', () => ({const mockUseIsAIAssistantEnabled = useIsAIAssistantEnabled as jest.Mock;-function renderHeader(): void {+function renderHeader(+ props: Partial<ComponentProps<typeof Header>> = {},+): void {// AppLayout supplies the TooltipProvider in the app; the header is rendered bare here.render(<MemoryRouter>@@ -33,6 +36,7 @@ function renderHeader(): void {isSaving={false}onSave={jest.fn()}onClose={jest.fn()}+ {...props}/></TooltipProvider></MemoryRouter>,@@ -66,4 +70,34 @@ describe('PanelEditor Header', () => {).not.toBeInTheDocument();expect(screen.getByTestId('panel-editor-v2-save')).toBeInTheDocument();});++ it('keeps Save enabled even when there are no unsaved edits', () => {+ mockUseIsAIAssistantEnabled.mockReturnValue(false);++ renderHeader({ isDirty: false });++ expect(screen.getByTestId('panel-editor-v2-save')).toBeEnabled();+ });++ it('disables Save only while read-only or saving', () => {+ mockUseIsAIAssistantEnabled.mockReturnValue(false);++ renderHeader({ isDirty: true, readOnly: true, readOnlyReason: 'Locked' });++ expect(screen.getByTestId('panel-editor-v2-save')).toBeDisabled();+ });++ it('shows the Unsaved Changes badge only when there are unsaved edits', () => {+ mockUseIsAIAssistantEnabled.mockReturnValue(false);++ renderHeader({ isDirty: false });+ expect(+ screen.queryByTestId('panel-editor-v2-unsaved-badge'),+ ).not.toBeInTheDocument();++ renderHeader({ isDirty: true });+ expect(+ screen.getByTestId('panel-editor-v2-unsaved-badge'),+ ).toBeInTheDocument();+ });});diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsxindex 1d5243109c..c3d596abff 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/__tests__/PanelEditorContainer.test.tsx@@ -1,5 +1,6 @@import { render, screen, waitFor } from '@testing-library/react';import userEvent from '@testing-library/user-event';+import { toast } from '@signozhq/ui/sonner';import type { DashboardtypesPanelDTO } from 'api/generated/services/sigNoz.schemas';import { PANEL_TYPES } from 'constants/queryBuilder';import { getPanelDefinition } from 'pages/DashboardPageV2/DashboardContainer/Panels/registry';@@ -100,6 +101,12 @@ jest.mock('@signozhq/ui/resizable', () => ({jest.mock('@signozhq/ui/sonner', () => ({toast: { success: jest.fn(), error: jest.fn() },}));+const mockShowErrorModal = jest.fn();+jest.mock('providers/ErrorModalProvider', () => ({+ useErrorModal: (): { showErrorModal: jest.Mock } => ({+ showErrorModal: mockShowErrorModal,+ }),+}));// Children mocked to capture props (and expose a Save trigger / footer slot).const mockHeaderProps = jest.fn();@@ -261,13 +268,13 @@ describe('PanelEditorContainer composition', () => {);});- it('keeps a query-less new panel unsaveable but still serializes its seed query', () => {+ it('keeps a query-less new panel clean 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.+ // No query and no edits yet → not dirty, so closing won't prompt to discard.expect(mockHeaderProps).toHaveBeenCalledWith(expect.objectContaining({ isDirty: false }),);@@ -290,7 +297,7 @@ describe('PanelEditorContainer composition', () => {);});- it('marks a new panel that already has a query saveable (e.g. list auto-runs one)', () => {+ it('marks a new panel that already has a query dirty (e.g. list auto-runs one)', () => {const seededQuery = {spec: { plugin: { kind: 'signoz/BuilderQuery', spec: { signal: 'logs' } } },};@@ -327,6 +334,24 @@ describe('PanelEditorContainer composition', () => {expect(mockSave).toHaveBeenCalledWith(panel.spec);});+ it('surfaces a save failure through the error modal', async () => {+ // The raw thrown value flows straight to the modal, which normalizes it to an+ // APIError itself (that normalization is covered by ErrorModalProvider's tests).+ const failure = {+ response: {+ status: 400,+ data: { error: { code: 'INVALID', message: 'Panel name already exists' } },+ },+ };+ mockSave.mockRejectedValueOnce(failure);+ setup(makePanel('signoz/TimeSeriesPanel'));++ await userEvent.click(screen.getByTestId('editor-save'));++ await waitFor(() => expect(mockShowErrorModal).toHaveBeenCalledWith(failure));+ expect(toast.error).not.toHaveBeenCalled();+ });+it('marks the saved panel to be scrolled into view on the dashboard', async () => {setup(makePanel('signoz/TimeSeriesPanel'));diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/usePanelEditorQuerySync.integration.test.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/usePanelEditorQuerySync.integration.test.tsxindex bbe357cfca..57c9faee06 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/usePanelEditorQuerySync.integration.test.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/__tests__/usePanelEditorQuerySync.integration.test.tsx@@ -117,6 +117,49 @@ describe('usePanelEditorQuerySync (real query builder)', () => {},);+ it('a NEW panel stays query-dirty after Stage & Run commits the edited query into the draft', async () => {+ // Repro of the P0: new panel → edit → Run commits the query into the draft; the+ // dirty baseline must not drift onto it, or Save re-disables.+ const editedInUrl: Query = {+ ...initialQueriesMap[DataSource.METRICS],+ id: 'edited-new-panel',+ builder: {+ ...initialQueriesMap[DataSource.METRICS].builder,+ queryData: [+ {+ ...initialQueriesMap[DataSource.METRICS].builder.queryData[0],+ legend: 'edited-legend',+ },+ ],+ },+ };+ const committed = toPerses(editedInUrl, panelType);++ const { result, rerender } = renderHook(+ ({ draftQueries }: { draftQueries: DashboardtypesQueryDTO[] }) =>+ usePanelEditorQuerySync({+ draft: makePanel(draftQueries),+ panelType,+ setSpec: jest.fn(),+ refetch: jest.fn(),+ alwaysSerializeQuery: true,+ signal: DataSource.METRICS as unknown as TelemetrytypesSignalDTO,+ // savedQueries omitted — new panel.+ }),+ {+ wrapper: makeUrlWrapper(editedInUrl),+ initialProps: { draftQueries: [] as DashboardtypesQueryDTO[] },+ },+ );++ // The edited query (from the URL) diverges from the seeded default → dirty.+ await waitFor(() => expect(result.current.isQueryDirty).toBe(true));++ // Stage & Run commits the edited query into the draft → must stay dirty.+ rerender({ draftQueries: committed });+ expect(result.current.isQueryDirty).toBe(true);+ });+it('an untouched panel with a minimal/older stored query is NOT dirty (drift fix)', async () => {// An older saved query carries only a few fields; the builder re-emits many more// (source, stepInterval, filter, spaceAggregation, …). Comparing raw would readdiff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/usePanelEditorQuerySync.ts b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/usePanelEditorQuerySync.tsindex 9acc40c5e6..8b40034279 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/usePanelEditorQuerySync.ts+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/hooks/usePanelEditorQuerySync.ts@@ -79,6 +79,11 @@ export function usePanelEditorQuerySync({// in-editor edit in the URL survives a refresh / browser Back-Forward.useShareBuilderUrl({ defaultValue: seedQuery });+ // Frozen seed for the new-panel dirty baseline: Stage & Run commits the live query+ // into `draft.spec.queries`, so re-reading `seedQuery` would drift the baseline onto+ // the run query and Save would re-disable right after a run.+ const initialSeedRef = useRef(seedQuery);+// Commit the live query into the draft (what the preview fetches).const commitQuery = useCallback((query: Query): boolean => {@@ -152,16 +157,19 @@ export function usePanelEditorQuerySync({// the V5 envelope level. Anchoring to `savedQueries` (not the builder-seed) keeps a// handed-off / URL-restored edit reading as dirty; routing both sides through the same// `fromPerses → toPerses` round-trip stops builder-added defaults (absent from an older- // stored query) reading an untouched panel as modified. New panel: fall back to seed.+ // stored query) reading an untouched panel as modified. New panel: fall back to the+ // frozen initial seed (see `initialSeedRef`).const baselineEnvelopes = useMemo(() =>toQueryEnvelopes(toPerses(- savedQueries ? fromPerses(savedQueries, panelType) : seedQuery,+ savedQueries+ ? fromPerses(savedQueries, panelType)+ : initialSeedRef.current,panelType,),),- [savedQueries, seedQuery, panelType],+ [savedQueries, panelType],);const isQueryDirty = useMemo(() =>diff --git a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsx b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsxindex ea866a002c..e3a993f1c7 100644--- a/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsx+++ b/frontend/src/pages/DashboardPageV2/DashboardContainer/PanelEditor/index.tsx@@ -19,6 +19,7 @@ import {SectionKind,} from 'pages/DashboardPageV2/DashboardContainer/Panels/types/sections';import { getBuilderQueries } from 'pages/DashboardPageV2/DashboardContainer/Panels/utils/getBuilderQueries';+import { useErrorModal } from 'providers/ErrorModalProvider';import { getExecStats } from '../queryV5/v5ResponseData';import { usePanelInteractions } from '../PanelsAndSectionsLayout/Panel/hooks/usePanelInteractions';@@ -159,9 +160,10 @@ function PanelEditorContainer({return section?.controls;}, [panelDefinition]);- // New panels are savable once seeded with a query (List auto-seeds one). Read the- // seed `panel`, not the live `draft` — the staged-query sync commits the seed into- // the draft on open, which would falsely dirty an untouched query-less new panel.+ // Unsaved-edits flag driving the discard confirmation on close (Save is always+ // enabled). Read the seed `panel`, not the live `draft` — the staged-query sync+ // commits the seed into the draft on open, which would falsely dirty an untouched+ // query-less new panel.const isDirty = useMemo(() => isSpecDirty || isQueryDirty || (isNew && panel.spec.queries.length > 0),[isSpecDirty, isQueryDirty, isNew, panel.spec.queries.length],@@ -226,6 +228,7 @@ function PanelEditorContainer({});const setScrollTargetId = useScrollIntoViewStore((s) => s.setScrollTargetId);+ const { showErrorModal } = useErrorModal();const onSave = useCallback(async (): Promise<void> => {if (!isEditable) {@@ -236,12 +239,22 @@ function PanelEditorContainer({const savedPanelId = await save(buildSaveSpec(draft.spec));// Reveal the saved panel once the dashboard re-renders.setScrollTargetId(savedPanelId);- toast.success('Panel saved');+ toast.success('Panel saved', {+ position: 'top-center',+ });onSaved();- } catch {- toast.error('Failed to save panel');+ } catch (err) {+ showErrorModal(err);}- }, [isEditable, save, buildSaveSpec, draft.spec, setScrollTargetId, onSaved]);+ }, [+ isEditable,+ save,+ buildSaveSpec,+ draft.spec,+ setScrollTargetId,+ onSaved,+ showErrorModal,+ ]);// Leaving an existing panel's editor (without saving) still returns to it, so// the dashboard lands on that panel rather than scrolled to the top. A new,diff --git a/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/DeleteActionItem.tsx b/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/DeleteActionItem.tsxindex c3d7632408..1c5d82f623 100644--- a/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/DeleteActionItem.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/ActionsPopover/DeleteActionItem.tsx@@ -12,13 +12,13 @@ import {deleteDashboardV2,invalidateListDashboardsForUserV2,} from 'api/generated/services/dashboard';+import { useDeleteConfirm } from 'components/DeleteConfirmModal/useDeleteConfirm';import { DashboardListEvents } from 'pages/DashboardsListPageV2/constants/events';import { useAppContext } from 'providers/App/App';import { useErrorModal } from 'providers/ErrorModalProvider';import APIError from 'types/api/error';import { USER_ROLES } from 'types/roles';-import { useDeleteConfirm } from '../DeleteConfirmModal/useDeleteConfirm';import styles from './ActionsPopover.module.scss';interface Props {diff --git a/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsx b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsxindex 05e704082a..75ba05cf0c 100644--- a/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsx+++ b/frontend/src/pages/DashboardsListPageV2/components/ViewsRail/ViewsRail.tsx@@ -6,11 +6,11 @@ import { Typography } from '@signozhq/ui/typography';import { Bookmark, PenLine, Plus, Search, Trash2 } from '@signozhq/icons';import cx from 'classnames';+import { useDeleteConfirm } from 'components/DeleteConfirmModal/useDeleteConfirm';import { DashboardListEvents } from 'pages/DashboardsListPageV2/constants/events';import type { SavedView } from '../../types';import { type BuiltinView } from '../../utils/views';-import { useDeleteConfirm } from '../DeleteConfirmModal/useDeleteConfirm';import ViewNamePopover from './ViewNamePopover';import styles from './ViewsRail.module.scss';