SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat: revamped the settings nav and setting dropdown (#10494)
SagarRajput-77691f3451a60
diff --git a/frontend/src/container/GeneralSettings/GeneralSettings.tsx b/frontend/src/container/GeneralSettings/GeneralSettings.tsxindex c8385ec1fc..fad67b3668 100644--- a/frontend/src/container/GeneralSettings/GeneralSettings.tsx+++ b/frontend/src/container/GeneralSettings/GeneralSettings.tsx@@ -674,7 +674,7 @@ function GeneralSettings({return (<div className="general-settings-page"><div className="general-settings-header">- <span className="general-settings-title">General</span>+ <span className="general-settings-title">Workspace</span><span className="general-settings-subtitle">Manage your workspace settings.</span>diff --git a/frontend/src/container/MySettings/index.tsx b/frontend/src/container/MySettings/index.tsxindex 0af4894dd0..4906dea19d 100644--- a/frontend/src/container/MySettings/index.tsx+++ b/frontend/src/container/MySettings/index.tsx@@ -161,7 +161,7 @@ function MySettings(): JSX.Element {<div className="my-settings-container"><div className="user-info-section"><div className="user-info-section-header">- <div className="user-info-section-title">General </div>+ <div className="user-info-section-title">Account </div><div className="user-info-section-subtitle">Manage your account settings.diff --git a/frontend/src/container/SideNav/SideNav.styles.scss b/frontend/src/container/SideNav/SideNav.styles.scssindex 1b443e287b..fcbf6280a9 100644--- a/frontend/src/container/SideNav/SideNav.styles.scss+++ b/frontend/src/container/SideNav/SideNav.styles.scss@@ -1057,21 +1057,20 @@gap: 8px;.user-settings-dropdown-label-text {- color: var(--bg-slate-50, #62687c);+ color: var(--l3-foreground);font-family: Inter;- font-size: 10px;- font-family: Inter;- font-weight: 600;+ font-size: var(--uppercase-small-500-font-size);+ font-weight: var(--uppercase-small-500-font-weight);font-style: normal;- line-height: 18px; /* 163.636% */+ line-height: 18px;letter-spacing: 0.88px;text-transform: uppercase;}.user-settings-dropdown-label-email {- color: var(--bg-vanilla-400, #c0c1c3);+ color: var(--l1-foreground);font-family: Inter;- font-size: 12px;+ font-size: var(--font-size-xs);font-style: normal;line-height: normal;letter-spacing: 0.14px;@@ -1079,7 +1078,7 @@}.ant-dropdown-menu-item-divider {- background-color: var(--bg-slate-500, #161922) !important;+ background-color: var(--secondary) !important;}.ant-dropdown-menu-item-disabled {@@ -1095,6 +1094,14 @@.help-support-dropdown {.ant-dropdown-menu-item {min-height: 32px;++ .ant-dropdown-menu-title-content {+ color: var(--l1-foreground) !important;+ }++ .user-settings-dropdown-logout-section {+ color: var(--danger-background);+ }}}@@ -1271,7 +1278,7 @@}.help-support-dropdown li.ant-dropdown-menu-item-divider {- background-color: var(--bg-slate-500, #161922) !important;+ background-color: var(--secondary) !important;}.lightMode {@@ -1431,22 +1438,6 @@}}- .settings-dropdown {- .user-settings-dropdown-logged-in-section {- .user-settings-dropdown-label-text {- color: var(--bg-ink-400);- }-- .user-settings-dropdown-label-email {- color: var(--bg-ink-300);- }- }-- .ant-dropdown-menu-item-divider {- background-color: var(--bg-vanilla-300) !important;- }- }-.reorder-shortcut-nav-items-modal {.ant-modal-content {border: 1px solid var(--bg-vanilla-300);@@ -1503,10 +1494,6 @@color: var(--bg-ink-400);}}-- .help-support-dropdown li.ant-dropdown-menu-item-divider {- background-color: var(--bg-vanilla-300) !important;- }}.version-tooltip-overlay {diff --git a/frontend/src/container/SideNav/SideNav.tsx b/frontend/src/container/SideNav/SideNav.tsxindex cb23b1b50e..68263d4e11 100644--- a/frontend/src/container/SideNav/SideNav.tsx+++ b/frontend/src/container/SideNav/SideNav.tsx@@ -69,6 +69,7 @@ import { routeConfig } from './config';import { getQueryString } from './helper';import {defaultMoreMenuItems,+ getUserSettingsDropdownMenuItems,helpSupportDropdownMenuItems as DefaultHelpSupportDropdownMenuItems,helpSupportMenuItem,primaryMenuItems,@@ -485,48 +486,12 @@ function SideNav({ isPinned }: { isPinned: boolean }): JSX.Element {const userSettingsDropdownMenuItems: MenuProps['items'] = useMemo(() =>- [- {- key: 'label',- label: (- <div className="user-settings-dropdown-logged-in-section">- <span className="user-settings-dropdown-label-text">LOGGED IN AS</span>- <span className="user-settings-dropdown-label-email">{user.email}</span>- </div>- ),- disabled: true,- dataTestId: 'logged-in-as-nav-item',- },- { type: 'divider' as const },- {- key: 'account',- label: 'Account Settings',- dataTestId: 'account-settings-nav-item',- },- {- key: 'workspace',- label: 'Workspace Settings',- disabled: isWorkspaceBlocked,- dataTestId: 'workspace-settings-nav-item',- },- ...(isEnterpriseSelfHostedUser || isCommunityEnterpriseUser- ? [- {- key: 'license',- label: 'Manage License',- dataTestId: 'manage-license-nav-item',- },- ]- : []),- { type: 'divider' as const },- {- key: 'logout',- label: (- <span className="user-settings-dropdown-logout-section">Sign out</span>- ),- dataTestId: 'logout-nav-item',- },- ].filter(Boolean),+ getUserSettingsDropdownMenuItems({+ userEmail: user.email,+ isWorkspaceBlocked,+ isEnterpriseSelfHostedUser,+ isCommunityEnterpriseUser,+ }),[isEnterpriseSelfHostedUser,isCommunityEnterpriseUser,@@ -856,9 +821,6 @@ function SideNav({ isPinned }: { isPinned: boolean }): JSX.Element {});switch (item.key) {- case ROUTES.SHORTCUTS:- history.push(ROUTES.SHORTCUTS);- break;case 'invite-collaborators':history.push(`${ROUTES.ORG_SETTINGS}#invite-team-members`);break;@@ -878,7 +840,7 @@ function SideNav({ isPinned }: { isPinned: boolean }): JSX.Element {};const handleSettingsMenuItemClick = (info: SidebarItem): void => {- const item = userSettingsDropdownMenuItems.find(+ const item = (userSettingsDropdownMenuItems ?? []).find((item) => item?.key === info.key,);let menuLabel = '';@@ -904,6 +866,9 @@ function SideNav({ isPinned }: { isPinned: boolean }): JSX.Element {case 'license':history.push(ROUTES.LIST_LICENSES);break;+ case 'keyboard-shortcuts':+ history.push(ROUTES.SHORTCUTS);+ break;case 'logout':Logout();break;diff --git a/frontend/src/container/SideNav/__tests__/menuItems.test.tsx b/frontend/src/container/SideNav/__tests__/menuItems.test.tsxnew file mode 100644index 0000000000..2da78927ba--- /dev/null+++ b/frontend/src/container/SideNav/__tests__/menuItems.test.tsx@@ -0,0 +1,74 @@+import { getUserSettingsDropdownMenuItems } from 'container/SideNav/menuItems';++const BASE_PARAMS = {+ userEmail: '[email protected]',+ isWorkspaceBlocked: false,+ isEnterpriseSelfHostedUser: false,+ isCommunityEnterpriseUser: false,+};++describe('getUserSettingsDropdownMenuItems', () => {+ it('always includes logged-in-as label, workspace, account, keyboard shortcuts, and sign out', () => {+ const items = getUserSettingsDropdownMenuItems(BASE_PARAMS);+ const keys = items?.map((item) => item?.key);++ expect(keys).toContain('label');+ expect(keys).toContain('workspace');+ expect(keys).toContain('account');+ expect(keys).toContain('keyboard-shortcuts');+ expect(keys).toContain('logout');++ // workspace item is enabled when workspace is not blocked+ const workspaceItem = items?.find(+ (item: any) => item.key === 'workspace',+ ) as any;++ expect(workspaceItem?.disabled).toBe(false);++ // does not include license item for regular cloud user+ expect(keys).not.toContain('license');+ });++ it('includes manage license item for enterprise self-hosted users', () => {+ const items = getUserSettingsDropdownMenuItems({+ ...BASE_PARAMS,+ isEnterpriseSelfHostedUser: true,+ });+ const keys = items?.map((item) => item?.key);++ expect(keys).toContain('license');+ });++ it('includes manage license item for community enterprise users', () => {+ const items = getUserSettingsDropdownMenuItems({+ ...BASE_PARAMS,+ isCommunityEnterpriseUser: true,+ });+ const keys = items?.map((item) => item?.key);++ expect(keys).toContain('license');+ });++ it('workspace item is disabled when workspace is blocked', () => {+ const items = getUserSettingsDropdownMenuItems({+ ...BASE_PARAMS,+ isWorkspaceBlocked: true,+ });+ const workspaceItem = items?.find(+ (item: any) => item.key === 'workspace',+ ) as any;++ expect(workspaceItem?.disabled).toBe(true);+ });++ it('returns items in correct order: label, divider, workspace, account, ..., shortcuts, divider, logout', () => {+ const items = getUserSettingsDropdownMenuItems(BASE_PARAMS) ?? [];+ const keys = items.map((item: any) => item.key ?? item.type);++ expect(keys[0]).toBe('label');+ expect(keys[1]).toBe('divider');+ expect(keys[2]).toBe('workspace');+ expect(keys[3]).toBe('account');+ expect(keys[keys.length - 1]).toBe('logout');+ });+});diff --git a/frontend/src/container/SideNav/menuItems.tsx b/frontend/src/container/SideNav/menuItems.tsxindex ae1efc7e9e..a2dd108d76 100644--- a/frontend/src/container/SideNav/menuItems.tsx+++ b/frontend/src/container/SideNav/menuItems.tsx@@ -1,4 +1,6 @@import { RocketOutlined } from '@ant-design/icons';+import { Style } from '@signozhq/design-tokens';+import { MenuProps } from 'antd';import ROUTES from 'constants/routes';import {ArrowUpRight,@@ -8,6 +10,7 @@ import {Book,Boxes,BugIcon,+ Building2,ChartArea,Cloudy,DraftingCompass,@@ -20,6 +23,7 @@ import {Layers2,LayoutGrid,ListMinus,+ LogOut,MessageSquareText,Plus,Receipt,@@ -33,7 +37,11 @@ import {UserPlus,} from 'lucide-react';-import { SecondaryMenuItemKey, SidebarItem } from './sideNav.types';+import {+ SecondaryMenuItemKey,+ SettingsNavSection,+ SidebarItem,+} from './sideNav.types';export const getStartedMenuItem = {key: ROUTES.GET_STARTED,@@ -289,77 +297,100 @@ export const defaultMoreMenuItems: SidebarItem[] = [},];-export const settingsMenuItems: SidebarItem[] = [- {- key: ROUTES.SETTINGS,- label: 'General',- icon: <Settings size={16} />,- isEnabled: true,- itemKey: 'general',- },- {- key: ROUTES.BILLING,- label: 'Billing',- icon: <Receipt size={16} />,- isEnabled: false,- itemKey: 'billing',- },- {- key: ROUTES.ROLES_SETTINGS,- label: 'Roles',- icon: <Shield size={16} />,- isEnabled: false,- itemKey: 'roles',- },- {- key: ROUTES.ORG_SETTINGS,- label: 'Members & SSO',- icon: <User size={16} />,- isEnabled: false,- itemKey: 'members-sso',+export const settingsNavSections: SettingsNavSection[] = [+ {+ key: 'general',+ items: [+ {+ key: ROUTES.SETTINGS,+ label: 'Workspace',+ icon: <Settings size={16} />,+ isEnabled: true,+ itemKey: 'workspace',+ },+ {+ key: ROUTES.MY_SETTINGS,+ label: 'Account',+ icon: <User size={16} />,+ isEnabled: true,+ itemKey: 'account',+ },+ {+ key: ROUTES.ALL_CHANNELS,+ label: 'Notification Channels',+ icon: <FileKey2 size={16} />,+ isEnabled: true,+ itemKey: 'notification-channels',+ },+ {+ key: ROUTES.BILLING,+ label: 'Billing',+ icon: <Receipt size={16} />,+ isEnabled: false,+ itemKey: 'billing',+ },+ {+ key: ROUTES.INTEGRATIONS,+ label: 'Integrations',+ icon: <Unplug size={16} />,+ isEnabled: false,+ itemKey: 'integrations',+ },+ ],},{- key: ROUTES.INTEGRATIONS,- label: 'Integrations',- icon: <Unplug size={16} />,- isEnabled: false,- itemKey: 'integrations',- },- {- key: ROUTES.ALL_CHANNELS,- label: 'Notification Channels',- icon: <FileKey2 size={16} />,- isEnabled: true,- itemKey: 'notification-channels',- },- {- key: ROUTES.API_KEYS,- label: 'API Keys',- icon: <Key size={16} />,- isEnabled: false,- itemKey: 'api-keys',- },- {- key: ROUTES.INGESTION_SETTINGS,- label: 'Ingestion',- icon: <RocketOutlined rotate={45} />,- isEnabled: false,- itemKey: 'ingestion',- },- {- key: ROUTES.MY_SETTINGS,- label: 'Account Settings',- icon: <User size={16} />,- isEnabled: true,- itemKey: 'account-settings',- },- {- key: ROUTES.SHORTCUTS,- label: 'Keyboard Shortcuts',- icon: <Layers2 size={16} />,- isEnabled: true,- itemKey: 'keyboard-shortcuts',+ key: 'identity-access',+ title: 'Identity & Access',+ items: [+ {+ key: ROUTES.ROLES_SETTINGS,+ label: 'Roles',+ icon: <Shield size={16} />,+ isEnabled: false,+ itemKey: 'roles',+ },+ {+ key: ROUTES.API_KEYS,+ label: 'API Keys',+ icon: <Key size={16} />,+ isEnabled: false,+ itemKey: 'api-keys',+ },+ {+ key: ROUTES.INGESTION_SETTINGS,+ label: 'Ingestion',+ icon: <RocketOutlined rotate={45} />,+ isEnabled: false,+ itemKey: 'ingestion',+ },+ ],+ },+ {+ key: 'authentication',+ title: 'Authentication',+ items: [+ {+ key: ROUTES.ORG_SETTINGS,+ label: 'Members & SSO',+ icon: <User size={16} />,+ isEnabled: false,+ itemKey: 'members-sso',+ },+ ],+ },+ {+ key: 'shortcuts',+ hasDivider: true,+ items: [+ {+ key: ROUTES.SHORTCUTS,+ label: 'Keyboard Shortcuts',+ icon: <Keyboard size={16} />,+ isEnabled: true,+ itemKey: 'keyboard-shortcuts',+ },+ ],},];@@ -410,12 +441,6 @@ export const helpSupportDropdownMenuItems: SidebarItem[] = [icon: <MessageSquareText size={14} />,itemKey: 'chat-support',},- {- key: ROUTES.SHORTCUTS,- label: 'Keyboard Shortcuts',- icon: <Keyboard size={14} />,- itemKey: 'keyboard-shortcuts',- },{key: 'invite-collaborators',label: 'Invite a Team Member',@@ -424,6 +449,78 @@ export const helpSupportDropdownMenuItems: SidebarItem[] = [},];+export interface UserSettingsMenuItemsParams {+ userEmail: string;+ isWorkspaceBlocked: boolean;+ isEnterpriseSelfHostedUser: boolean;+ isCommunityEnterpriseUser: boolean;+}++export const getUserSettingsDropdownMenuItems = ({+ userEmail,+ isWorkspaceBlocked,+ isEnterpriseSelfHostedUser,+ isCommunityEnterpriseUser,+}: UserSettingsMenuItemsParams): MenuProps['items'] =>+ [+ {+ key: 'label',+ label: (+ <div className="user-settings-dropdown-logged-in-section">+ <span className="user-settings-dropdown-label-text">LOGGED IN AS</span>+ <span className="user-settings-dropdown-label-email">{userEmail}</span>+ </div>+ ),+ disabled: true,+ dataTestId: 'logged-in-as-nav-item',+ },+ { type: 'divider' as const },+ {+ key: 'workspace',+ label: 'Workspace Settings',+ icon: <Building2 size={14} color={Style.L1_FOREGROUND} />,+ disabled: isWorkspaceBlocked,+ dataTestId: 'workspace-settings-nav-item',+ },+ {+ key: 'account',+ label: 'Account Settings',+ icon: <User size={14} color={Style.L1_FOREGROUND} />,+ dataTestId: 'account-settings-nav-item',+ },+ ...(isEnterpriseSelfHostedUser || isCommunityEnterpriseUser+ ? [+ {+ key: 'license',+ label: 'Manage License',+ icon: <Shield size={14} color={Style.L1_FOREGROUND} />,+ dataTestId: 'manage-license-nav-item',+ },+ ]+ : []),+ {+ key: 'keyboard-shortcuts',+ label: 'Keyboard Shortcuts',+ icon: <Keyboard size={14} color={Style.L1_FOREGROUND} />,+ dataTestId: 'keyboard-shortcuts-nav-item',+ },+ { type: 'divider' as const },+ {+ key: 'logout',+ label: (+ <span className="user-settings-dropdown-logout-section">Sign out</span>+ ),+ icon: (+ <LogOut+ size={14}+ className="user-settings-dropdown-logout-section"+ color={Style.DANGER_BACKGROUND}+ />+ ),+ dataTestId: 'logout-nav-item',+ },+ ].filter(Boolean);+/** Mapping of some newly added routes and their corresponding active sidebar menu key */export const NEW_ROUTES_MENU_ITEM_KEY_MAP: Record<string, string> = {[ROUTES.TRACE]: ROUTES.TRACES_EXPLORER,diff --git a/frontend/src/container/SideNav/sideNav.types.ts b/frontend/src/container/SideNav/sideNav.types.tsindex 93ea59c637..77e93be7da 100644--- a/frontend/src/container/SideNav/sideNav.types.ts+++ b/frontend/src/container/SideNav/sideNav.types.ts@@ -24,6 +24,13 @@ export interface SidebarItem {export const CHANGELOG_LABEL = 'Full Changelog';+export interface SettingsNavSection {+ title?: string;+ items: SidebarItem[];+ key: string;+ hasDivider?: boolean;+}+export interface DropdownSeparator {type: 'divider' | 'group';label?: ReactNode;diff --git a/frontend/src/pages/Settings/Settings.styles.scss b/frontend/src/pages/Settings/Settings.styles.scssindex 1f6c145017..2aee6c017e 100644--- a/frontend/src/pages/Settings/Settings.styles.scss+++ b/frontend/src/pages/Settings/Settings.styles.scss@@ -31,9 +31,33 @@.settings-page-sidenav {width: 240px;height: calc(100vh - 48px);- border-right: 1px solid var(--Slate-500, #161922);- background: var(--Ink-500, #0b0c0e);- margin-top: 4px;+ border-right: 1px solid var(--secondary);+ background: var(--sidebar-primary-foreground);+ padding-top: var(--padding-1);+ display: flex;+ flex-direction: column;+ gap: var(--spacing-12);+ overflow-y: auto;++ .settings-nav-section {+ display: flex;+ flex-direction: column;+ }++ .settings-nav-section--with-divider {+ border-top: 1px solid var(--secondary);+ padding-top: var(--padding-4);+ }++ .settings-nav-section-title {+ font-size: var(--uppercase-small-600-font-size);+ font-weight: var(--uppercase-small-600-font-weight);+ letter-spacing: 0.88px;+ text-transform: uppercase;+ color: var(--l3-foreground);+ margin-bottom: var(--margin-2);+ padding: var(--padding-1) var(--padding-3);+ }.nav-item {.nav-item-data {diff --git a/frontend/src/pages/Settings/Settings.tsx b/frontend/src/pages/Settings/Settings.tsxindex b8cce08a09..4e1a1c54cc 100644--- a/frontend/src/pages/Settings/Settings.tsx+++ b/frontend/src/pages/Settings/Settings.tsx@@ -7,7 +7,7 @@ import { FeatureKeys } from 'constants/features';import ROUTES from 'constants/routes';import { routeConfig } from 'container/SideNav/config';import { getQueryString } from 'container/SideNav/helper';-import { settingsMenuItems as defaultSettingsMenuItems } from 'container/SideNav/menuItems';+import { settingsNavSections } from 'container/SideNav/menuItems';import NavItem from 'container/SideNav/NavItem/NavItem';import { SidebarItem } from 'container/SideNav/sideNav.types';import useComponentPermission from 'hooks/useComponentPermission';@@ -33,7 +33,7 @@ function SettingsPage(): JSX.Element {const { isCloudUser, isEnterpriseSelfHostedUser } = useGetTenantLicense();const [settingsMenuItems, setSettingsMenuItems] = useState<SidebarItem[]>(- defaultSettingsMenuItems,+ settingsNavSections.flatMap((section) => section.items),);const isAdmin = user.role === USER_ROLES.ADMIN;@@ -252,25 +252,45 @@ function SettingsPage(): JSX.Element {<div className="settings-page-content-container"><div className="settings-page-sidenav" data-testid="settings-page-sidenav">- {settingsMenuItems- .filter((item) => item.isEnabled)- .map((item) => (- <NavItem- key={item.key}- item={item}- isActive={isActiveNavItem(item.key as string)}- isDisabled={false}- showIcon={false}- onClick={(event): void => {- logEvent('Settings V2: Menu clicked', {- menuLabel: item.label,- menuRoute: item.key,- });- handleMenuItemClick((event as unknown) as MouseEvent, item);- }}- dataTestId={item.itemKey}- />- ))}+ {settingsNavSections.map((section) => {+ const enabledItems = section.items.filter((sectionItem) =>+ settingsMenuItems.some(+ (item) => item.key === sectionItem.key && item.isEnabled,+ ),+ );+ if (enabledItems.length === 0) {+ return null;+ }+ return (+ <div+ key={section.key}+ className={`settings-nav-section${+ section.hasDivider ? ' settings-nav-section--with-divider' : ''+ }`}+ >+ {section.title && (+ <div className="settings-nav-section-title">{section.title}</div>+ )}+ {enabledItems.map((item) => (+ <NavItem+ key={item.key}+ item={item}+ isActive={isActiveNavItem(item.key as string)}+ isDisabled={false}+ showIcon={false}+ onClick={(event): void => {+ logEvent('Settings V2: Menu clicked', {+ menuLabel: item.label,+ menuRoute: item.key,+ });+ handleMenuItemClick((event as unknown) as MouseEvent, item);+ }}+ dataTestId={item.itemKey}+ />+ ))}+ </div>+ );+ })}</div><div className="settings-page-content">diff --git a/frontend/src/pages/Settings/__tests__/Settings.test.tsx b/frontend/src/pages/Settings/__tests__/Settings.test.tsxnew file mode 100644index 0000000000..c41c212a91--- /dev/null+++ b/frontend/src/pages/Settings/__tests__/Settings.test.tsx@@ -0,0 +1,137 @@+import React from 'react';+import SettingsPage from 'pages/Settings/Settings';+import { render, screen, within } from 'tests/test-utils';+import { LicensePlatform } from 'types/api/licensesV3/getActive';+import { USER_ROLES } from 'types/roles';++jest.mock('components/MarkdownRenderer/MarkdownRenderer', () => ({+ __esModule: true,+ default: ({ children }: { children: React.ReactNode }): React.ReactNode =>+ children,+}));++jest.mock('api/common/logEvent', () => ({+ __esModule: true,+ default: jest.fn(),+}));++jest.mock('lib/history', () => ({+ push: jest.fn(),+ listen: jest.fn(() => jest.fn()),+ location: { pathname: '/settings', search: '' },+}));++const getCloudAdminOverrides = (): any => ({+ activeLicense: {+ key: 'test-key',+ platform: LicensePlatform.CLOUD,+ },+});++const getSelfHostedAdminOverrides = (): any => ({+ activeLicense: {+ key: 'test-key',+ platform: LicensePlatform.SELF_HOSTED,+ },+});++describe('SettingsPage nav sections', () => {+ describe('Cloud Admin', () => {+ beforeEach(() => {+ render(<SettingsPage />, undefined, {+ role: USER_ROLES.ADMIN,+ appContextOverrides: getCloudAdminOverrides(),+ initialRoute: '/settings',+ });+ });++ it.each([+ 'settings-page-sidenav',+ 'workspace',+ 'account',+ 'notification-channels',+ 'billing',+ 'roles',+ 'api-keys',+ 'members-sso',+ 'integrations',+ 'ingestion',+ ])('renders "%s" element', (id) => {+ expect(screen.getByTestId(id)).toBeInTheDocument();+ });++ it.each(['Identity & Access', 'Authentication'])(+ 'renders "%s" section title',+ (text) => {+ expect(screen.getByText(text)).toBeInTheDocument();+ },+ );+ });++ describe('Cloud Viewer', () => {+ beforeEach(() => {+ render(<SettingsPage />, undefined, {+ role: USER_ROLES.VIEWER,+ appContextOverrides: getCloudAdminOverrides(),+ initialRoute: '/settings',+ });+ });++ it.each(['workspace', 'account'])('renders "%s" element', (id) => {+ expect(screen.getByTestId(id)).toBeInTheDocument();+ });++ it.each(['billing', 'roles', 'api-keys'])(+ 'does not render "%s" element',+ (id) => {+ expect(screen.queryByTestId(id)).not.toBeInTheDocument();+ },+ );+ });++ describe('Self-hosted Admin', () => {+ beforeEach(() => {+ render(<SettingsPage />, undefined, {+ role: USER_ROLES.ADMIN,+ appContextOverrides: getSelfHostedAdminOverrides(),+ initialRoute: '/settings',+ });+ });++ it.each(['roles', 'api-keys', 'integrations', 'members-sso', 'ingestion'])(+ 'renders "%s" element',+ (id) => {+ expect(screen.getByTestId(id)).toBeInTheDocument();+ },+ );+ });++ describe('section structure', () => {+ it('renders items in correct sections for cloud admin', () => {+ const { container } = render(<SettingsPage />, undefined, {+ role: USER_ROLES.ADMIN,+ appContextOverrides: getCloudAdminOverrides(),+ initialRoute: '/settings',+ });++ const sidenav = within(container).getByTestId('settings-page-sidenav');+ const sections = sidenav.querySelectorAll('.settings-nav-section');++ // Should have at least 2 sections (general + identity-access) for cloud admin+ expect(sections.length).toBeGreaterThanOrEqual(2);+ });++ it('hides section entirely when all items in it are disabled', () => {+ // Community user has very limited access — identity section should be hidden+ render(<SettingsPage />, undefined, {+ role: USER_ROLES.VIEWER,+ appContextOverrides: {+ activeLicense: null,+ },+ initialRoute: '/settings',+ });++ expect(screen.queryByText('IDENTITY & ACCESS')).not.toBeInTheDocument();+ });+ });+});