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(dashboards): gate the dashboards list on fine-grained authz (#12449)

Ashwin Bhatkal8ee9f97f28ee
diff --git a/frontend/docs/authz-guide.md b/frontend/docs/authz-guide.md
index 96a813dc8f..70a99b66e0 100644
--- a/frontend/docs/authz-guide.md
+++ b/frontend/docs/authz-guide.md
@@ -34,6 +34,9 @@ These hold for every page. The per-pattern sections below only add to them.
4. **Never gate per row.** If a user can `list`, render every row. Check `read` only when the row is opened (drawer or
detail route).
5. **Gate the narrowest thing that works**, a button over a section, a section over a page.
+ - **Gate a page on `read` alone.** It is the only verb the page's own request needs. `update` and `delete` gate
+ individual controls, so waiting for them holds up the whole page for nothing — pass them as `preloadChecks` and
+ they resolve in the same request, leaving the controls to read from cache.
6. **A resource may be gated while a sub-resource is not.** A user without `read` on Service Accounts can still hold
`create` on API Keys, so blocking the outer container would hide work they are allowed to do.
7. **Verbs not covered here** (`attach`, `detach`, `assignee`) behave like `delete`: gate the control that triggers
@@ -45,11 +48,20 @@ These hold for every page. The per-pattern sections below only add to them.
![Visual rules for structuring a list page](./assets/list-example.svg)
-Without `list`, but with any of `read` / `create` / `update`, only the table is blocked:
-
-- Title, description, search filters and action buttons stay visible.
-- Filters and any control that drives the table are non-interactive.
-- The create button stays enabled if the user holds `create`.
+Without `list`, but with any of `read` / `create` / `update`, the table and
+everything that only feeds it are blocked:
+
+- Title, description, search, filters and action buttons stay visible. Nothing is
+ hidden for lack of permission.
+- Disable what only shapes the blocked request — the search box, the filter chips,
+ a Clear button — and give it the same denial. It edits a query that has nowhere
+ to run, so leaving it live invites the user to compose a filter and watch
+ nothing happen.
+- Gate a region as one section when several of its controls are dead. A saved
+ views rail is a block with a single callout, not a column of identical
+ tooltips; a row of filters is one tooltip zone, not one per control.
+- The create button stays enabled if the user holds `create`. It is independent
+ of `list`.
### Edit page
@@ -96,6 +108,11 @@ Blocking is always a visible denial, never a silent removal. Use the components
[`lib/authz/components`](../src/lib/authz/components/README.md) rather than hand-rolling a check, they carry the
denial message and the loading state.
+**Denial copy comes from the components.** Never write a custom message for a permission check. `disabledTooltip` is
+for a block that is *not* a permission — a lock, an immutable resource, a mount that is deliberately read-only. It
+takes precedence over the checks, which are then skipped, so set it only when that block is the real obstacle: a
+missing permission must still surface its own wording.
+
| Scope | Component | Denied state |
| --------------- | ----------------------------------------- | ------------------------------------------- |
| Button | `AuthZButton` | Disabled + tooltip |
diff --git a/frontend/src/AppRoutes/__tests__/Private.test.tsx b/frontend/src/AppRoutes/__tests__/Private.test.tsx
index 4e3e945f6e..1dd7c1cfcb 100644
--- a/frontend/src/AppRoutes/__tests__/Private.test.tsx
+++ b/frontend/src/AppRoutes/__tests__/Private.test.tsx
@@ -1558,6 +1558,18 @@ describe('PrivateRoute', () => {
keyof typeof routeWithInitialAuthZSupport,
AuthzRouteCase
> = {
+ ALL_DASHBOARD: { path: ROUTES.ALL_DASHBOARD, deniedRoles: DENIED_ROLES },
+ DASHBOARD: {
+ path: ROUTES.DASHBOARD.replace(':dashboardId', 'dashboard-id-1'),
+ deniedRoles: DENIED_ROLES,
+ },
+ DASHBOARD_PANEL_EDITOR: {
+ path: ROUTES.DASHBOARD_PANEL_EDITOR.replace(
+ ':dashboardId',
+ 'dashboard-id-1',
+ ).replace(':panelId', 'panel-id-1'),
+ deniedRoles: DENIED_ROLES,
+ },
// Everything under /settings resolves to the non-exact SETTINGS route
SETTINGS: { path: ROUTES.SETTINGS, deniedRoles: DENIED_ROLES },
MY_SETTINGS: { path: ROUTES.MY_SETTINGS, deniedRoles: DENIED_ROLES },
diff --git a/frontend/src/pages/DashboardsListPage/DashboardsListPage.tsx b/frontend/src/pages/DashboardsListPage/DashboardsListPage.tsx
index d4f6349d04..c8ba85afcd 100644
--- a/frontend/src/pages/DashboardsListPage/DashboardsListPage.tsx
+++ b/frontend/src/pages/DashboardsListPage/DashboardsListPage.tsx
@@ -1,12 +1,17 @@
import { LayoutGrid } from '@signozhq/icons';
+import Spinner from 'components/Spinner';
import HeaderRightSection from 'components/HeaderRightSection/HeaderRightSection';
+import { useDashboardCollectionPermissions } from 'hooks/dashboards/useDashboardCollectionPermissions';
import DashboardsList from './components/DashboardsList/DashboardsList';
import styles from './DashboardsListPage.module.scss';
import { BreadcrumbLink } from '@signozhq/ui/breadcrumb';
function DashboardsListPage(): JSX.Element {
+ // Resolved before the list mounts, so no control renders enabled-then-disabled.
+ const { isLoading } = useDashboardCollectionPermissions();
+
return (
<div className={styles.page}>
<div className={styles.header}>
@@ -19,7 +24,7 @@ function DashboardsListPage(): JSX.Element {
enableFeedback
/>
</div>
- <DashboardsList />
+ {isLoading ? <Spinner tip="Loading dashboards..." /> : <DashboardsList />}
</div>
);
}
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsMenuItem.tsx b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsMenuItem.tsx
new file mode 100644
index 0000000000..9aa3123af9
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsMenuItem.tsx
@@ -0,0 +1,57 @@
+import type { MouseEvent, ReactElement, ReactNode } from 'react';
+import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
+import type { BrandedPermission } from 'lib/authz/hooks/useAuthZ/types';
+
+import styles from './ActionsPopover.module.scss';
+
+interface Props {
+ label: ReactNode;
+ icon: ReactElement;
+ testId: string;
+ onClick: (event: MouseEvent<HTMLButtonElement>) => void;
+ /** Permissions the row needs; the component words a refusal. */
+ checks: BrandedPermission[];
+ /** A non-permission block, which outranks the checks (see AuthZTooltip). */
+ disabledTooltip?: string;
+ loading?: boolean;
+ destructive?: boolean;
+}
+
+/**
+ * A row in the actions menu. The button fills the row, so the tooltip anchors to
+ * it and lands clear of the menu rather than over the row's icon.
+ */
+function ActionsMenuItem({
+ label,
+ icon,
+ testId,
+ onClick,
+ checks,
+ disabledTooltip,
+ loading = false,
+ destructive = false,
+}: Props): JSX.Element {
+ return (
+ <AuthZButton
+ checks={checks}
+ disabledTooltip={disabledTooltip}
+ side="left"
+ variant="ghost"
+ color={destructive ? 'destructive' : 'secondary'}
+ className={styles.menuItem}
+ prefix={icon}
+ disabled={loading}
+ loading={loading}
+ onClick={(e: MouseEvent<HTMLButtonElement>): void => {
+ e.preventDefault();
+ e.stopPropagation();
+ onClick(e);
+ }}
+ testId={testId}
+ >
+ {label}
+ </AuthZButton>
+ );
+}
+
+export default ActionsMenuItem;
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.authz.test.tsx b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.authz.test.tsx
new file mode 100644
index 0000000000..35b5d4da24
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.authz.test.tsx
@@ -0,0 +1,180 @@
+import { server } from 'mocks-server/server';
+import { rest } from 'msw';
+import { render, screen, userEvent, waitFor } from 'tests/test-utils';
+import {
+ AUTHZ_CHECK_URL,
+ setupAuthzAdmin,
+ setupAuthzAllow,
+ setupAuthzDeny,
+} from 'lib/authz/utils/authz-test-utils';
+import {
+ buildDashboardDeletePermission,
+ buildDashboardUpdatePermission,
+ DashboardCreatePermission,
+} from 'lib/authz/hooks/useAuthZ/permissions/dashboard.permissions';
+
+import ActionsPopover from './ActionsPopover';
+import { DashboardtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
+
+const DASHBOARD_ID = 'abc';
+
+const baseProps = {
+ link: '/dashboard/abc',
+ dashboardId: DASHBOARD_ID,
+ dashboardName: 'My Dashboard',
+ createdBy: '[email protected]',
+ source: DashboardtypesSourceDTO.user,
+ isLocked: false,
+ tags: [],
+ onView: jest.fn(),
+};
+
+async function openMenu(): Promise<void> {
+ await userEvent.click(screen.getByTestId('dashboard-action-icon'));
+ await screen.findByTestId('dashboard-action-rename');
+}
+
+// The authz component puts the denied scopes on the control it disables.
+function deniedScopes(testId: string): string | null {
+ return screen.getByTestId(testId).getAttribute('data-denied-permissions');
+}
+
+describe('ActionsPopover - AuthZ', () => {
+ afterEach(() => {
+ jest.restoreAllMocks();
+ server.resetHandlers();
+ });
+
+ describe('laziness', () => {
+ it('fires no permission check until the menu is opened', async () => {
+ const onCheck = jest.fn();
+ server.use(
+ rest.post(AUTHZ_CHECK_URL, async (req, res, ctx) => {
+ onCheck();
+ const payload = await req.json();
+ return res(
+ ctx.status(200),
+ ctx.json({ data: payload, status: 'success' }),
+ );
+ }),
+ );
+
+ render(<ActionsPopover {...baseProps} />);
+
+ await new Promise((resolve) => setTimeout(resolve, 100));
+ expect(onCheck).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('permission denied', () => {
+ it('disables the edit actions and explains why when update is denied', async () => {
+ server.use(setupAuthzDeny(buildDashboardUpdatePermission(DASHBOARD_ID)));
+
+ render(<ActionsPopover {...baseProps} />);
+ await openMenu();
+
+ await waitFor(() => {
+ expect(deniedScopes('dashboard-action-rename')).toContain(
+ buildDashboardUpdatePermission(DASHBOARD_ID),
+ );
+ });
+ expect(screen.getByTestId('dashboard-action-rename')).toBeDisabled();
+ expect(screen.getByTestId('dashboard-action-edit-tags')).toBeDisabled();
+
+ // Read-only actions and delete are unaffected.
+ expect(screen.getByTestId('dashboard-action-view')).toBeEnabled();
+ expect(screen.getByTestId('dashboard-action-delete')).toBeEnabled();
+ });
+
+ // Authz guide rule 3: delete does not depend on read.
+ it('keeps delete usable for a user holding only delete', async () => {
+ server.use(setupAuthzAllow(buildDashboardDeletePermission(DASHBOARD_ID)));
+
+ render(<ActionsPopover {...baseProps} />);
+ await openMenu();
+
+ await waitFor(() => {
+ expect(screen.getByTestId('dashboard-action-delete')).toBeEnabled();
+ });
+ expect(screen.getByTestId('dashboard-action-rename')).toBeDisabled();
+ expect(screen.getByTestId('dashboard-action-duplicate')).toBeDisabled();
+ });
+
+ it('disables delete and explains why when delete is denied', async () => {
+ server.use(setupAuthzDeny(buildDashboardDeletePermission(DASHBOARD_ID)));
+
+ render(<ActionsPopover {...baseProps} />);
+ await openMenu();
+
+ await waitFor(() => {
+ expect(deniedScopes('dashboard-action-delete')).toBe(
+ buildDashboardDeletePermission(DASHBOARD_ID),
+ );
+ });
+ expect(screen.getByTestId('dashboard-action-delete')).toBeDisabled();
+ expect(screen.getByTestId('dashboard-action-rename')).toBeEnabled();
+ });
+
+ it('disables duplicate without create, leaving rename usable', async () => {
+ server.use(setupAuthzDeny(DashboardCreatePermission));
+
+ render(<ActionsPopover {...baseProps} />);
+ await openMenu();
+
+ await waitFor(() => {
+ expect(screen.getByTestId('dashboard-action-rename')).toBeEnabled();
+ });
+ expect(screen.getByTestId('dashboard-action-duplicate')).toBeDisabled();
+ });
+ });
+
+ describe('lock', () => {});
+
+ describe('locked dashboard', () => {
+ // Access before state: without the permission, the lock is the wrong thing
+ // to point at.
+ it('reports the permission, not the lock, without edit rights', async () => {
+ server.use(setupAuthzDeny(buildDashboardUpdatePermission(DASHBOARD_ID)));
+
+ render(<ActionsPopover {...baseProps} isLocked />);
+ await openMenu();
+
+ await waitFor(() => {
+ expect(deniedScopes('dashboard-action-rename')).toContain(
+ buildDashboardUpdatePermission(DASHBOARD_ID),
+ );
+ });
+ expect(screen.getByTestId('dashboard-action-rename')).toBeDisabled();
+ });
+
+ it('reports the lock, not the permission, for an editor', async () => {
+ server.use(setupAuthzAdmin());
+
+ render(<ActionsPopover {...baseProps} isLocked />);
+ await openMenu();
+
+ // Duplicate is not lock-gated, so it resolving marks the checks as settled.
+ await waitFor(() => {
+ expect(screen.getByTestId('dashboard-action-duplicate')).toBeEnabled();
+ });
+ expect(screen.getByTestId('dashboard-action-rename')).toBeDisabled();
+ expect(deniedScopes('dashboard-action-rename')).toBeNull();
+ });
+ });
+
+ describe('permission granted', () => {
+ it('enables every action for an admin', async () => {
+ server.use(setupAuthzAdmin());
+
+ render(<ActionsPopover {...baseProps} />);
+ await openMenu();
+
+ await waitFor(() => {
+ expect(screen.getByTestId('dashboard-action-rename')).toBeEnabled();
+ });
+ expect(screen.getByTestId('dashboard-action-edit-tags')).toBeEnabled();
+ expect(screen.getByTestId('dashboard-action-duplicate')).toBeEnabled();
+ expect(screen.getByTestId('dashboard-action-delete')).toBeEnabled();
+ });
+ });
+});
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.module.scss b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.module.scss
index 21ab8d2644..4ecc378e50 100644
--- a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.module.scss
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.module.scss
@@ -43,6 +43,11 @@
pointer-events: none;
}
+/* With the button's pointer events off, the wrapper paints the cursor. */
+.menuItemWrap:has(button:disabled) {
+ cursor: not-allowed;
+}
+
.deleteName {
color: var(--danger-background);
font-weight: var(--font-weight-medium);
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.test.tsx b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.test.tsx
index 3edaa1f7c0..e2992eb613 100644
--- a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.test.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.test.tsx
@@ -1,12 +1,14 @@
import { render, screen, userEvent } from 'tests/test-utils';
import ActionsPopover from './ActionsPopover';
+import { DashboardtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
const baseProps = {
link: '/dashboard/abc',
dashboardId: 'abc',
dashboardName: 'My Dashboard',
createdBy: '[email protected]',
+ source: DashboardtypesSourceDTO.user,
isLocked: false,
tags: [],
canEdit: true,
@@ -14,6 +16,16 @@ const baseProps = {
};
describe('ActionsPopover', () => {
+ it('does not mount the menu body until the trigger is clicked', () => {
+ render(<ActionsPopover {...baseProps} />);
+
+ expect(screen.getByTestId('dashboard-action-icon')).toBeInTheDocument();
+ expect(screen.queryByTestId('dashboard-action-view')).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId('dashboard-action-delete'),
+ ).not.toBeInTheDocument();
+ });
+
it('shows the full set of actions for a v2 dashboard', async () => {
render(<ActionsPopover {...baseProps} />);
await userEvent.click(screen.getByTestId('dashboard-action-icon'));
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.tsx b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.tsx
index 743a477ce1..cba8c7c067 100644
--- a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopover.tsx
@@ -1,54 +1,21 @@
import { useState } from 'react';
-import { useMutation, useQueryClient } from 'react-query';
-import { generatePath } from 'react-router-dom';
-import { Popover, Tooltip } from 'antd';
+import { Popover } from 'antd';
import { Button } from '@signozhq/ui/button';
-import { toast } from '@signozhq/ui/sonner';
-import {
- Copy,
- Expand,
- EllipsisVertical,
- Link2,
- LockKeyhole,
- PenLine,
- SquareArrowOutUpRight,
- Tag,
-} from '@signozhq/icons';
-import { useCopyToClipboard } from 'react-use';
-import logEvent from 'api/common/logEvent';
-import {
- cloneDashboardV2,
- getGetDashboardV2QueryKey,
- invalidateListDashboardsForUserV2,
- lockDashboardV2,
- unlockDashboardV2,
-} from 'api/generated/services/dashboard';
-import type { GetDashboardV2200 } from 'api/generated/services/sigNoz.schemas';
-import ROUTES from 'constants/routes';
-import { useSafeNavigate } from 'hooks/useSafeNavigate';
-import { DashboardListEvents } from 'pages/DashboardsListPage/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 { getAbsoluteUrl } from 'utils/basePath';
-import { openInNewTab } from 'utils/navigation';
+import { EllipsisVertical } from '@signozhq/icons';
-import DeleteActionItem from './DeleteActionItem';
+import ActionsPopoverContent from './ActionsPopoverContent';
import EditTagsModal from './EditTagsModal';
import RenameDashboardModal from './RenameDashboardModal';
-import styles from './ActionsPopover.module.scss';
+import { DashboardtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
interface Props {
link: string;
dashboardId: string;
dashboardName: string;
- createdBy: string;
+ source: DashboardtypesSourceDTO;
isLocked: boolean;
// Current tags as `key:value` strings, for the inline tag editor.
tags: string[];
- // Edit permission (edit_dashboard). Read actions show regardless; edit actions are hidden without it.
- canEdit: boolean;
onView: (event: React.MouseEvent<HTMLElement>) => void;
// A legacy (pre-v2) dashboard has no v2 spec, so the actions that operate on
// one (view, open, copy link, rename, edit tags, duplicate, lock) don't apply —
@@ -60,233 +27,44 @@ function ActionsPopover({
link,
dashboardId,
dashboardName,
- createdBy,
+ source,
isLocked,
tags,
- canEdit,
onView,
isLegacy = false,
}: Props): JSX.Element {
- const [, setCopy] = useCopyToClipboard();
- const { safeNavigate } = useSafeNavigate();
- const { showErrorModal } = useErrorModal();
+ const [isOpen, setIsOpen] = useState(false);
const [isRenameOpen, setIsRenameOpen] = useState(false);
const [isEditTagsOpen, setIsEditTagsOpen] = useState(false);
- // Clone keeps the source's name/panels/tags as a new unlocked dashboard owned
- // by the caller; open the copy so it can be tweaked right away.
- const { mutate: runClone, isLoading: isCloning } = useMutation({
- mutationFn: () => cloneDashboardV2({ id: dashboardId }),
- onSuccess: (response) => {
- toast.success(`Duplicated "${dashboardName}"`);
- void logEvent(DashboardListEvents.RowAction, {
- action: 'duplicate',
- dashboardId,
- });
- safeNavigate(
- generatePath(ROUTES.DASHBOARD, { dashboardId: response.data.id }),
- );
- },
- onError: (error: APIError) => {
- showErrorModal(error);
- },
- });
-
- const queryClient = useQueryClient();
- const { user } = useAppContext();
- const isAuthor = user?.email === createdBy;
- // Author/admin can lock-unlock (mirrors the detail-page gate); integration-owned
- // dashboards are never toggleable.
- const canToggleLock =
- (isAuthor || user.role === USER_ROLES.ADMIN) && createdBy !== 'integration';
-
- const { mutate: runLockToggle, isLoading: isTogglingLock } = useMutation({
- mutationFn: () =>
- isLocked
- ? unlockDashboardV2({ id: dashboardId })
- : lockDashboardV2({ id: dashboardId }),
- onSuccess: async () => {
- toast.success(isLocked ? 'Dashboard unlocked' : 'Dashboard locked');
- void logEvent(DashboardListEvents.RowAction, {
- action: isLocked ? 'unlock' : 'lock',
- dashboardId,
- });
- // Patch the detail-page cache too: it uses staleTime:Infinity +
- // refetchOnMount:false, so without this, returning to the dashboard would
- // still show the stale (pre-toggle) lock state.
- const key = getGetDashboardV2QueryKey({ id: dashboardId });
- const cached = queryClient.getQueryData<GetDashboardV2200>(key);
- if (cached) {
- queryClient.setQueryData<GetDashboardV2200>(key, {
- ...cached,
- data: { ...cached.data, locked: !isLocked },
- });
- }
- await invalidateListDashboardsForUserV2(queryClient);
- },
- onError: (error: APIError) => {
- showErrorModal(error);
- },
- });
-
- const handleOpenInNewTab = (e: React.MouseEvent<HTMLElement>): void => {
- e.stopPropagation();
- e.preventDefault();
- openInNewTab(link);
- void logEvent(DashboardListEvents.RowAction, {
- action: 'openNewTab',
- dashboardId,
- });
- };
-
- const handleCopyLink = (e: React.MouseEvent<HTMLElement>): void => {
- e.stopPropagation();
- e.preventDefault();
- setCopy(getAbsoluteUrl(link));
- void logEvent(DashboardListEvents.RowAction, {
- action: 'copyLink',
- dashboardId,
- });
- };
-
return (
<>
<Popover
- content={
- // Stop clicks inside the menu (incl. disabled items) from bubbling to the
- // row's onClick, which would navigate to the dashboard.
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events -- wrapper only guards propagation, not an interactive control
- <div className={styles.content} onClick={(e): void => e.stopPropagation()}>
- {!isLegacy && (
- <>
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<Expand size={14} />}
- onClick={onView}
- testId="dashboard-action-view"
- >
- View
- </Button>
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<SquareArrowOutUpRight size={14} />}
- onClick={handleOpenInNewTab}
- testId="dashboard-action-open-new-tab"
- >
- Open in New Tab
- </Button>
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<Link2 size={14} />}
- onClick={handleCopyLink}
- testId="dashboard-action-copy-link"
- >
- Copy Link
- </Button>
- {canEdit && (
- <Tooltip
- placement="left"
- title={
- isLocked ? 'This dashboard is locked, so it cannot be renamed.' : ''
- }
- >
- <span className={styles.menuItemWrap}>
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<PenLine size={14} />}
- disabled={isLocked}
- onClick={(e): void => {
- e.stopPropagation();
- e.preventDefault();
- if (!isLocked) {
- setIsRenameOpen(true);
- }
- }}
- testId="dashboard-action-rename"
- >
- Rename
- </Button>
- </span>
- </Tooltip>
- )}
- {canEdit && (
- <Tooltip
- placement="left"
- title={
- isLocked
- ? 'This dashboard is locked, so its tags cannot be edited.'
- : ''
- }
- >
- <span className={styles.menuItemWrap}>
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<Tag size={14} />}
- disabled={isLocked}
- onClick={(e): void => {
- e.stopPropagation();
- e.preventDefault();
- if (!isLocked) {
- setIsEditTagsOpen(true);
- }
- }}
- testId="dashboard-action-edit-tags"
- >
- {tags.length > 0 ? 'Edit Tags' : 'Add Tags'}
- </Button>
- </span>
- </Tooltip>
- )}
- {canEdit && (
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<Copy size={14} />}
- loading={isCloning}
- onClick={(e): void => {
- e.stopPropagation();
- e.preventDefault();
- runClone();
- }}
- testId="dashboard-action-duplicate"
- >
- Duplicate
- </Button>
- )}
- {canToggleLock && (
- <Button
- color="secondary"
- className={styles.menuItem}
- prefix={<LockKeyhole size={14} />}
- loading={isTogglingLock}
- onClick={(e): void => {
- e.stopPropagation();
- e.preventDefault();
- runLockToggle();
- }}
- testId="dashboard-action-lock"
- >
- {isLocked ? 'Unlock Dashboard' : 'Lock Dashboard'}
- </Button>
- )}
- </>
- )}
- {canEdit && (
- <DeleteActionItem
- dashboardId={dashboardId}
- dashboardName={dashboardName}
- createdBy={createdBy}
- isLocked={isLocked}
- showDivider={!isLegacy}
- />
- )}
- </div>
- }
+ open={isOpen}
+ onOpenChange={setIsOpen}
+ // A render function, so only the open row pays for the menu's mutations
+ // and checks; destroyTooltipOnHide releases them on close.
+ content={(): JSX.Element => (
+ <ActionsPopoverContent
+ link={link}
+ dashboardId={dashboardId}
+ dashboardName={dashboardName}
+ source={source}
+ isLocked={isLocked}
+ tags={tags}
+ isLegacy={isLegacy}
+ onView={onView}
+ onOpenRename={(): void => {
+ setIsOpen(false);
+ setIsRenameOpen(true);
+ }}
+ onOpenEditTags={(): void => {
+ setIsOpen(false);
+ setIsEditTagsOpen(true);
+ }}
+ />
+ )}
+ destroyTooltipOnHide
placement="bottomRight"
arrow={false}
rootClassName="dashboardActionsPopover"
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopoverContent.tsx b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopoverContent.tsx
new file mode 100644
index 0000000000..51a63f60cf
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/ActionsPopoverContent.tsx
@@ -0,0 +1,172 @@
+import { useMemo } from 'react';
+import {
+ Copy,
+ Expand,
+ Link2,
+ LockKeyhole,
+ PenLine,
+ SquareArrowOutUpRight,
+ Tag,
+} from '@signozhq/icons';
+import { useCopyToClipboard } from 'react-use';
+import logEvent from 'api/common/logEvent';
+import { useDashboardLockPermission } from 'hooks/dashboards/useDashboardLockPermission';
+import { useDashboardPermissions } from 'hooks/dashboards/useDashboardPermissions';
+import { DashboardCreatePermission } from 'lib/authz/hooks/useAuthZ/permissions/dashboard.permissions';
+import type { BrandedPermission } from 'lib/authz/hooks/useAuthZ/types';
+import { DashboardListEvents } from 'pages/DashboardsListPage/constants/events';
+import { getAbsoluteUrl } from 'utils/basePath';
+import { openInNewTab } from 'utils/navigation';
+
+import ActionsMenuItem from './ActionsMenuItem';
+import DeleteActionItem from './DeleteActionItem';
+import { useCloneDashboardAction } from './useCloneDashboardAction';
+import { useLockToggleAction } from './useLockToggleAction';
+import styles from './ActionsPopover.module.scss';
+import { useTranslation } from 'react-i18next';
+import { DashboardtypesSourceDTO } from 'api/generated/services/sigNoz.schemas';
+
+interface Props {
+ link: string;
+ dashboardId: string;
+ dashboardName: string;
+ source: DashboardtypesSourceDTO;
+ isLocked: boolean;
+ tags: string[];
+ isLegacy: boolean;
+ onView: (event: React.MouseEvent<HTMLElement>) => void;
+ onOpenRename: () => void;
+ onOpenEditTags: () => void;
+}
+
+// Mounted only while the popover is open, so a page of rows doesn't pay for 20
+// copies of the menu, its mutations or its permission checks.
+// These rows need no permission; the component still owns the styling.
+const NO_CHECKS: BrandedPermission[] = [];
+
+function ActionsPopoverContent({
+ link,
+ dashboardId,
+ dashboardName,
+ source,
+ isLocked,
+ tags,
+ isLegacy,
+ onView,
+ onOpenRename,
+ onOpenEditTags,
+}: Props): JSX.Element {
+ const { t } = useTranslation('dashboard');
+ const [, setCopy] = useCopyToClipboard();
+
+ const { canEdit, editChecks, readPermission } =
+ useDashboardPermissions(dashboardId);
+ // A non-empty reason already means "cannot toggle".
+ const { disabledTooltip: lockDisabledTooltip } = useDashboardLockPermission({
+ dashboardId,
+ source,
+ });
+
+ const { clone, isCloning } = useCloneDashboardAction({
+ dashboardId,
+ dashboardName,
+ });
+ const { toggleLock, isTogglingLock } = useLockToggleAction({
+ dashboardId,
+ isLocked,
+ });
+
+ // The lock only: a missing `update` outranks it and is reported by the component.
+ const editLockTooltip = canEdit && isLocked ? t('dashboard_locked') : '';
+ // Cloning reads this dashboard and creates another, so both are named.
+ const cloneChecks = useMemo(
+ () => [readPermission, DashboardCreatePermission],
+ [readPermission],
+ );
+
+ return (
+ // Stop clicks inside the menu (incl. disabled items) from bubbling to the
+ // row's onClick, which would navigate to the dashboard.
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events -- wrapper only guards propagation, not an interactive control
+ <div className={styles.content} onClick={(e): void => e.stopPropagation()}>
+ {!isLegacy && (
+ <>
+ <ActionsMenuItem
+ label="View"
+ icon={<Expand size={14} />}
+ testId="dashboard-action-view"
+ checks={NO_CHECKS}
+ onClick={onView}
+ />
+ <ActionsMenuItem
+ label="Open in New Tab"
+ icon={<SquareArrowOutUpRight size={14} />}
+ testId="dashboard-action-open-new-tab"
+ checks={NO_CHECKS}
+ onClick={(): void => {
+ openInNewTab(link);
+ void logEvent(DashboardListEvents.RowAction, {
+ action: 'openNewTab',
+ dashboardId,
+ });
+ }}
+ />
+ <ActionsMenuItem
+ label="Copy Link"
+ icon={<Link2 size={14} />}
+ testId="dashboard-action-copy-link"
+ checks={NO_CHECKS}
+ onClick={(): void => {
+ setCopy(getAbsoluteUrl(link));
+ void logEvent(DashboardListEvents.RowAction, {
+ action: 'copyLink',
+ dashboardId,
+ });
+ }}
+ />
+ <ActionsMenuItem
+ label="Rename"
+ icon={<PenLine size={14} />}
+ testId="dashboard-action-rename"
+ checks={editChecks}
+ disabledTooltip={editLockTooltip}
+ onClick={onOpenRename}
+ />
+ <ActionsMenuItem
+ label={tags.length > 0 ? 'Edit Tags' : 'Add Tags'}
+ icon={<Tag size={14} />}
+ testId="dashboard-action-edit-tags"
+ checks={editChecks}
+ disabledTooltip={editLockTooltip}
+ onClick={onOpenEditTags}
+ />
+ <ActionsMenuItem
+ label="Duplicate"
+ icon={<Copy size={14} />}
+ testId="dashboard-action-duplicate"
+ checks={cloneChecks}
+ loading={isCloning}
+ onClick={clone}
+ />
+ <ActionsMenuItem
+ label={isLocked ? 'Unlock Dashboard' : 'Lock Dashboard'}
+ icon={<LockKeyhole size={14} />}
+ testId="dashboard-action-lock"
+ checks={editChecks}
+ disabledTooltip={lockDisabledTooltip}
+ loading={isTogglingLock}
+ onClick={toggleLock}
+ />
+ </>
+ )}
+ <DeleteActionItem
+ dashboardId={dashboardId}
+ dashboardName={dashboardName}
+ isLocked={isLocked}
+ showDivider={!isLegacy}
+ />
+ </div>
+ );
+}
+
+export default ActionsPopoverContent;
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/DeleteActionItem.tsx b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/DeleteActionItem.tsx
index 78893019ab..178e80841e 100644
--- a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/DeleteActionItem.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/DeleteActionItem.tsx
@@ -1,9 +1,9 @@
-import { useCallback } from 'react';
+import { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useMutation, useQueryClient } from 'react-query';
-import { Tooltip } from 'antd';
-import { Button } from '@signozhq/ui/button';
import { Trash2 } from '@signozhq/icons';
+
+import ActionsMenuItem from './ActionsMenuItem';
import { toast } from '@signozhq/ui/sonner';
import { Divider } from '@signozhq/ui/divider';
import { Typography } from '@signozhq/ui/typography';
@@ -13,18 +13,16 @@ import {
invalidateListDashboardsForUserV2,
} from 'api/generated/services/dashboard';
import { useDeleteConfirm } from 'components/DeleteConfirmModal/useDeleteConfirm';
+import { useDashboardPermissions } from 'hooks/dashboards/useDashboardPermissions';
import { DashboardListEvents } from 'pages/DashboardsListPage/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 styles from './ActionsPopover.module.scss';
interface Props {
dashboardId: string;
dashboardName: string;
- createdBy: string;
isLocked: boolean;
// Delete sits below the other actions, so it leads with a divider. When it's
// the only item (a legacy dashboard), the divider is suppressed.
@@ -34,18 +32,17 @@ interface Props {
function DeleteActionItem({
dashboardId,
dashboardName,
- createdBy,
isLocked,
showDivider = true,
}: Props): JSX.Element {
const { t } = useTranslation(['dashboard']);
- const { user } = useAppContext();
const { showErrorModal } = useErrorModal();
const queryClient = useQueryClient();
const { contextHolder, confirmDelete } = useDeleteConfirm();
- const isAuthor = user?.email === createdBy;
- const isDisabled = isLocked || (user.role === USER_ROLES.VIEWER && !isAuthor);
+ // Guide rule 3: independent of read/update, so `delete` alone is enough.
+ const { canDelete, deletePermission } = useDashboardPermissions(dashboardId);
+ const deleteChecks = useMemo(() => [deletePermission], [deletePermission]);
const { mutate: runDelete } = useMutation({
mutationFn: () => deleteDashboardV2({ id: dashboardId }),
@@ -82,40 +79,25 @@ function DeleteActionItem({
});
}, [confirmDelete, dashboardName, runDelete]);
- const tooltip = ((): string => {
- if (!isLocked) {
- return '';
- }
- if (user.role === USER_ROLES.ADMIN || isAuthor) {
- return t('dashboard:locked_dashboard_delete_tooltip_admin_author');
- }
- return t('dashboard:locked_dashboard_delete_tooltip_editor');
- })();
+ // Access before state: the lock only matters to someone who could delete.
+ // The lock only; a missing `delete` is reported by the component.
+ const lockTooltip =
+ canDelete && isLocked
+ ? t('dashboard:locked_dashboard_delete_tooltip_admin_author')
+ : '';
return (
<>
{showDivider && <Divider />}
- <Tooltip placement="left" title={tooltip}>
- <span className={styles.menuItemWrap}>
- <Button
- variant="ghost"
- color="destructive"
- className={styles.menuItem}
- prefix={<Trash2 size={14} />}
- disabled={isDisabled}
- onClick={(e): void => {
- e.preventDefault();
- e.stopPropagation();
- if (!isDisabled) {
- openConfirm();
- }
- }}
- testId="dashboard-action-delete"
- >
- Delete Dashboard
- </Button>
- </span>
- </Tooltip>
+ <ActionsMenuItem
+ label="Delete Dashboard"
+ icon={<Trash2 size={14} />}
+ testId="dashboard-action-delete"
+ destructive
+ checks={deleteChecks}
+ disabledTooltip={lockTooltip}
+ onClick={openConfirm}
+ />
{contextHolder}
</>
);
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/useCloneDashboardAction.ts b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/useCloneDashboardAction.ts
new file mode 100644
index 0000000000..fa19c9b1e1
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/useCloneDashboardAction.ts
@@ -0,0 +1,44 @@
+import { useMutation } from 'react-query';
+import { generatePath } from 'react-router-dom';
+import { toast } from '@signozhq/ui/sonner';
+import logEvent from 'api/common/logEvent';
+import { cloneDashboardV2 } from 'api/generated/services/dashboard';
+import ROUTES from 'constants/routes';
+import { useSafeNavigate } from 'hooks/useSafeNavigate';
+import { DashboardListEvents } from 'pages/DashboardsListPage/constants/events';
+import { useErrorModal } from 'providers/ErrorModalProvider';
+import APIError from 'types/api/error';
+
+/**
+ * Clone keeps the source's name/panels/tags as a new unlocked dashboard owned by
+ * the caller; open the copy so it can be tweaked right away.
+ */
+export function useCloneDashboardAction({
+ dashboardId,
+ dashboardName,
+}: {
+ dashboardId: string;
+ dashboardName: string;
+}): { clone: () => void; isCloning: boolean } {
+ const { safeNavigate } = useSafeNavigate();
+ const { showErrorModal } = useErrorModal();
+
+ const { mutate, isLoading } = useMutation({
+ mutationFn: () => cloneDashboardV2({ id: dashboardId }),
+ onSuccess: (response) => {
+ toast.success(`Duplicated "${dashboardName}"`);
+ void logEvent(DashboardListEvents.RowAction, {
+ action: 'duplicate',
+ dashboardId,
+ });
+ safeNavigate(
+ generatePath(ROUTES.DASHBOARD, { dashboardId: response.data.id }),
+ );
+ },
+ onError: (error: APIError) => {
+ showErrorModal(error);
+ },
+ });
+
+ return { clone: mutate, isCloning: isLoading };
+}
diff --git a/frontend/src/pages/DashboardsListPage/components/ActionsPopover/useLockToggleAction.ts b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/useLockToggleAction.ts
new file mode 100644
index 0000000000..3bb16352bd
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/ActionsPopover/useLockToggleAction.ts
@@ -0,0 +1,37 @@
+import { useQueryClient } from 'react-query';
+import logEvent from 'api/common/logEvent';
+import { invalidateListDashboardsForUserV2 } from 'api/generated/services/dashboard';
+import {
+ type ToggleDashboardLock,
+ useToggleDashboardLock,
+} from 'hooks/dashboards/useToggleDashboardLock';
+import { DashboardListEvents } from 'pages/DashboardsListPage/constants/events';
+import { useErrorModal } from 'providers/ErrorModalProvider';
+
+/**
+ * The row menu's lock toggle. The call, toast and cache patch are shared with the
+ * toolbar; the list adds refreshing the rows and logging a row action.
+ */
+export function useLockToggleAction({
+ dashboardId,
+ isLocked,
+}: {
+ dashboardId: string;
+ isLocked: boolean;
+}): ToggleDashboardLock {
+ const queryClient = useQueryClient();
+ const { showErrorModal } = useErrorModal();
+
+ return useToggleDashboardLock({
+ dashboardId,
+ isLocked,
+ onSuccess: (locked) => {
+ void logEvent(DashboardListEvents.RowAction, {
+ action: locked ? 'lock' : 'unlock',
+ dashboardId,
+ });
+ void invalidateListDashboardsForUserV2(queryClient);
+ },
+ onError: showErrorModal,
+ });
+}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.test.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.test.tsx
index 0d0cc3c10a..f59cfb641d 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.test.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.test.tsx
@@ -52,12 +52,11 @@ const makeDashboard = (
...overrides,
}) as unknown as DashboardListItem;
-const renderRow = (dashboard: DashboardListItem, canEdit = true): void => {
+const renderRow = (dashboard: DashboardListItem): void => {
render(
<DashboardRow
dashboard={dashboard}
index={0}
- canEdit={canEdit}
showUpdatedAt={false}
showUpdatedBy={false}
/>,
@@ -109,15 +108,5 @@ describe('DashboardRow', () => {
screen.getByTestId('legacy-dashboard-retry-migration'),
).toBeInTheDocument();
});
-
- it('withholds the retry action from a row the user cannot edit', async () => {
- renderRow(makeDashboard({ legacy: true }), false);
-
- await userEvent.click(screen.getByTestId('dashboard-title-0'));
-
- expect(
- screen.queryByTestId('legacy-dashboard-retry-migration'),
- ).not.toBeInTheDocument();
- });
});
});
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.tsx
index 85894022a1..d2f41dc94e 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardRow/DashboardRow.tsx
@@ -28,7 +28,6 @@ import styles from './DashboardRow.module.scss';
interface Props {
dashboard: DashboardListItem;
index: number;
- canEdit: boolean;
showUpdatedAt: boolean;
showUpdatedBy: boolean;
}
@@ -36,7 +35,6 @@ interface Props {
function DashboardRow({
dashboard,
index,
- canEdit,
showUpdatedAt,
showUpdatedBy,
}: Props): JSX.Element {
@@ -200,10 +198,9 @@ function DashboardRow({
link={link}
dashboardId={id}
dashboardName={name}
- createdBy={createdBy}
+ source={dashboard.source}
isLocked={isLocked}
tags={tags}
- canEdit={canEdit}
onView={onClickHandler}
isLegacy={isLegacy}
/>
@@ -252,7 +249,6 @@ function DashboardRow({
open={isLegacyDialogOpen}
dashboardId={id}
dashboardName={name}
- canEdit={canEdit}
onClose={(): void => setIsLegacyDialogOpen(false)}
/>
)}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/CommandHeader.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/CommandHeader.tsx
index ed5152a41b..3ee2bac7ad 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardsList/CommandHeader.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/CommandHeader.tsx
@@ -8,7 +8,6 @@ interface Props {
label: string;
count: number;
isModified: boolean;
- canCreate: boolean;
onCreate: () => void;
}
@@ -16,7 +15,6 @@ function CommandHeader({
label,
count,
isModified,
- canCreate,
onCreate,
}: Props): JSX.Element {
return (
@@ -27,7 +25,7 @@ function CommandHeader({
<span className={styles.countPill}>{count}</span>
</div>
<div className={styles.grow} />
- {canCreate && <NewDashboardButton onClick={onCreate} />}
+ <NewDashboardButton onClick={onCreate} />
</div>
);
}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsList.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsList.tsx
index 1febb4e90a..26339b031d 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsList.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsList.tsx
@@ -5,8 +5,10 @@ import {
DashboardtypesListOrderDTO,
DashboardtypesListSortDTO,
} from 'api/generated/services/sigNoz.schemas';
-import useComponentPermission from 'hooks/useComponentPermission';
+import { useDashboardCollectionPermissions } from 'hooks/dashboards/useDashboardCollectionPermissions';
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
+import { AuthZGuardContent } from 'lib/authz/components/AuthZGuard/AuthZGuardContent';
+import { LIST_CHECKS } from 'pages/DashboardsListPage/constants/permissions';
import { DashboardListEvents } from 'pages/DashboardsListPage/constants/events';
import { useAppContext } from 'providers/App/App';
import { toAPIError } from 'utils/errorUtils';
@@ -48,11 +50,8 @@ function DashboardsList(): JSX.Element {
const { isCloudUser } = useGetTenantLicense();
const { user } = useAppContext();
- const [editDashboard, canCreateNewDashboard] = useComponentPermission(
- ['edit_dashboard', 'create_new_dashboards'],
- user.role,
- );
- const canEdit = !!editDashboard;
+ // `list` also authorizes pinning and saved views, so it gates the table only.
+ const { canList } = useDashboardCollectionPermissions();
const { query, isEmpty: filtersEmpty, setQuery } = useDashboardFilters();
const [sortColumn, setSortColumn] = useSortColumn();
@@ -81,6 +80,7 @@ function DashboardsList(): JSX.Element {
sortOrder,
setSortColumn,
setSortOrder,
+ canListDashboards: canList,
});
const railCollapsed = useDashboardViewsStore((s) => s.railCollapsed);
@@ -144,7 +144,7 @@ function DashboardsList(): JSX.Element {
error,
refetch,
} = useListDashboardsForUserV2(listParams, {
- query: { keepPreviousData: true },
+ query: { keepPreviousData: true, enabled: canList },
});
const apiError = useMemo(
@@ -271,6 +271,7 @@ function DashboardsList(): JSX.Element {
// The workspace-empty CTA ("create your first dashboard") belongs only to the
// unfiltered All view; every other view's zero result is a no-results state.
const showWorkspaceEmpty =
+ canList &&
!error &&
dashboards.length === 0 &&
activeViewId === BuiltinViewId.All &&
@@ -295,15 +296,11 @@ function DashboardsList(): JSX.Element {
onReset={handleResetView}
onDelete={handleRemoveView}
onRename={renameView}
- canEdit={canEdit}
/>
<div className={styles.main}>
<div className={styles.mainScroll}>
{isWorkspaceEmpty ? (
- <WorkspaceEmptyState
- canCreate={canCreateNewDashboard}
- onCreate={openCreate}
- />
+ <WorkspaceEmptyState onCreate={openCreate} />
) : (
<>
<div className={styles.headerZone}>
@@ -311,43 +308,48 @@ function DashboardsList(): JSX.Element {
label={activeLabel}
count={total}
isModified={isModified}
- canCreate={canCreateNewDashboard}
onCreate={openCreate}
/>
<FilterZone
query={query}
creatorOptions={creatorOptions}
source={source}
+ disabled={!canList}
onQueryChange={handleQueryChange}
/>
</div>
<div className={styles.viewContent}>
- <DashboardsResults
- isLoading={isLoading}
- hasError={!!error}
- isCloudUser={!!isCloudUser}
- onRetry={(): void => {
- refetch();
- }}
- errorHttpStatus={errorHttpStatus}
- errorMessage={errorMessage}
- dashboards={dashboards}
- activeViewId={activeViewId}
- searchValue={query}
- hasFilters={!filtersEmpty}
- sortColumn={sortColumn}
- onSortChange={onSortChange}
- sortOrder={sortOrder}
- onOrderChange={onOrderChange}
- page={page}
- pageSize={clientView ? CLIENT_VIEW_LIMIT : PAGE_SIZE}
- total={total}
- onPageChange={setPage}
- canEdit={canEdit}
- showUpdatedAt={visibleColumns.updatedAt}
- showUpdatedBy={visibleColumns.updatedBy}
- loading={isFetching}
- />
+ {/* Fails closed, unlike the guard's default: the fetch is
+ already gated on the same check, so falling open would
+ render the table shell with nothing in it and no reason
+ given. */}
+ <AuthZGuardContent checks={LIST_CHECKS} onFailRenderContent={false}>
+ <DashboardsResults
+ isLoading={isLoading}
+ hasError={!!error}
+ isCloudUser={!!isCloudUser}
+ onRetry={(): void => {
+ refetch();
+ }}
+ errorHttpStatus={errorHttpStatus}
+ errorMessage={errorMessage}
+ dashboards={dashboards}
+ activeViewId={activeViewId}
+ searchValue={query}
+ hasFilters={!filtersEmpty}
+ sortColumn={sortColumn}
+ onSortChange={onSortChange}
+ sortOrder={sortOrder}
+ onOrderChange={onOrderChange}
+ page={page}
+ pageSize={clientView ? CLIENT_VIEW_LIMIT : PAGE_SIZE}
+ total={total}
+ onPageChange={setPage}
+ showUpdatedAt={visibleColumns.updatedAt}
+ showUpdatedBy={visibleColumns.updatedBy}
+ loading={isFetching}
+ />
+ </AuthZGuardContent>
</div>
</>
)}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsListContent.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsListContent.tsx
index be387fdb09..22f14bac7c 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsListContent.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsListContent.tsx
@@ -14,7 +14,6 @@ interface Props {
pageSize: number;
total: number;
onPageChange: (page: number) => void;
- canEdit: boolean;
showUpdatedAt: boolean;
showUpdatedBy: boolean;
loading: boolean;
@@ -26,7 +25,6 @@ function DashboardsListContent({
pageSize,
total,
onPageChange,
- canEdit,
showUpdatedAt,
showUpdatedBy,
loading,
@@ -40,14 +38,13 @@ function DashboardsListContent({
<DashboardRow
dashboard={dashboard}
index={index}
- canEdit={canEdit}
showUpdatedAt={showUpdatedAt}
showUpdatedBy={showUpdatedBy}
/>
),
},
],
- [canEdit, showUpdatedAt, showUpdatedBy],
+ [showUpdatedAt, showUpdatedBy],
);
const paginationConfig = total > pageSize && {
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsResults.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsResults.tsx
index e23a1a3461..2ec6da3d38 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsResults.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/DashboardsResults.tsx
@@ -30,7 +30,6 @@ interface Props {
pageSize: number;
total: number;
onPageChange: (page: number) => void;
- canEdit: boolean;
showUpdatedAt: boolean;
showUpdatedBy: boolean;
loading: boolean;
@@ -55,7 +54,6 @@ function DashboardsResults({
pageSize,
total,
onPageChange,
- canEdit,
showUpdatedAt,
showUpdatedBy,
loading,
@@ -91,7 +89,6 @@ function DashboardsResults({
pageSize={pageSize}
total={total}
onPageChange={onPageChange}
- canEdit={canEdit}
showUpdatedAt={showUpdatedAt}
showUpdatedBy={showUpdatedBy}
loading={loading}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/NewDashboardButton.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/NewDashboardButton.tsx
index f2e45d6b8b..69d566c554 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardsList/NewDashboardButton.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/NewDashboardButton.tsx
@@ -1,5 +1,8 @@
-import { Button } from '@signozhq/ui/button';
import { Plus } from '@signozhq/icons';
+import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
+import { DashboardCreatePermission } from 'lib/authz/hooks/useAuthZ/permissions/dashboard.permissions';
+
+const CHECKS = [DashboardCreatePermission];
interface Props {
onClick: () => void;
@@ -7,7 +10,8 @@ interface Props {
function NewDashboardButton({ onClick }: Props): JSX.Element {
return (
- <Button
+ <AuthZButton
+ checks={CHECKS}
variant="solid"
color="primary"
prefix={<Plus size={14} />}
@@ -15,7 +19,7 @@ function NewDashboardButton({ onClick }: Props): JSX.Element {
testId="new-dashboard-cta"
>
New dashboard
- </Button>
+ </AuthZButton>
);
}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/WorkspaceEmptyState.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/WorkspaceEmptyState.tsx
index 30c4845784..0da06d8a29 100644
--- a/frontend/src/pages/DashboardsListPage/components/DashboardsList/WorkspaceEmptyState.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/WorkspaceEmptyState.tsx
@@ -4,18 +4,13 @@ import NewDashboardButton from './NewDashboardButton';
import styles from './DashboardsList.module.scss';
interface Props {
- canCreate: boolean;
onCreate: () => void;
}
-function WorkspaceEmptyState({ canCreate, onCreate }: Props): JSX.Element {
+function WorkspaceEmptyState({ onCreate }: Props): JSX.Element {
return (
<div className={styles.emptyWrap}>
- <EmptyState
- createDropdown={
- canCreate ? <NewDashboardButton onClick={onCreate} /> : null
- }
- />
+ <EmptyState createDropdown={<NewDashboardButton onClick={onCreate} />} />
</div>
);
}
diff --git a/frontend/src/pages/DashboardsListPage/components/DashboardsList/__tests__/DashboardsList.authz.test.tsx b/frontend/src/pages/DashboardsListPage/components/DashboardsList/__tests__/DashboardsList.authz.test.tsx
new file mode 100644
index 0000000000..7d862fa8ab
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/DashboardsList/__tests__/DashboardsList.authz.test.tsx
@@ -0,0 +1,264 @@
+import { server } from 'mocks-server/server';
+import userEvent from '@testing-library/user-event';
+import { rest } from 'msw';
+import { NuqsTestingAdapter } from 'nuqs/adapters/testing';
+import { render, screen, waitFor, within } from 'tests/test-utils';
+import {
+ AUTHZ_CHECK_URL,
+ setupAuthzAdmin,
+ setupAuthzAllow,
+ setupAuthzDeny,
+} from 'lib/authz/utils/authz-test-utils';
+import {
+ DashboardCreatePermission,
+ DashboardListPermission,
+} from 'lib/authz/hooks/useAuthZ/permissions/dashboard.permissions';
+
+import DashboardsList from '../DashboardsList';
+
+const LIST_URL = 'http://localhost/api/v2/users/me/dashboards';
+const VIEWS_URL = 'http://localhost/api/v2/dashboard_views';
+
+function renderList(): ReturnType<typeof render> {
+ return render(
+ <NuqsTestingAdapter searchParams={{}} hasMemory>
+ <DashboardsList />
+ </NuqsTestingAdapter>,
+ );
+}
+
+describe('DashboardsList - AuthZ', () => {
+ beforeEach(() => {
+ server.use(
+ rest.get(VIEWS_URL, (_req, res, ctx) =>
+ res(ctx.status(200), ctx.json({ status: 'success', data: [] })),
+ ),
+ );
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ server.resetHandlers();
+ });
+
+ describe('create permission', () => {
+ it('renders the create CTA disabled instead of hiding it when create is denied', async () => {
+ server.use(
+ setupAuthzDeny(DashboardCreatePermission),
+ rest.get(LIST_URL, (_req, res, ctx) =>
+ res(
+ ctx.status(200),
+ ctx.json({
+ status: 'success',
+ data: { dashboards: [], total: 0, tags: [] },
+ }),
+ ),
+ ),
+ );
+
+ renderList();
+
+ await waitFor(() => {
+ expect(screen.getByTestId('new-dashboard-cta')).toHaveAttribute(
+ 'data-denied-permissions',
+ DashboardCreatePermission,
+ );
+ });
+ expect(screen.getByTestId('new-dashboard-cta')).toBeDisabled();
+ });
+
+ it('enables the create CTA when create is granted', async () => {
+ server.use(
+ setupAuthzAdmin(),
+ rest.get(LIST_URL, (_req, res, ctx) =>
+ res(
+ ctx.status(200),
+ ctx.json({
+ status: 'success',
+ data: { dashboards: [], total: 0, tags: [] },
+ }),
+ ),
+ ),
+ );
+
+ renderList();
+
+ const cta = await screen.findByTestId('new-dashboard-cta');
+ await waitFor(() => expect(cta).not.toBeDisabled());
+ });
+ });
+
+ describe('list permission', () => {
+ it('blocks the table and never fires the list request when list is denied', async () => {
+ const onList = jest.fn();
+ server.use(
+ // Create is still granted — the CTA must stay usable (authz guide list pattern).
+ setupAuthzAllow(DashboardCreatePermission),
+ rest.get(LIST_URL, (_req, res, ctx) => {
+ onList();
+ return res(
+ ctx.status(200),
+ ctx.json({
+ status: 'success',
+ data: { dashboards: [], total: 0, tags: [] },
+ }),
+ );
+ }),
+ );
+
+ renderList();
+
+ await waitFor(() => {
+ expect(
+ screen.getAllByText(/is not authorized to perform/).length,
+ ).toBeGreaterThan(0);
+ });
+ expect(screen.getAllByText('list:dashboard:*').length).toBeGreaterThan(0);
+ expect(onList).not.toHaveBeenCalled();
+
+ const cta = screen.getByTestId('new-dashboard-cta');
+ expect(cta).not.toBeDisabled();
+
+ // The box and filters edit a query only the list API can run, so they are
+ // inert and say why; the rail carries its own denial.
+ expect(
+ within(screen.getByTestId('dashboards-filter-created-by')).getByRole(
+ 'combobox',
+ ),
+ ).toBeDisabled();
+ expect(screen.getByLabelText('Run search')).toBeDisabled();
+ expect(
+ screen.getByTestId('dashboards-list-search').querySelector('.cm-content'),
+ ).toHaveAttribute('contenteditable', 'false');
+ expect(screen.getByTestId('views-rail-denied')).toBeInTheDocument();
+
+ expect(screen.getByTestId('dashboards-search-zone')).toHaveAttribute(
+ 'data-denied-permissions',
+ DashboardListPermission,
+ );
+ expect(screen.getByTestId('dashboards-filter-zone')).toHaveAttribute(
+ 'data-denied-permissions',
+ DashboardListPermission,
+ );
+
+ // Radix's content has no testid, and the table's callout carries the same
+ // words, so the reason is read off the tooltip role.
+ await userEvent.hover(screen.getByTestId('dashboards-search-zone'));
+ await expect(screen.findByRole('tooltip')).resolves.toHaveTextContent(
+ 'is not authorized to perform list:dashboard:*',
+ );
+ });
+
+ it('renders the table when list is granted', async () => {
+ server.use(
+ setupAuthzAdmin(),
+ rest.get(LIST_URL, (_req, res, ctx) =>
+ res(
+ ctx.status(200),
+ ctx.json({
+ status: 'success',
+ data: {
+ dashboards: [
+ {
+ id: 'dash-1',
+ createdBy: '[email protected]',
+ tags: [],
+ spec: { display: { name: 'Checkout latency' } },
+ },
+ ],
+ total: 1,
+ tags: [],
+ },
+ }),
+ ),
+ ),
+ );
+
+ renderList();
+
+ await expect(
+ screen.findByText('Checkout latency'),
+ ).resolves.toBeInTheDocument();
+ expect(
+ screen.queryByText(/is not authorized to perform/),
+ ).not.toBeInTheDocument();
+ });
+
+ // Saved-view CRUD is gated on `dashboard:list`, so firing this only 403s.
+ it('never fetches saved views when list is denied', async () => {
+ const onViews = jest.fn();
+ server.use(
+ setupAuthzAllow(DashboardCreatePermission),
+ rest.get(VIEWS_URL, (_req, res, ctx) => {
+ onViews();
+ return res(
+ ctx.status(200),
+ ctx.json({ status: 'success', data: { views: [] } }),
+ );
+ }),
+ );
+
+ renderList();
+
+ await waitFor(() => {
+ expect(
+ screen.getAllByText(/is not authorized to perform/).length,
+ ).toBeGreaterThan(0);
+ });
+ expect(onViews).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('check failure', () => {
+ // An unanswered check is not a grant, and the table is gated on the same
+ // signal as the request, so it explains itself instead of rendering empty.
+ it('blocks the table when the permission check fails', async () => {
+ const onList = jest.fn();
+ server.use(
+ rest.post(AUTHZ_CHECK_URL, (_req, res, ctx) => res(ctx.status(500))),
+ rest.get(LIST_URL, (_req, res, ctx) => {
+ onList();
+ return res(
+ ctx.status(200),
+ ctx.json({
+ status: 'success',
+ data: { dashboards: [], total: 0, tags: [] },
+ }),
+ );
+ }),
+ );
+
+ renderList();
+
+ await waitFor(() => {
+ expect(
+ screen.getAllByText(/is not authorized to perform/).length,
+ ).toBeGreaterThan(0);
+ });
+ expect(onList).not.toHaveBeenCalled();
+ });
+ });
+
+ describe('loading', () => {
+ it('leaves the create CTA disabled without a tooltip while the check is in flight', async () => {
+ server.use(
+ rest.post(AUTHZ_CHECK_URL, (_req, res, ctx) => res(ctx.delay('infinite'))),
+ rest.get(LIST_URL, (_req, res, ctx) =>
+ res(
+ ctx.status(200),
+ ctx.json({
+ status: 'success',
+ data: { dashboards: [], total: 0, tags: [] },
+ }),
+ ),
+ ),
+ );
+
+ renderList();
+
+ const cta = await screen.findByTestId('new-dashboard-cta');
+ expect(cta).toBeDisabled();
+ expect(cta).not.toHaveAttribute('data-denied-permissions');
+ });
+ });
+});
diff --git a/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterChips.tsx b/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterChips.tsx
index 38d5dd94a7..676471a443 100644
--- a/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterChips.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterChips.tsx
@@ -33,6 +33,7 @@ interface Props {
onApply: () => void;
// Clear all Created-by selections and run immediately.
onClearCreatedBy: () => void;
+ disabled?: boolean;
}
function FilterChips({
@@ -43,6 +44,7 @@ function FilterChips({
onUpdatedChange,
onApply,
onClearCreatedBy,
+ disabled = false,
}: Props): JSX.Element {
const creatorOptionsData = creatorOptions.map((o) => ({
value: o.email,
@@ -69,6 +71,7 @@ function FilterChips({
maxTagCount={1}
menuItemSelectedIcon={null}
data-testid="dashboards-filter-created-by"
+ disabled={disabled}
onClear={onClearCreatedBy}
optionRender={(option): JSX.Element => (
<div className={styles.creatorOption}>
@@ -90,6 +93,7 @@ function FilterChips({
options={UPDATED_OPTIONS}
optionFilterProp="label"
data-testid="dashboards-filter-updated"
+ disabled={disabled}
onChange={(value): void => onUpdatedChange(value as UpdatedWindow)}
/>
</div>
diff --git a/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.module.scss b/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.module.scss
index c88957acda..98082c5d8e 100644
--- a/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.module.scss
+++ b/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.module.scss
@@ -33,6 +33,13 @@
margin-right: 2px;
}
+.filterControls {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
.chips {
display: flex;
align-items: center;
diff --git a/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.tsx b/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.tsx
index 6983334bc2..2e14ef1e8f 100644
--- a/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/FilterZone/FilterZone.tsx
@@ -10,7 +10,9 @@ import { Button } from '@signozhq/ui/button';
import { Typography } from '@signozhq/ui/typography';
import { X } from '@signozhq/icons';
+import AuthZTooltip from 'lib/authz/components/AuthZTooltip/AuthZTooltip';
import { DashboardListEvents } from 'pages/DashboardsListPage/constants/events';
+import { LIST_CHECKS } from 'pages/DashboardsListPage/constants/permissions';
import type { SuggestionSource } from '../../utils/dslSuggestions';
import {
@@ -34,6 +36,8 @@ interface Props {
onQueryChange: (value: string) => void;
// Rendered at the end of the search row (e.g. the New Dashboard action).
rightSlot?: ReactNode;
+ /** Filtering needs `list`: the box and chips edit a query that cannot be run. */
+ disabled?: boolean;
}
// The filter command zone. The query box is a DRAFT: typing and the Created-by /
@@ -47,6 +51,7 @@ function FilterZone({
source,
onQueryChange,
rightSlot,
+ disabled = false,
}: Props): JSX.Element {
const [draft, setDraft] = useState(query);
@@ -114,41 +119,53 @@ function FilterZone({
return (
<div className={styles.filterZone}>
<div className={styles.searchRow}>
- <div className={styles.searchInput}>
- <SearchBar
- value={draft}
- placeholder="DSL Filter — e.g. name CONTAINS 'api' AND env IN ['prod','staging']"
- source={source}
- dirty={dirty}
- onChange={setDraft}
- onSubmit={run}
- />
- </div>
+ <AuthZTooltip checks={LIST_CHECKS}>
+ <div className={styles.searchInput} data-testid="dashboards-search-zone">
+ <SearchBar
+ value={draft}
+ placeholder="DSL Filter — e.g. name CONTAINS 'api' AND env IN ['prod','staging']"
+ source={source}
+ dirty={dirty}
+ disabled={disabled}
+ onChange={setDraft}
+ onSubmit={run}
+ />
+ </div>
+ </AuthZTooltip>
{rightSlot}
</div>
<div className={styles.filtersRow}>
<Typography.Text className={styles.filtersLabel}>Filters</Typography.Text>
- <FilterChips
- createdBy={reflected.createdBy}
- updated={reflected.updated}
- creatorOptions={creatorOptions}
- onCreatedByChange={handleCreatedByChange}
- onUpdatedChange={handleUpdatedChange}
- onApply={run}
- onClearCreatedBy={handleClearCreatedBy}
- />
- {!isEmpty && (
- <Button
- variant="outlined"
- color="primary"
- size="sm"
- prefix={<X size={12} />}
- onClick={handleClear}
- testId="dashboards-filter-clear"
+ <AuthZTooltip checks={LIST_CHECKS}>
+ <div
+ className={styles.filterControls}
+ data-testid="dashboards-filter-zone"
>
- Clear
- </Button>
- )}
+ <FilterChips
+ createdBy={reflected.createdBy}
+ updated={reflected.updated}
+ creatorOptions={creatorOptions}
+ onCreatedByChange={handleCreatedByChange}
+ onUpdatedChange={handleUpdatedChange}
+ onApply={run}
+ onClearCreatedBy={handleClearCreatedBy}
+ disabled={disabled}
+ />
+ {!isEmpty && (
+ <Button
+ variant="outlined"
+ color="primary"
+ size="sm"
+ prefix={<X size={12} />}
+ disabled={disabled}
+ onClick={handleClear}
+ testId="dashboards-filter-clear"
+ >
+ Clear
+ </Button>
+ )}
+ </div>
+ </AuthZTooltip>
</div>
</div>
);
diff --git a/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.test.tsx b/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.test.tsx
index e08cb6bbe7..5dab6fcad1 100644
--- a/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.test.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen, userEvent } from 'tests/test-utils';
+import { render, screen, userEvent, waitFor } from 'tests/test-utils';
import LegacyDashboardDialog from './LegacyDashboardDialog';
@@ -35,13 +35,12 @@ describe('LegacyDashboardDialog', () => {
isMigrating = false;
});
- const setup = ({ open = true, canEdit = true } = {}): void => {
+ const setup = ({ open = true } = {}): void => {
render(
<LegacyDashboardDialog
open={open}
dashboardId={DASHBOARD_ID}
dashboardName="My Legacy Dashboard"
- canEdit={canEdit}
onClose={jest.fn()}
/>,
);
@@ -70,6 +69,11 @@ describe('LegacyDashboardDialog', () => {
it('retries the migration for the dashboard', async () => {
setup();
+ // Retry is gated on dashboard:update, so it starts disabled until the check
+ // resolves.
+ await waitFor(() =>
+ expect(screen.getByTestId('legacy-dashboard-retry-migration')).toBeEnabled(),
+ );
await userEvent.click(screen.getByTestId('legacy-dashboard-retry-migration'));
expect(mockRetryMigration).toHaveBeenCalledWith(DASHBOARD_ID);
});
@@ -81,11 +85,8 @@ describe('LegacyDashboardDialog', () => {
expect(screen.getByTestId('legacy-dashboard-close')).toBeDisabled();
});
- it('offers only the support path without edit access', () => {
- setup({ canEdit: false });
- expect(
- screen.queryByTestId('legacy-dashboard-retry-migration'),
- ).not.toBeInTheDocument();
+ it('keeps the support path available', () => {
+ setup();
expect(
screen.getByTestId('legacy-dashboard-contact-support'),
).toBeInTheDocument();
diff --git a/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.tsx b/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.tsx
index ad80deb30b..c1ddc0fa27 100644
--- a/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/LegacyDashboardDialog/LegacyDashboardDialog.tsx
@@ -6,7 +6,9 @@ import { useCopyToClipboard } from 'react-use';
import { toast } from '@signozhq/ui/sonner';
import logEvent from 'api/common/logEvent';
import { handleContactSupport } from 'container/Integrations/utils';
+import { useDashboardPermissions } from 'hooks/dashboards/useDashboardPermissions';
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
+import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
import { DashboardListEvents } from 'pages/DashboardsListPage/constants/events';
import { useRetryMigration } from '../../hooks/useRetryMigration';
@@ -17,26 +19,25 @@ interface LegacyDashboardDialogProps {
open: boolean;
dashboardId: string;
dashboardName: string;
- canEdit: boolean;
onClose: () => void;
}
/**
* Explains why a legacy (pre-v2) dashboard can't be opened in the new experience
* and offers to re-run the migration. Legacy rows are surfaced by the list API
- * with `legacy: true` but have no v2 spec to render. Retrying needs edit access,
- * so viewers only get the dashboard ID to share with support.
+ * with `legacy: true` but have no v2 spec to render. Retrying runs a migrate
+ * call, which the backend gates on dashboard:update.
*/
function LegacyDashboardDialog({
open,
dashboardId,
dashboardName,
- canEdit,
onClose,
}: LegacyDashboardDialogProps): JSX.Element {
const [, copyToClipboard] = useCopyToClipboard();
const { isCloudUser } = useGetTenantLicense();
const { retryMigration, isMigrating } = useRetryMigration(onClose);
+ const { canEdit, editChecks } = useDashboardPermissions(dashboardId);
const onCopyId = (): void => {
copyToClipboard(dashboardId);
@@ -95,20 +96,20 @@ function LegacyDashboardDialog({
>
Contact Support
</Button>
- {canEdit && (
- <Button
- variant="solid"
- color="primary"
- size="md"
- prefix={<RotateCw size={14} />}
- disabled={isMigrating}
- loading={isMigrating}
- onClick={onRetryMigration}
- testId="legacy-dashboard-retry-migration"
- >
- Retry migration
- </Button>
- )}
+ <AuthZButton
+ checks={editChecks}
+ withPortal={false}
+ variant="solid"
+ color="primary"
+ size="md"
+ prefix={<RotateCw size={14} />}
+ disabled={isMigrating}
+ loading={isMigrating}
+ onClick={onRetryMigration}
+ testId="legacy-dashboard-retry-migration"
+ >
+ Retry migration
+ </AuthZButton>
</div>
}
>
diff --git a/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.module.scss b/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.module.scss
index fe9a5f2620..e904b22325 100644
--- a/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.module.scss
+++ b/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.module.scss
@@ -154,6 +154,15 @@
}
}
+.disabled {
+ cursor: not-allowed;
+ opacity: 0.6;
+
+ &:focus-within {
+ border-color: var(--l2-border);
+ }
+}
+
.leadIcon {
position: absolute;
top: 11px;
diff --git a/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.tsx b/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.tsx
index cda3ba89f7..e02fd9ad31 100644
--- a/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/SearchBar/SearchBar.tsx
@@ -5,6 +5,7 @@ import {
completionKeymap,
startCompletion,
} from '@codemirror/autocomplete';
+import cx from 'classnames';
import { Button } from '@signozhq/ui/button';
import { Color } from '@signozhq/design-tokens';
import { ChevronUp, Command, CornerDownLeft, Search } from '@signozhq/icons';
@@ -32,6 +33,8 @@ interface Props {
source?: SuggestionSource;
// The draft differs from the last-run query — shows a "run to apply" hint.
dirty?: boolean;
+ /** Filtering needs `list`: the draft edits a query that cannot be run. */
+ disabled?: boolean;
}
const EMPTY_SOURCE: SuggestionSource = {
@@ -78,6 +81,7 @@ function SearchBar({
placeholder = "Filter with DSL (e.g. name CONTAINS 'foo')",
source = EMPTY_SOURCE,
dirty = false,
+ disabled = false,
}: Props): JSX.Element {
const isMac = getUserOperatingSystem() === UserOperatingSystem.MACOS;
const editorRef = useRef<ReactCodeMirrorRef>(null);
@@ -100,28 +104,34 @@ function SearchBar({
editorTheme,
// Wrap a long query onto the next line instead of scrolling horizontally.
EditorView.lineWrapping,
- autocompletion({
- override: [dslCompletionSource(() => sourceRef.current)],
- closeOnBlur: true,
- activateOnTyping: true,
- maxRenderedOptions: 100,
- icons: false,
- }),
- // Open the suggestions on focus/click (not only while typing), so a click
- // into the box immediately shows the key list.
- EditorView.domEventHandlers({
- focus: (_event, view): boolean => {
- startCompletion(view);
- return false;
- },
- click: (_event, view): boolean => {
- startCompletion(view);
- return false;
- },
- }),
+ // Read-only is not enough: these open the list on click and accepting an
+ // option writes to the document, so a disabled box must not carry them.
+ ...(disabled
+ ? []
+ : [
+ autocompletion({
+ override: [dslCompletionSource(() => sourceRef.current)],
+ closeOnBlur: true,
+ activateOnTyping: true,
+ maxRenderedOptions: 100,
+ icons: false,
+ }),
+ // Open the suggestions on focus/click (not only while typing), so a
+ // click into the box immediately shows the key list.
+ EditorView.domEventHandlers({
+ focus: (_event, view): boolean => {
+ startCompletion(view);
+ return false;
+ },
+ click: (_event, view): boolean => {
+ startCompletion(view);
+ return false;
+ },
+ }),
+ ]),
Prec.highest(
keymap.of([
- ...completionKeymap,
+ ...(disabled ? [] : completionKeymap),
{ key: 'Escape', run: closeCompletion },
// Enter accepts an open suggestion (via completionKeymap above); with
// none open it is a no-op — it never runs the query or inserts a newline.
@@ -138,12 +148,12 @@ function SearchBar({
]),
),
],
- [],
+ [disabled],
);
return (
<div className={styles.wrapper}>
- <div className={styles.field}>
+ <div className={cx(styles.field, { [styles.disabled]: disabled })}>
<Search
size={12}
color={Color.BG_VANILLA_400}
@@ -157,6 +167,7 @@ function SearchBar({
extensions={extensions}
basicSetup={BASIC_SETUP}
indentWithTab={false}
+ editable={!disabled}
data-testid="dashboards-list-search"
onChange={(next): void => onChange(next.replace(/\n/g, ' '))}
/>
@@ -166,6 +177,7 @@ function SearchBar({
size="sm"
className={styles.submit}
aria-label="Run search"
+ disabled={disabled}
testId="dashboards-list-search-submit"
onMouseDown={(e: MouseEvent<HTMLButtonElement>): void => {
e.preventDefault();
diff --git a/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.module.scss b/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.module.scss
index 3b48a772e8..59c6173ba2 100644
--- a/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.module.scss
+++ b/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.module.scss
@@ -9,6 +9,10 @@
transition: width 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
+.denied {
+ padding: 16px 12px;
+}
+
.collapsed {
width: 0;
border-right-color: transparent;
diff --git a/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.tsx b/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.tsx
index 65e2b8a223..4064de3469 100644
--- a/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.tsx
+++ b/frontend/src/pages/DashboardsListPage/components/ViewsRail/ViewsRail.tsx
@@ -1,4 +1,9 @@
-import { type ChangeEvent, useCallback, useState } from 'react';
+import {
+ type ChangeEvent,
+ type ReactElement,
+ useCallback,
+ useState,
+} from 'react';
import logEvent from 'api/common/logEvent';
import { Button } from '@signozhq/ui/button';
import { Input } from '@signozhq/ui/input';
@@ -14,6 +19,9 @@ import { type BuiltinView } from '../../utils/views';
import ViewNamePopover from './ViewNamePopover';
import styles from './ViewsRail.module.scss';
+import { AuthZGuardContent } from 'lib/authz/components/AuthZGuard/AuthZGuardContent';
+import PermissionDeniedCallout from 'lib/authz/components/PermissionDeniedCallout/PermissionDeniedCallout';
+import { LIST_CHECKS } from 'pages/DashboardsListPage/constants/permissions';
interface Props {
activeViewId: string;
@@ -23,8 +31,6 @@ interface Props {
isCustomActive: boolean;
isModified: boolean;
collapsed?: boolean;
- // Edit permission. Viewers can select views but not add / rename / delete / save.
- canEdit: boolean;
onSelect: (id: string) => void;
onSave: (name: string) => void;
onSaveChanges: () => void;
@@ -50,7 +56,6 @@ function ViewsRail({
isCustomActive,
isModified,
collapsed = false,
- canEdit,
onSelect,
onSave,
onSaveChanges,
@@ -127,7 +132,7 @@ function ViewsRail({
<div className={styles.dirtyDot} title="Unsaved changes" />
)}
</Button>
- {canEdit && row.deletable && (
+ {row.deletable && (
<div className={styles.itemActions}>
<ViewNamePopover
open={renamingId === row.id}
@@ -176,100 +181,106 @@ function ViewsRail({
return (
<aside className={cx(styles.rail, { [styles.collapsed]: collapsed })}>
- <div className={styles.header}>
- <h4 className={styles.headerTitle}>Views</h4>
- {canEdit && (
- <ViewNamePopover
- open={saveOpen}
- onOpenChange={setSaveOpen}
- onSubmit={handleSaveAsView}
- title="Save as view"
- confirmLabel="Save view"
- testIdPrefix="save-view"
- trigger={
- <Button
- variant="ghost"
- color="secondary"
- size="icon"
- title="Save current filters as a view"
- testId="dashboards-view-save-trigger"
- >
- <Plus size={14} />
- </Button>
- }
- />
+ <AuthZGuardContent
+ checks={LIST_CHECKS}
+ onFailRenderContent={false}
+ fallback={({ deniedPermissions }): ReactElement => (
+ <div className={styles.denied} data-testid="views-rail-denied">
+ <PermissionDeniedCallout deniedPermissions={deniedPermissions} />
+ </div>
)}
- </div>
+ >
+ <>
+ <div className={styles.header}>
+ <h4 className={styles.headerTitle}>Views</h4>
+ <ViewNamePopover
+ open={saveOpen}
+ onOpenChange={setSaveOpen}
+ onSubmit={handleSaveAsView}
+ title="Save as view"
+ confirmLabel="Save view"
+ testIdPrefix="save-view"
+ trigger={
+ <Button
+ variant="ghost"
+ color="secondary"
+ size="icon"
+ title="Save current filters as a view"
+ testId="dashboards-view-save-trigger"
+ >
+ <Plus size={14} />
+ </Button>
+ }
+ />
+ </div>
- <div className={styles.search}>
- <Input
- value={query}
- placeholder="Filter views by name"
- prefix={<Search size={12} />}
- testId="dashboards-view-search"
- onChange={(e: ChangeEvent<HTMLInputElement>): void =>
- setQuery(e.target.value)
- }
- />
- </div>
+ <div className={styles.search}>
+ <Input
+ value={query}
+ placeholder="Filter views by name"
+ prefix={<Search size={12} />}
+ testId="dashboards-view-search"
+ onChange={(e: ChangeEvent<HTMLInputElement>): void =>
+ setQuery(e.target.value)
+ }
+ />
+ </div>
- <div className={styles.scroll}>
- {personal.length > 0 && (
- <>
- <div className={styles.groupLabel}>Personal</div>
- {personal.map((v) => renderItem(v))}
- </>
- )}
+ <div className={styles.scroll}>
+ {personal.length > 0 && (
+ <>
+ <div className={styles.groupLabel}>Personal</div>
+ {personal.map((v) => renderItem(v))}
+ </>
+ )}
- {system.length > 0 && (
- <>
- <div className={cx(styles.groupLabel, styles.groupLabelSpaced)}>
- System
- </div>
- {system.map((v) => renderItem(v))}
- </>
- )}
+ {system.length > 0 && (
+ <>
+ <div className={cx(styles.groupLabel, styles.groupLabelSpaced)}>
+ System
+ </div>
+ {system.map((v) => renderItem(v))}
+ </>
+ )}
- {(!q || custom.length > 0) && (
- <>
- <div className={cx(styles.groupLabel, styles.groupLabelSpaced)}>
- My views
- <Typography.Text className={styles.groupCount}>
- {customViews.length}
- </Typography.Text>
- </div>
- {customViewsLoading ? (
- <div className={styles.empty}>Loading views…</div>
- ) : customViews.length === 0 ? (
- <div className={styles.empty}>
- No saved views yet. Filter the list, then save it as a view.
- </div>
- ) : (
- custom.map((v) =>
- renderItem({
- id: v.id,
- label: v.name,
- icon: Bookmark,
- deletable: true,
- }),
- )
+ {(!q || custom.length > 0) && (
+ <>
+ <div className={cx(styles.groupLabel, styles.groupLabelSpaced)}>
+ My views
+ <Typography.Text className={styles.groupCount}>
+ {customViews.length}
+ </Typography.Text>
+ </div>
+ {customViewsLoading ? (
+ <div className={styles.empty}>Loading views…</div>
+ ) : customViews.length === 0 ? (
+ <div className={styles.empty}>
+ No saved views yet. Filter the list, then save it as a view.
+ </div>
+ ) : (
+ custom.map((v) =>
+ renderItem({
+ id: v.id,
+ label: v.name,
+ icon: Bookmark,
+ deletable: true,
+ }),
+ )
+ )}
+ </>
)}
- </>
- )}
- {noMatches && (
- <div className={styles.searchEmpty}>
- No views match &ldquo;{query}&rdquo;
+ {noMatches && (
+ <div className={styles.searchEmpty}>
+ No views match &ldquo;{query}&rdquo;
+ </div>
+ )}
</div>
- )}
- </div>
- {isCustomActive && isModified && (
- <div className={styles.dirtyPanel}>
- <div className={styles.dirtyTitle}>Unsaved changes</div>
- <div className={styles.dirtyActions}>
- {canEdit && (
- <>
+ {isCustomActive && isModified && (
+ <div className={styles.dirtyPanel}>
+ <div className={styles.dirtyTitle}>Unsaved changes</div>
+ <div className={styles.dirtyActions}>
<Button
variant="solid"
color="primary"
@@ -287,38 +298,36 @@ function ViewsRail({
>
Save as…
</Button>
- </>
- )}
- <Button variant="ghost" color="secondary" size="sm" onClick={onReset}>
- Reset
- </Button>
- </div>
- </div>
- )}
+ <Button variant="ghost" color="secondary" size="sm" onClick={onReset}>
+ Reset
+ </Button>
+ </div>
+ </div>
+ )}
- {!isCustomActive && isModified && (
- <div className={cx(styles.dirtyPanel, styles.dirtyPanelDefault)}>
- <div className={styles.dirtyTitle}>Filters active</div>
- <div className={styles.dirtyActions}>
- {canEdit && (
- <Button
- variant="solid"
- color="primary"
- size="sm"
- prefix={<Plus size={12} />}
- onClick={(): void => setSaveOpen(true)}
- testId="dashboards-view-save-as-new"
- >
- Save as new view
- </Button>
- )}
- <Button variant="ghost" color="secondary" size="sm" onClick={onReset}>
- Reset
- </Button>
- </div>
- </div>
- )}
- {contextHolder}
+ {!isCustomActive && isModified && (
+ <div className={cx(styles.dirtyPanel, styles.dirtyPanelDefault)}>
+ <div className={styles.dirtyTitle}>Filters active</div>
+ <div className={styles.dirtyActions}>
+ <Button
+ variant="solid"
+ color="primary"
+ size="sm"
+ prefix={<Plus size={12} />}
+ onClick={(): void => setSaveOpen(true)}
+ testId="dashboards-view-save-as-new"
+ >
+ Save as new view
+ </Button>
+ <Button variant="ghost" color="secondary" size="sm" onClick={onReset}>
+ Reset
+ </Button>
+ </div>
+ </div>
+ )}
+ {contextHolder}
+ </>
+ </AuthZGuardContent>
</aside>
);
}
diff --git a/frontend/src/pages/DashboardsListPage/components/ViewsRail/__tests__/ViewsRail.authz.test.tsx b/frontend/src/pages/DashboardsListPage/components/ViewsRail/__tests__/ViewsRail.authz.test.tsx
new file mode 100644
index 0000000000..d3d78bb3ab
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/components/ViewsRail/__tests__/ViewsRail.authz.test.tsx
@@ -0,0 +1,76 @@
+import { Bookmark } from '@signozhq/icons';
+import { server } from 'mocks-server/server';
+import { render, screen } from 'tests/test-utils';
+import { setupAuthzAllow } from 'lib/authz/utils/authz-test-utils';
+import { DashboardListPermission } from 'lib/authz/hooks/useAuthZ/permissions/dashboard.permissions';
+
+import type { BuiltinView } from '../../../utils/views';
+import ViewsRail from '../ViewsRail';
+
+const BUILTIN_VIEWS: BuiltinView[] = [
+ {
+ id: 'all',
+ label: 'All dashboards',
+ icon: Bookmark,
+ section: 'system',
+ } as BuiltinView,
+];
+
+const CUSTOM_VIEWS = [
+ { id: 'view-1', name: 'My prod dashboards', query: '', userEmail: '[email protected]' },
+];
+
+function renderRail(
+ props?: Partial<React.ComponentProps<typeof ViewsRail>>,
+): ReturnType<typeof render> {
+ return render(
+ <ViewsRail
+ activeViewId="view-1"
+ builtinViews={BUILTIN_VIEWS}
+ customViews={CUSTOM_VIEWS as never}
+ customViewsLoading={false}
+ isCustomActive
+ isModified
+ onSelect={jest.fn()}
+ onSave={jest.fn()}
+ onSaveChanges={jest.fn()}
+ onReset={jest.fn()}
+ onDelete={jest.fn()}
+ onRename={jest.fn()}
+ {...props}
+ />,
+ );
+}
+
+describe('ViewsRail - AuthZ', () => {
+ afterEach(() => {
+ jest.restoreAllMocks();
+ server.resetHandlers();
+ });
+
+ // View CRUD is gated on dashboard:list, not edit rights, so a viewer can
+ // manage views. Guards the regression where the rail sat behind edit_dashboard.
+ it('lets a user holding only list manage saved views', async () => {
+ server.use(setupAuthzAllow(DashboardListPermission));
+
+ renderRail();
+
+ // Radix's asChild clone swallows the trigger's testId, so match its title.
+ await expect(
+ screen.findByTitle('Save current filters as a view'),
+ ).resolves.toBeEnabled();
+ expect(screen.getByTestId('dashboards-view-save-changes')).toBeEnabled();
+ expect(screen.getByLabelText('Rename view')).toBeEnabled();
+ expect(screen.getByLabelText('Delete view')).toBeEnabled();
+ });
+
+ it('offers save-as-new-view on a builtin view with unsaved filters', async () => {
+ server.use(setupAuthzAllow(DashboardListPermission));
+
+ renderRail({ activeViewId: 'all', isCustomActive: false });
+
+ await expect(
+ screen.findByTestId('dashboards-view-save-as-new'),
+ ).resolves.toBeEnabled();
+ });
+});
diff --git a/frontend/src/pages/DashboardsListPage/constants/permissions.ts b/frontend/src/pages/DashboardsListPage/constants/permissions.ts
new file mode 100644
index 0000000000..e3a90a4461
--- /dev/null
+++ b/frontend/src/pages/DashboardsListPage/constants/permissions.ts
@@ -0,0 +1,5 @@
+import { DashboardListPermission } from 'lib/authz/hooks/useAuthZ/permissions/dashboard.permissions';
+
+// The table, the saved views and the filters all reach the same endpoint, so one
+// check gates them all.
+export const LIST_CHECKS = [DashboardListPermission];
diff --git a/frontend/src/pages/DashboardsListPage/hooks/useActiveView.ts b/frontend/src/pages/DashboardsListPage/hooks/useActiveView.ts
index 46ca4725a1..19bfd81876 100644
--- a/frontend/src/pages/DashboardsListPage/hooks/useActiveView.ts
+++ b/frontend/src/pages/DashboardsListPage/hooks/useActiveView.ts
@@ -26,6 +26,8 @@ interface UseActiveViewArgs {
sortOrder: DashboardtypesListOrderDTO;
setSortColumn: (column: DashboardtypesListSortDTO) => void;
setSortOrder: (order: DashboardtypesListOrderDTO) => void;
+ /** The caller's `list` grant, which saved views are gated on server-side. */
+ canListDashboards: boolean;
}
export interface UseActiveViewResult {
@@ -58,6 +60,7 @@ export function useActiveView({
sortOrder,
setSortColumn,
setSortOrder,
+ canListDashboards,
}: UseActiveViewArgs): UseActiveViewResult {
const [activeViewId, setActiveViewId] = useQueryState(
'view',
@@ -70,7 +73,7 @@ export function useActiveView({
createView,
updateView,
deleteView,
- } = useSavedViews();
+ } = useSavedViews({ enabled: canListDashboards });
const activeCustom = useMemo(
() => customViews.find((v) => v.id === activeViewId),
diff --git a/frontend/src/pages/DashboardsListPage/hooks/useSavedViews.ts b/frontend/src/pages/DashboardsListPage/hooks/useSavedViews.ts
index 4b91b3ee94..6cf803ba0f 100644
--- a/frontend/src/pages/DashboardsListPage/hooks/useSavedViews.ts
+++ b/frontend/src/pages/DashboardsListPage/hooks/useSavedViews.ts
@@ -49,11 +49,15 @@ export interface UseSavedViewsResult {
deleteView: (id: string) => Promise<void>;
}
-// Org-shared saved views, backed by the Views API. Exposes the list plus
-// create/update/delete that invalidate the list on success.
-export function useSavedViews(): UseSavedViewsResult {
+/**
+ * Org-shared saved views, backed by the Views API. `enabled` is the caller's
+ * `list` grant: the backend gates view CRUD on `dashboard:list`.
+ */
+export function useSavedViews({
+ enabled = true,
+}: { enabled?: boolean } = {}): UseSavedViewsResult {
const queryClient = useQueryClient();
- const { data, isLoading } = useListDashboardViews();
+ const { data, isLoading } = useListDashboardViews({ query: { enabled } });
const views = useMemo<SavedView[]>(
() => (data?.data?.views ?? []).map(toSavedView),
diff --git a/frontend/src/utils/permission/index.ts b/frontend/src/utils/permission/index.ts
index 571082fbcf..814e9b09b1 100644
--- a/frontend/src/utils/permission/index.ts
+++ b/frontend/src/utils/permission/index.ts
@@ -162,6 +162,9 @@ export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = {
* This prevents us from adding `ANONYMOUS` on the `routePermission`
*/
export const routeWithInitialAuthZSupport = {
+ ALL_DASHBOARD: true,
+ DASHBOARD: true,
+ DASHBOARD_PANEL_EDITOR: true,
MY_SETTINGS: true,
SETTINGS: true,
TRACES_EXPLORER: true,