Skip to content

Commit 2faaca2

Browse files
authored
feat(aci): redirect alerts nav to monitors (#103325)
similar to #103129, redirects users with the `workflow-engine-ui` flag who click on Issues > Alerts to the All Monitors list with a banner <img width="1381" height="332" alt="Screenshot 2025-11-13 at 11 56 52 AM" src="https://github.com/user-attachments/assets/00194e9e-1f85-4f23-9858-3c54a4c9e09a" />
1 parent 2828729 commit 2faaca2

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

static/app/views/detectors/list/allMonitors.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
22
import WorkflowEngineListLayout from 'sentry/components/workflowEngine/layout/list';
33
import {t} from 'sentry/locale';
4+
import {AlertsRedirectNotice} from 'sentry/views/detectors/list/common/alertsRedirectNotice';
45
import {DetectorListActions} from 'sentry/views/detectors/list/common/detectorListActions';
56
import {DetectorListContent} from 'sentry/views/detectors/list/common/detectorListContent';
67
import {DetectorListHeader} from 'sentry/views/detectors/list/common/detectorListHeader';
@@ -23,6 +24,9 @@ export default function AllMonitors() {
2324
description={DESCRIPTION}
2425
docsUrl={DOCS_URL}
2526
>
27+
<AlertsRedirectNotice>
28+
{t('Alert Rules have been moved to Monitors and Alerts.')}
29+
</AlertsRedirectNotice>
2630
<DetectorListHeader />
2731
<DetectorListContent {...detectorListQuery} />
2832
</WorkflowEngineListLayout>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {parseAsBoolean, useQueryState} from 'nuqs';
2+
3+
import {Alert} from '@sentry/scraps/alert';
4+
import {Button} from '@sentry/scraps/button';
5+
6+
import {IconClose} from 'sentry/icons';
7+
import {t} from 'sentry/locale';
8+
9+
export function AlertsRedirectNotice({children}: {children: React.ReactNode}) {
10+
const [wasRedirectedFromAlerts, setWasRedirectedFromAlerts] = useQueryState(
11+
'alertsRedirect',
12+
parseAsBoolean.withOptions({history: 'replace'}).withDefault(false)
13+
);
14+
15+
if (!wasRedirectedFromAlerts) {
16+
return null;
17+
}
18+
19+
return (
20+
<Alert
21+
type="info"
22+
trailingItems={
23+
<Button
24+
size="zero"
25+
borderless
26+
icon={<IconClose />}
27+
aria-label={t('Dismiss')}
28+
onClick={() => {
29+
setWasRedirectedFromAlerts(false);
30+
}}
31+
/>
32+
}
33+
>
34+
{children}
35+
</Alert>
36+
);
37+
}

static/app/views/nav/secondary/sections/issues/issuesSecondaryNav.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import styled from '@emotion/styled';
44

55
import {t} from 'sentry/locale';
66
import useOrganization from 'sentry/utils/useOrganization';
7+
import {useUser} from 'sentry/utils/useUser';
8+
import {makeMonitorBasePathname} from 'sentry/views/detectors/pathnames';
79
import {ISSUE_TAXONOMY_CONFIG} from 'sentry/views/issueList/taxonomies';
810
import {useNavContext} from 'sentry/views/nav/context';
911
import {PRIMARY_NAV_GROUP_CONFIG} from 'sentry/views/nav/primary/config';
@@ -81,9 +83,18 @@ export function IssuesSecondaryNav() {
8183
}
8284

8385
function ConfigureSection({baseUrl}: {baseUrl: string}) {
86+
const user = useUser();
87+
const organization = useOrganization();
8488
const {layout} = useNavContext();
8589
const isSticky = layout === NavLayout.SIDEBAR;
8690

91+
const shouldRedirectToWorkflowEngineUI =
92+
!user.isStaff && organization.features.includes('workflow-engine-ui');
93+
94+
const alertsLink = shouldRedirectToWorkflowEngineUI
95+
? `${makeMonitorBasePathname(organization.slug)}?alertsRedirect=true`
96+
: `${baseUrl}/alerts/rules/`;
97+
8798
return (
8899
<StickyBottomSection
89100
id="issues-configure"
@@ -92,8 +103,8 @@ function ConfigureSection({baseUrl}: {baseUrl: string}) {
92103
isSticky={isSticky}
93104
>
94105
<SecondaryNav.Item
95-
to={`${baseUrl}/alerts/rules/`}
96-
activeTo={`${baseUrl}/alerts/`}
106+
to={alertsLink}
107+
{...(!shouldRedirectToWorkflowEngineUI && {activeTo: `${baseUrl}/alerts/`})}
97108
analyticsItemName="issues_alerts"
98109
>
99110
{t('Alerts')}

0 commit comments

Comments
 (0)