Skip to content

Commit b7485c2

Browse files
authored
chore(metrics): removed alerts and widgets info (#78607)
1 parent f862005 commit b7485c2

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

static/app/views/alerts/list/rules/alertRulesList.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {useLocation} from 'sentry/utils/useLocation';
3232
import useOrganization from 'sentry/utils/useOrganization';
3333
import useRouter from 'sentry/utils/useRouter';
3434

35+
import {MetricsRemovedAlertsWidgetsAlert} from '../../../metrics/metricsRemovedAlertsWidgetsAlert';
3536
import FilterBar from '../../filterBar';
3637
import type {CombinedAlerts} from '../../types';
3738
import {AlertRuleType, CombinedAlertType} from '../../types';
@@ -188,6 +189,7 @@ function AlertRulesList() {
188189
<AlertHeader router={router} activeTab="rules" />
189190
<Layout.Body>
190191
<Layout.Main fullWidth>
192+
<MetricsRemovedAlertsWidgetsAlert organization={organization} />
191193
<DataConsentBanner source="alerts" />
192194
<FilterBar
193195
location={location}

static/app/views/dashboards/manage/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import withApi from 'sentry/utils/withApi';
3333
import withOrganization from 'sentry/utils/withOrganization';
3434
import {DashboardImportButton} from 'sentry/views/dashboards/manage/dashboardImport';
3535
import DeprecatedAsyncView from 'sentry/views/deprecatedAsyncView';
36+
import {MetricsRemovedAlertsWidgetsAlert} from 'sentry/views/metrics/metricsRemovedAlertsWidgetsAlert';
3637

3738
import {getDashboardTemplates} from '../data';
3839
import {assignDefaultLayout, getInitialColumnDepths} from '../layoutUtils';
@@ -353,6 +354,8 @@ class ManageDashboards extends DeprecatedAsyncView<Props, State> {
353354
</Layout.Header>
354355
<Layout.Body>
355356
<Layout.Main fullWidth>
357+
<MetricsRemovedAlertsWidgetsAlert organization={organization} />
358+
356359
{showTemplates && this.renderTemplates()}
357360
{this.renderActions()}
358361
{this.renderDashboards()}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import styled from '@emotion/styled';
2+
3+
import Alert, {type AlertProps} from 'sentry/components/alert';
4+
import {Button} from 'sentry/components/button';
5+
import ExternalLink from 'sentry/components/links/externalLink';
6+
import {IconClose} from 'sentry/icons';
7+
import {t, tct} from 'sentry/locale';
8+
import {space} from 'sentry/styles/space';
9+
import type {Organization} from 'sentry/types/organization';
10+
import useDismissAlert from 'sentry/utils/useDismissAlert';
11+
12+
const LOCAL_STORAGE_KEY = 'metrics-removed-alerts-wizards-info-dismissed';
13+
14+
export function MetricsRemovedAlertsWidgetsAlert({
15+
style,
16+
organization,
17+
}: Pick<AlertProps, 'style'> & {organization: Organization}) {
18+
const {dismiss, isDismissed} = useDismissAlert({
19+
key: LOCAL_STORAGE_KEY,
20+
expirationDays: 365,
21+
});
22+
const hasDeletedAlertsOrWidgets = organization.features.includes(
23+
'organizations:custom-metrics-alerts-widgets-removal-info'
24+
);
25+
26+
if (isDismissed || !hasDeletedAlertsOrWidgets) {
27+
return null;
28+
}
29+
30+
return (
31+
<Alert type="info" showIcon style={style}>
32+
<AlertContent>
33+
<div>
34+
{tct(
35+
'The Metrics beta program has ended on October 7th and all alerts/dashboard widgets using custom metrics have been removed. For more details, please [link:read the FAQs]. Thank you again for participating.',
36+
{
37+
link: (
38+
<ExternalLink href="https://sentry.zendesk.com/hc/en-us/articles/26369339769883-Metrics-Beta-Coming-to-an-End" />
39+
),
40+
}
41+
)}
42+
</div>
43+
<DismissButton
44+
priority="link"
45+
icon={<IconClose />}
46+
onClick={dismiss}
47+
aria-label={t('Dismiss Alert')}
48+
title={t('Dismiss Alert')}
49+
/>
50+
</AlertContent>
51+
</Alert>
52+
);
53+
}
54+
55+
const DismissButton = styled(Button)`
56+
color: ${p => p.theme.alert.warning.color};
57+
pointer-events: all;
58+
&:hover {
59+
opacity: 0.5;
60+
}
61+
`;
62+
63+
const AlertContent = styled('div')`
64+
display: grid;
65+
grid-template-columns: 1fr max-content;
66+
gap: ${space(1)};
67+
align-items: center;
68+
`;

0 commit comments

Comments
 (0)