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(alerts): add configuration sidebar for channels, routing policies, and planned downtime (#13230)
ashu8912bfbdab95a3c7
diff --git a/frontend/src/container/AIAssistant/__tests__/getAutoContexts.test.ts b/frontend/src/container/AIAssistant/__tests__/getAutoContexts.test.tsindex 1a9c37c791..ba6135302e 100644--- a/frontend/src/container/AIAssistant/__tests__/getAutoContexts.test.ts+++ b/frontend/src/container/AIAssistant/__tests__/getAutoContexts.test.ts@@ -147,6 +147,28 @@ describe('getAutoContexts', () => {metadata: { page: 'alert_list' },},]);++ expect(+ getAutoContexts(ROUTES.LIST_ALL_ALERT, '?tab=RoutingPolicies'),+ ).toStrictEqual([+ {+ source: 'auto',+ type: 'alert',+ resourceId: null,+ metadata: { page: 'alert_list' },+ },+ ]);++ expect(+ getAutoContexts(ROUTES.LIST_ALL_ALERT, '?tab=PlannedDowntime'),+ ).toStrictEqual([+ {+ source: 'auto',+ type: 'alert',+ resourceId: null,+ metadata: { page: 'alert_list' },+ },+ ]);});it('returns dashboard detail context on dashboard page', () => {diff --git a/frontend/src/container/AIAssistant/__tests__/resolvePageType.test.ts b/frontend/src/container/AIAssistant/__tests__/resolvePageType.test.tsindex f6697a2a0b..d30170f96a 100644--- a/frontend/src/container/AIAssistant/__tests__/resolvePageType.test.ts+++ b/frontend/src/container/AIAssistant/__tests__/resolvePageType.test.ts@@ -58,6 +58,12 @@ describe('resolvePageType', () => {expect(resolvePageType(ROUTES.LIST_ALL_ALERT, '?tab=Configuration')).toBe(PageTypeDTO.alert_list,);+ expect(resolvePageType(ROUTES.LIST_ALL_ALERT, '?tab=RoutingPolicies')).toBe(+ PageTypeDTO.alert_list,+ );+ expect(resolvePageType(ROUTES.LIST_ALL_ALERT, '?tab=PlannedDowntime')).toBe(+ PageTypeDTO.alert_list,+ );});it('returns log_detail when logs explorer has activeLogId', () => {diff --git a/frontend/src/pages/AlertList/AlertList.styles.scss b/frontend/src/pages/AlertList/AlertList.styles.scssindex 5bad3c38cf..28044b5072 100644--- a/frontend/src/pages/AlertList/AlertList.styles.scss+++ b/frontend/src/pages/AlertList/AlertList.styles.scss@@ -1,7 +1,7 @@.alerts-container {// Hands the page height down to the active tab so its content can bound itself// instead of guessing with 100vh. Child combinators only, nested Tabs- // (Configuration) must not be caught.+ // (e.g. the alert history timeline) must not be caught.flex: 1;min-height: 0;@@ -55,14 +55,6 @@}}- .configuration-tabs {- .ant-tabs-nav {- .ant-tabs-nav-wrap {- padding: 0 8px;- }- }- }-.alert-rules-container {margin-top: 10px;flex: 1;@@ -70,4 +62,82 @@display: flex;flex-direction: column;}++ .alert-configuration-container {+ flex: 1;+ min-height: 0;+ display: flex;+ flex-direction: row;+ align-items: stretch;++ .alert-configuration-sidebar {+ width: 240px;+ flex-shrink: 0;+ border-right: 1px solid var(--l1-border);+ background: var(--l1-background);+ padding: 12px 8px;+ display: flex;+ flex-direction: column;+ gap: 2px;+ overflow-y: auto;++ .sidebar-nav-item {+ display: flex;+ align-items: center;+ width: 100%;+ height: 32px;+ padding: 0 8px;+ margin: 0;+ border: none;+ border-radius: var(--radius-2, 4px);+ background: transparent;+ color: var(--l2-foreground);+ font-family: inherit;+ font-size: 13px;+ font-weight: var(--font-weight-normal, 400);+ line-height: 18px;+ text-align: left;+ cursor: pointer;+ transition:+ background 0.12s ease,+ color 0.12s ease;++ &:hover {+ background: var(--l1-background-hover);+ color: var(--l1-foreground);+ }++ &.active {+ background: var(--l1-background-hover);+ color: var(--l1-foreground);+ font-weight: var(--font-weight-medium, 500);+ }++ &:focus-visible {+ outline: 2px solid var(--primary-background);+ outline-offset: -1px;+ }++ .sidebar-nav-item-label {+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ color: inherit;+ }+ }+ }++ .alert-configuration-content {+ flex: 1;+ min-width: 0;+ min-height: 0;+ display: flex;+ flex-direction: column;+ overflow: hidden;++ > .alert-rules-container {+ margin-top: 0;+ }+ }+ }}diff --git a/frontend/src/pages/AlertList/PlannedDowntime/stories/PlannedDowntime.stories.tsx b/frontend/src/pages/AlertList/PlannedDowntime/stories/PlannedDowntime.stories.tsxindex 06bbbe38da..7088ab0e35 100644--- a/frontend/src/pages/AlertList/PlannedDowntime/stories/PlannedDowntime.stories.tsx+++ b/frontend/src/pages/AlertList/PlannedDowntime/stories/PlannedDowntime.stories.tsx@@ -21,7 +21,7 @@ const pageStory = storyMocks(plannedDowntimeMocks, { layout: 'app' });* Windows that silence rules on a schedule, one off or recurring, with the rules* each window covers.*- * Route: `/alerts?tab=Configuration&subTab=PlannedDowntime`.+ * Route: `/alerts?tab=Configuration&subTab=planned-downtime`.*/const meta = {title: 'Pages/Alerts/Planned Downtime',diff --git a/frontend/src/pages/AlertList/RoutingPolicies/stories/RoutingPolicies.stories.tsx b/frontend/src/pages/AlertList/RoutingPolicies/stories/RoutingPolicies.stories.tsxindex 831e80f6e3..cdfeab6240 100644--- a/frontend/src/pages/AlertList/RoutingPolicies/stories/RoutingPolicies.stories.tsx+++ b/frontend/src/pages/AlertList/RoutingPolicies/stories/RoutingPolicies.stories.tsx@@ -22,7 +22,7 @@ const pageStory = storyMocks(routingPoliciesMocks, { layout: 'app' });* Policies that route a firing alert to channels by expression, in the order they* are evaluated.*- * Route: `/alerts?tab=Configuration&subTab=RoutingPolicies`.+ * Route: `/alerts?tab=Configuration&subTab=routing-policies`.*/const meta = {title: 'Pages/Alerts/Routing Policies',diff --git a/frontend/src/pages/AlertList/__tests__/AlertList.test.tsx b/frontend/src/pages/AlertList/__tests__/AlertList.test.tsxindex 43dd75d769..520eb9aaa6 100644--- a/frontend/src/pages/AlertList/__tests__/AlertList.test.tsx+++ b/frontend/src/pages/AlertList/__tests__/AlertList.test.tsx@@ -8,8 +8,10 @@ const LIST_ALERT_RULES_TEXT = 'List Alert Rules Component';const TRIGGERED_ALERTS_TEXT = 'Triggered Alerts';const ALERT_RULES_TEXT = 'Alert Rules';const CONFIGURATION_TEXT = 'Configuration';+const NOTIFICATION_CHANNELS_TEXT = 'Notification Channels';const PLANNED_DOWNTIME_TEXT = 'Planned Downtime';const ROUTING_POLICIES_TEXT = 'Routing Policies';+const CHANNELS_SUB_TAB = 'channels';const PLANNED_DOWNTIME_SUB_TAB = 'planned-downtime';const ROUTING_POLICIES_SUB_TAB = 'routing-policies';@@ -45,6 +47,12 @@ jest.mock('pages/AlertDetails', () => ({return <div>Alert Details Component</div>;},}));+jest.mock('../NotificationChannels/NotificationChannels', () => ({+ __esModule: true,+ default: function MockNotificationChannels(): JSX.Element {+ return <div>Notification Channels Component</div>;+ },+}));jest.mock('container/PlannedDowntime/PlannedDowntime', () => ({PlannedDowntime: function MockPlannedDowntime(): JSX.Element {return <div>Planned Downtime Component</div>;@@ -137,15 +145,6 @@ describe('AlertList', () => {expect(screen.getByText(LIST_ALERT_RULES_TEXT)).toBeInTheDocument();});- it('should render Configuration tab with default Planned Downtime sub-tab when tab query param is Configuration', () => {- mockQueryParams({ tab: 'Configuration' });- mockLocation(ALERTS_PATH);-- render(<AlertList />);-- expect(screen.getByText(PLANNED_DOWNTIME_TEXT)).toBeInTheDocument();- });-it('should navigate to TriggeredAlerts tab when clicked', () => {mockQueryParams({ tab: 'AlertRules' });mockLocation(ALERTS_PATH);@@ -167,74 +166,109 @@ describe('AlertList', () => {expect(mockSafeNavigate).toHaveBeenCalledWith('/alerts?tab=AlertRules');});++ it('should navigate to Configuration tab with default channels subTab when clicked', () => {+ mockQueryParams({ tab: 'AlertRules' });+ mockLocation(ALERTS_PATH);++ render(<AlertList />);++ clickTab(CONFIGURATION_TEXT);++ expect(mockSafeNavigate).toHaveBeenCalledWith(+ `/alerts?tab=Configuration&subTab=${CHANNELS_SUB_TAB}`,+ );+ });});- describe('Configuration Tab', () => {- describe('Rendering', () => {- it('should render Configuration tab with default Planned Downtime sub-tab', () => {- mockQueryParams({ tab: CONFIGURATION_TEXT });- mockLocation(ALERTS_PATH);+ describe('Configuration Tab with Secondary Sidebar', () => {+ it('should render Configuration tab with secondary sidebar containing channels, routing policies, and planned downtime', () => {+ mockQueryParams({ tab: 'Configuration' });+ mockLocation(ALERTS_PATH);++ render(<AlertList />);- render(<AlertList />);+ expect(+ screen.getByTestId('alert-configuration-sidebar'),+ ).toBeInTheDocument();+ expect(screen.getByText(NOTIFICATION_CHANNELS_TEXT)).toBeInTheDocument();+ expect(screen.getByText(ROUTING_POLICIES_TEXT)).toBeInTheDocument();+ expect(screen.getByText(PLANNED_DOWNTIME_TEXT)).toBeInTheDocument();+ expect(+ screen.getByText('Notification Channels Component'),+ ).toBeInTheDocument();+ });- expect(screen.getByText(PLANNED_DOWNTIME_TEXT)).toBeInTheDocument();- expect(screen.getByText(ROUTING_POLICIES_TEXT)).toBeInTheDocument();- expect(screen.getByText('Planned Downtime Component')).toBeInTheDocument();+ it('should render Routing Policies when subTab is routing-policies', () => {+ mockQueryParams({+ tab: 'Configuration',+ subTab: ROUTING_POLICIES_SUB_TAB,});+ mockLocation(ALERTS_PATH);- it('should render Routing Policies sub-tab when subTab query param is routing-policies', () => {- mockQueryParams({- tab: CONFIGURATION_TEXT,- subTab: ROUTING_POLICIES_SUB_TAB,- });- mockLocation(ALERTS_PATH);+ render(<AlertList />);- render(<AlertList />);+ expect(screen.getByText('Routing Policies Component')).toBeInTheDocument();+ });- expect(screen.getByText('Routing Policies Component')).toBeInTheDocument();+ it('should render Planned Downtime when subTab is planned-downtime', () => {+ mockQueryParams({+ tab: 'Configuration',+ subTab: PLANNED_DOWNTIME_SUB_TAB,});+ mockLocation(ALERTS_PATH);++ render(<AlertList />);++ expect(screen.getByText('Planned Downtime Component')).toBeInTheDocument();});- describe('Navigation', () => {- it('should navigate to Configuration tab with default subTab when clicked', () => {- mockQueryParams({ tab: 'AlertRules' });- mockLocation(ALERTS_PATH);+ it('should navigate to Routing Policies subtab when clicked in secondary sidebar', () => {+ mockQueryParams({ tab: 'Configuration', subTab: CHANNELS_SUB_TAB });+ mockLocation(ALERTS_PATH);- render(<AlertList />);+ render(<AlertList />);- clickTab(CONFIGURATION_TEXT);+ fireEvent.click(+ screen.getByTestId('configuration-sidebar-routing-policies'),+ );- expect(mockSafeNavigate).toHaveBeenCalledWith(- `/alerts?tab=Configuration&subTab=${PLANNED_DOWNTIME_SUB_TAB}`,- );- });+ expect(mockSafeNavigate).toHaveBeenCalledWith(+ `/alerts?tab=Configuration&subTab=${ROUTING_POLICIES_SUB_TAB}`,+ );+ });- it('should preserve existing subTab when navigating to Configuration tab', () => {- mockQueryParams({ tab: 'AlertRules', subTab: ROUTING_POLICIES_SUB_TAB });- mockLocation(ALERTS_PATH);+ it('should navigate to Planned Downtime subtab when clicked in secondary sidebar', () => {+ mockQueryParams({ tab: 'Configuration', subTab: CHANNELS_SUB_TAB });+ mockLocation(ALERTS_PATH);- render(<AlertList />);+ render(<AlertList />);- clickTab(CONFIGURATION_TEXT);+ fireEvent.click(+ screen.getByTestId('configuration-sidebar-planned-downtime'),+ );- expect(mockSafeNavigate).toHaveBeenCalledWith(- `/alerts?tab=Configuration&subTab=${ROUTING_POLICIES_SUB_TAB}`,- );- });+ expect(mockSafeNavigate).toHaveBeenCalledWith(+ `/alerts?tab=Configuration&subTab=${PLANNED_DOWNTIME_SUB_TAB}`,+ );+ });++ it('should support legacy RoutingPolicies query param as Configuration tab', () => {+ mockQueryParams({ tab: 'RoutingPolicies' });+ mockLocation(ALERTS_PATH);- it('should clear subTab when navigating away from Configuration tab', () => {- mockQueryParams({- tab: CONFIGURATION_TEXT,- subTab: PLANNED_DOWNTIME_SUB_TAB,- });- mockLocation(ALERTS_PATH);+ render(<AlertList />);++ expect(screen.getByText('Routing Policies Component')).toBeInTheDocument();+ });- render(<AlertList />);+ it('should support legacy PlannedDowntime query param as Configuration tab', () => {+ mockQueryParams({ tab: 'PlannedDowntime' });+ mockLocation(ALERTS_PATH);- clickTab(ALERT_RULES_TEXT);+ render(<AlertList />);- expect(mockSafeNavigate).toHaveBeenCalledWith('/alerts?tab=AlertRules');- });+ expect(screen.getByText('Planned Downtime Component')).toBeInTheDocument();});});});diff --git a/frontend/src/pages/AlertList/index.tsx b/frontend/src/pages/AlertList/index.tsxindex 6410e5e37b..6d8774410c 100644--- a/frontend/src/pages/AlertList/index.tsx+++ b/frontend/src/pages/AlertList/index.tsx@@ -10,7 +10,8 @@ import RoutingPolicies from 'container/RoutingPolicies';import TriggeredAlerts from 'container/TriggeredAlerts';import { useSafeNavigate } from 'hooks/useSafeNavigate';import useUrlQuery from 'hooks/useUrlQuery';-import { Cable, GalleryVerticalEnd, Pyramid } from '@signozhq/icons';+import { GalleryVerticalEnd, Pyramid } from '@signozhq/icons';+import cx from 'classnames';import AlertDetails from 'pages/AlertDetails';import ChannelsEdit from 'pages/ChannelsEdit';import ChannelsNew from 'pages/ChannelsNew';@@ -21,6 +22,30 @@ import { AlertListSubTabs, AlertListTabs } from './types';import './AlertList.styles.scss';+interface ConfigurationSidebarItem {+ key: AlertListSubTabs;+ label: string;+ itemKey: string;+}++const CONFIGURATION_SIDEBAR_ITEMS: ConfigurationSidebarItem[] = [+ {+ key: AlertListSubTabs.CHANNELS,+ label: 'Notification Channels',+ itemKey: 'configuration-sidebar-channels',+ },+ {+ key: AlertListSubTabs.ROUTING_POLICIES,+ label: 'Routing Policies',+ itemKey: 'configuration-sidebar-routing-policies',+ },+ {+ key: AlertListSubTabs.PLANNED_DOWNTIME,+ label: 'Planned Downtime',+ itemKey: 'configuration-sidebar-planned-downtime',+ },+];+function AllAlertList(): JSX.Element {const urlQuery = useUrlQuery();const location = useLocation();@@ -34,39 +59,126 @@ function AllAlertList(): JSX.Element {const isChannelsEdit = location.pathname.startsWith('/alerts/channels/edit/');const isChannelDetails = isChannelsNew || isChannelsEdit;- const handleConfigurationTabChange = useCallback(- (subTab: string): void => {+ const getActiveTab = useCallback((): string => {+ if (isAlertHistory || isAlertOverview) {+ return AlertListTabs.ALERT_RULES;+ }+ if (isChannelDetails) {+ return AlertListTabs.CONFIGURATION;+ }+ if (+ tab === AlertListTabs.CHANNELS ||+ tab === AlertListTabs.ROUTING_POLICIES ||+ tab === AlertListTabs.PLANNED_DOWNTIME+ ) {+ return AlertListTabs.CONFIGURATION;+ }+ return tab || AlertListTabs.ALERT_RULES;+ }, [isAlertHistory, isAlertOverview, isChannelDetails, tab]);++ const getActiveSubTab = useCallback((): AlertListSubTabs => {+ if (isChannelDetails) {+ return AlertListSubTabs.CHANNELS;+ }+ if (tab === AlertListTabs.CHANNELS) {+ return AlertListSubTabs.CHANNELS;+ }+ if (tab === AlertListTabs.ROUTING_POLICIES) {+ return AlertListSubTabs.ROUTING_POLICIES;+ }+ if (tab === AlertListTabs.PLANNED_DOWNTIME) {+ return AlertListSubTabs.PLANNED_DOWNTIME;+ }+ if (+ subTab === AlertListSubTabs.CHANNELS ||+ subTab === AlertListSubTabs.ROUTING_POLICIES ||+ subTab === AlertListSubTabs.PLANNED_DOWNTIME+ ) {+ return subTab;+ }+ return AlertListSubTabs.CHANNELS;+ }, [isChannelDetails, tab, subTab]);++ const handleTopTabChange = useCallback(+ (newTab: string): void => {const queryParams = new URLSearchParams();+ queryParams.set('tab', newTab);++ if (newTab === AlertListTabs.CONFIGURATION) {+ const currentSubTab = getActiveSubTab();+ queryParams.set('subTab', currentSubTab);+ }++ safeNavigate(`/alerts?${queryParams.toString()}`);+ },+ [getActiveSubTab, safeNavigate],+ );+ const handleSubTabChange = useCallback(+ (newSubTab: AlertListSubTabs): void => {+ const queryParams = new URLSearchParams();queryParams.set('tab', AlertListTabs.CONFIGURATION);- queryParams.set('subTab', subTab);+ queryParams.set('subTab', newSubTab);safeNavigate(`/alerts?${queryParams.toString()}`);},[safeNavigate],);- const configurationTab = useMemo(() => {- const tabs = [- {- label: 'Planned Downtime',- key: AlertListSubTabs.PLANNED_DOWNTIME,- children: <PlannedDowntime />,- },- {- label: 'Routing Policies',- key: AlertListSubTabs.ROUTING_POLICIES,- children: <RoutingPolicies />,- },- ];- return (- <Tabs- className="configuration-tabs"- activeKey={subTab || AlertListSubTabs.PLANNED_DOWNTIME}- items={tabs}- onChange={handleConfigurationTabChange}- />- );- }, [subTab, handleConfigurationTabChange]);+ const activeSubTab = getActiveSubTab();++ const configurationTab = useMemo(+ () => (+ <div className="alert-configuration-container">+ <div+ className="alert-configuration-sidebar"+ data-testid="alert-configuration-sidebar"+ >+ {CONFIGURATION_SIDEBAR_ITEMS.map((item) => (+ <button+ key={item.key}+ type="button"+ className={cx('sidebar-nav-item', {+ active: activeSubTab === item.key,+ })}+ onClick={(): void => handleSubTabChange(item.key)}+ data-testid={item.itemKey}+ >+ <span className="sidebar-nav-item-label">{item.label}</span>+ </button>+ ))}+ </div>+ <div+ className="alert-configuration-content"+ data-testid="alert-configuration-content"+ >+ {activeSubTab === AlertListSubTabs.CHANNELS && (+ <div className="alert-rules-container">+ {isChannelsNew && <ChannelsNew />}+ {isChannelsEdit && <ChannelsEdit />}+ {!isChannelDetails && <NotificationChannels />}+ </div>+ )}+ {activeSubTab === AlertListSubTabs.ROUTING_POLICIES && (+ <div className="alert-rules-container">+ <RoutingPolicies />+ </div>+ )}+ {activeSubTab === AlertListSubTabs.PLANNED_DOWNTIME && (+ <div className="alert-rules-container">+ <PlannedDowntime />+ </div>+ )}+ </div>+ </div>+ ),+ [+ activeSubTab,+ handleSubTabChange,+ isChannelsNew,+ isChannelsEdit,+ isChannelDetails,+ ],+ );const items: TabsProps['items'] = [{@@ -93,22 +205,6 @@ function AllAlertList(): JSX.Element {</div>),},- {- label: (- <div className="periscope-tab top-level-tab">- <Cable size={14} />- Notification Channels- </div>- ),- key: AlertListTabs.CHANNELS,- children: (- <div className="alert-rules-container">- {isChannelsNew && <ChannelsNew />}- {isChannelsEdit && <ChannelsEdit />}- {!isChannelDetails && <NotificationChannels />}- </div>- ),- },{label: (<div className="periscope-tab top-level-tab">@@ -121,37 +217,12 @@ function AllAlertList(): JSX.Element {},];- const getActiveKey = (): string => {- if (isAlertHistory || isAlertOverview) {- return AlertListTabs.ALERT_RULES;- }- if (isChannelDetails) {- return AlertListTabs.CHANNELS;- }- return tab || AlertListTabs.ALERT_RULES;- };-return (<TabsdestroyInactiveTabPaneitems={items}- activeKey={getActiveKey()}- onChange={(tab): void => {- const queryParams = new URLSearchParams();-- queryParams.set('tab', tab);-- // If navigating to Configuration tab, set default subTab- if (tab === AlertListTabs.CONFIGURATION) {- const currentSubTab = subTab || AlertListSubTabs.PLANNED_DOWNTIME;- queryParams.set('subTab', currentSubTab);- } else {- // Clear subTab when navigating out of Configuration tab- queryParams.delete('subTab');- }-- safeNavigate(`/alerts?${queryParams.toString()}`);- }}+ activeKey={getActiveTab()}+ onChange={handleTopTabChange}className={`alerts-container ${isAlertHistory || isAlertOverview || isChannelDetails? 'alert-details-tabs'diff --git a/frontend/src/pages/AlertList/types.ts b/frontend/src/pages/AlertList/types.tsindex af0e7c8e6a..c10950e83c 100644--- a/frontend/src/pages/AlertList/types.ts+++ b/frontend/src/pages/AlertList/types.ts@@ -1,6 +1,7 @@export enum AlertListSubTabs {- PLANNED_DOWNTIME = 'planned-downtime',+ CHANNELS = 'channels',ROUTING_POLICIES = 'routing-policies',+ PLANNED_DOWNTIME = 'planned-downtime',}export enum AlertListTabs {@@ -8,4 +9,6 @@ export enum AlertListTabs {ALERT_RULES = 'AlertRules',CONFIGURATION = 'Configuration',CHANNELS = 'Channels',+ ROUTING_POLICIES = 'RoutingPolicies',+ PLANNED_DOWNTIME = 'PlannedDowntime',}diff --git a/tests/e2e/helpers/alert-forms/constants.ts b/tests/e2e/helpers/alert-forms/constants.tsindex 1a9b7793c4..645b62ce6b 100644--- a/tests/e2e/helpers/alert-forms/constants.ts+++ b/tests/e2e/helpers/alert-forms/constants.ts@@ -65,7 +65,7 @@ export const ThresholdMatchType = {} as const;/**- * `AlertListTabs` (`frontend/src/pages/AlertList/types.ts:7-9`). The values are+ * `AlertListTabs` (`frontend/src/pages/AlertList/types.ts`). The values are* space-less — the tab *labels* read "Triggered Alerts" but the `tab` URL param* is `TriggeredAlerts`, and asserting the label form silently fails.*/@@ -73,6 +73,9 @@ export const AlertListTab = {TRIGGERED_ALERTS: 'TriggeredAlerts',ALERT_RULES: 'AlertRules',CONFIGURATION: 'Configuration',+ CHANNELS: 'Channels',+ ROUTING_POLICIES: 'RoutingPolicies',+ PLANNED_DOWNTIME: 'PlannedDowntime',} as const;/**diff --git a/tests/e2e/tests/alerts/create/v2.spec.ts b/tests/e2e/tests/alerts/create/v2.spec.tsindex bd41d09150..7077e05dbd 100644--- a/tests/e2e/tests/alerts/create/v2.spec.ts+++ b/tests/e2e/tests/alerts/create/v2.spec.ts@@ -381,6 +381,7 @@ test.describe('Alert create — v2 builder', () => {const url = new URL(page.url());expect(url.pathname).toBe('/alerts');expect(url.searchParams.get('tab')).toBe('Configuration');+ expect(url.searchParams.get('subTab')).toBe('routing-policies');});test('CV2-16 the group-by select is disabled until the query groups by something', async ({diff --git a/tests/e2e/tests/alerts/page.spec.ts b/tests/e2e/tests/alerts/page.spec.tsindex 197ff4930a..31291162d0 100644--- a/tests/e2e/tests/alerts/page.spec.ts+++ b/tests/e2e/tests/alerts/page.spec.ts@@ -2,7 +2,7 @@ import { expect, test } from '../../fixtures/alerts/alert-rules';import { ALERTS_LIST_PATH } from '../../helpers/alerts/constants';import { watchConsole } from '../../helpers/common';-// TC-* — the Alerts page shell: the four top-level tabs, how they map to+// TC-* — the Alerts page shell: the top-level tabs, how they map to// `?tab=`, and a navigation smoke check per tab. Tab *internals* (channel CRUD,// planned downtime, routing policies) are deliberately out of scope — each// deserves its own spec file.@@ -10,12 +10,11 @@ import { watchConsole } from '../../helpers/common';const TAB_NAMES = {triggered: /triggered alerts/i,rules: /alert rules/i,- channels: /notification channels/i,configuration: /configuration/i,};test.describe('Alerts page shell', () => {- test('TC-01 all four top-level tabs render', async ({ authedPage: page }) => {+ test('TC-01 all top-level tabs render', async ({ authedPage: page }) => {await page.goto(ALERTS_LIST_PATH);for (const name of Object.values(TAB_NAMES)) {@@ -43,43 +42,53 @@ test.describe('Alerts page shell', () => {).toBeVisible();});- test('TC-03 tab switch writes ?tab= and clears subTab', async ({- authedPage: page,- }) => {+ test('TC-03 tab switch writes ?tab=', async ({ authedPage: page }) => {await page.goto(ALERTS_LIST_PATH);await page.getByRole('tab', { name: TAB_NAMES.triggered }).click();await expect(page).toHaveURL(/[?&]tab=TriggeredAlerts/);- await page.getByRole('tab', { name: TAB_NAMES.channels }).click();- await expect(page).toHaveURL(/[?&]tab=Channels/);-- // Entering Configuration adds the default subTab...await page.getByRole('tab', { name: TAB_NAMES.configuration }).click();await expect(page).toHaveURL(/[?&]tab=Configuration/);- await expect(page).toHaveURL(/[?&]subTab=planned-downtime/);+ await expect(page).toHaveURL(/[?&]subTab=channels/);- // ...and leaving it drops subTab entirely (onChange rebuilds the search- // from scratch rather than mutating the existing params).await page.getByRole('tab', { name: TAB_NAMES.rules }).click();await expect(page).toHaveURL(/[?&]tab=AlertRules/);- await expect(page).not.toHaveURL(/subTab=/);});- test('TC-04 Configuration deep-link', async ({ authedPage: page }) => {- // Deep-linking without subTab: the inner Tabs falls back to- // planned-downtime for its activeKey without writing it to the URL, so- // assert the rendered tab, not the param.- await page.goto(`${ALERTS_LIST_PATH}?tab=Configuration`);+ test('TC-04 Configuration sub-tab deep-links and sidebar navigation', async ({+ authedPage: page,+ }) => {+ await page.goto(+ `${ALERTS_LIST_PATH}?tab=Configuration&subTab=routing-policies`,+ );await expect(- page.getByRole('tab', { name: /planned downtime/i }),+ page.getByRole('tab', { name: TAB_NAMES.configuration }),).toHaveAttribute('aria-selected', 'true');+ await expect(page.getByTestId('alert-configuration-sidebar')).toBeVisible();+ await expect(+ page.getByTestId('configuration-sidebar-routing-policies'),+ ).toBeVisible();await page.goto(- `${ALERTS_LIST_PATH}?tab=Configuration&subTab=routing-policies`,+ `${ALERTS_LIST_PATH}?tab=Configuration&subTab=planned-downtime`,);await expect(- page.getByRole('tab', { name: /routing policies/i }),+ page.getByRole('tab', { name: TAB_NAMES.configuration }),+ ).toHaveAttribute('aria-selected', 'true');+ await expect(+ page.getByTestId('configuration-sidebar-planned-downtime'),+ ).toBeVisible();++ // Backwards-compatible legacy deep links+ await page.goto(`${ALERTS_LIST_PATH}?tab=RoutingPolicies`);+ await expect(+ page.getByRole('tab', { name: TAB_NAMES.configuration }),+ ).toHaveAttribute('aria-selected', 'true');++ await page.goto(`${ALERTS_LIST_PATH}?tab=PlannedDowntime`);+ await expect(+ page.getByRole('tab', { name: TAB_NAMES.configuration }),).toHaveAttribute('aria-selected', 'true');});@@ -102,13 +111,16 @@ test.describe('Alerts page shell', () => {expect(watch.failedResponses).toEqual([]);});- test('TC-06 Notification Channels tab smoke', async ({+ test('TC-06 Notification Channels smoke under Configuration', async ({authedPage: page,alertChannel,}) => {// The worker's channel gives this tab a row to render.- await page.goto(`${ALERTS_LIST_PATH}?tab=Channels`);+ await page.goto(`${ALERTS_LIST_PATH}?tab=Configuration&subTab=channels`);+ await expect(+ page.getByTestId('configuration-sidebar-channels'),+ ).toBeVisible();await expect(page.getByText(alertChannel.name)).toBeVisible();await expect(page.getByRole('button', { name: /new channel/i }),@@ -116,16 +128,17 @@ test.describe('Alerts page shell', () => {});test('TC-07 tab state survives reload', async ({ authedPage: page }) => {- await page.goto(`${ALERTS_LIST_PATH}?tab=Channels`);+ await page.goto(`${ALERTS_LIST_PATH}?tab=Configuration&subTab=channels`);await expect(- page.getByRole('tab', { name: TAB_NAMES.channels }),+ page.getByRole('tab', { name: TAB_NAMES.configuration }),).toHaveAttribute('aria-selected', 'true');await page.reload();- await expect(page).toHaveURL(/[?&]tab=Channels/);+ await expect(page).toHaveURL(/[?&]tab=Configuration/);+ await expect(page).toHaveURL(/[?&]subTab=channels/);await expect(- page.getByRole('tab', { name: TAB_NAMES.channels }),+ page.getByRole('tab', { name: TAB_NAMES.configuration }),).toHaveAttribute('aria-selected', 'true');});});