From cfaaa1a9b458293bd2c905c2a3cd5714173703ce Mon Sep 17 00:00:00 2001 From: Colleen O'Rourke Date: Tue, 7 Jan 2025 11:13:09 -0800 Subject: [PATCH] fix(alerts): Add back interval select field (#83007) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I unintentionally removed the interval select field on metric alerts when removing the monitor type in https://github.com/getsentry/sentry/pull/81218 this PR puts it back Screenshot 2025-01-07 at 9 45 10 AM --------- Co-authored-by: Nate Moore --- .../rules/metric/ruleConditionsForm.tsx | 20 ++++++++++++++++++- .../alerts/rules/metric/ruleForm.spec.tsx | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx b/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx index 08455e1fdf2d20..1f2dec42561afb 100644 --- a/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx +++ b/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx @@ -490,7 +490,15 @@ class RuleConditionsForm extends PureComponent { } renderInterval() { - const {organization, disabled, alertType, project, isForLlmMetric} = this.props; + const { + organization, + timeWindow, + disabled, + alertType, + project, + isForLlmMetric, + onTimeWindowChange, + } = this.props; return ( @@ -518,6 +526,16 @@ class RuleConditionsForm extends PureComponent { required /> )} + onTimeWindowChange(value)} + inline={false} + flexibleControlStateSize + /> ); diff --git a/static/app/views/alerts/rules/metric/ruleForm.spec.tsx b/static/app/views/alerts/rules/metric/ruleForm.spec.tsx index b1a50d37daefc9..4c777a1ec78e5a 100644 --- a/static/app/views/alerts/rules/metric/ruleForm.spec.tsx +++ b/static/app/views/alerts/rules/metric/ruleForm.spec.tsx @@ -142,6 +142,12 @@ describe('Incident Rules Form', () => { expect(screen.queryByText(permissionAlertText)).not.toBeInTheDocument(); }); + it('renders time window', async () => { + createWrapper({rule}); + + expect(await screen.findByText('1 hour interval')).toBeInTheDocument(); + }); + it('is enabled with project-level alerts:write', async () => { organization.access = []; project.access = ['alerts:write'];