Skip to content

Commit 7788607

Browse files
authored
feat(alerts): Replace priority conditions for new alert creation (#78164)
Replace priority conditions for new alert creation with the original 'A new issue is created' condition.
1 parent 9b26ba4 commit 7788607

File tree

2 files changed

+10
-41
lines changed

2 files changed

+10
-41
lines changed

static/app/views/alerts/create.spec.tsx

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('ProjectAlertsCreate', function () {
161161
'The issue is older or newer than...',
162162
]);
163163

164-
await userEvent.click(screen.getAllByLabelText('Delete Node')[2]);
164+
await userEvent.click(screen.getAllByLabelText('Delete Node')[1]);
165165

166166
await userEvent.click(screen.getByText('Save Rule'));
167167

@@ -174,10 +174,7 @@ describe('ProjectAlertsCreate', function () {
174174
actions: [],
175175
conditions: [
176176
expect.objectContaining({
177-
id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition',
178-
}),
179-
expect.objectContaining({
180-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
177+
id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
181178
}),
182179
],
183180
filterMatch: 'all',
@@ -200,7 +197,6 @@ describe('ProjectAlertsCreate', function () {
200197
});
201198
// delete node
202199
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
203-
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
204200

205201
// Change name of alert rule
206202
await userEvent.type(screen.getByPlaceholderText('Enter Alert Name'), 'myname');
@@ -267,7 +263,7 @@ describe('ProjectAlertsCreate', function () {
267263
'Send a notification to all legacy integrations',
268264
]);
269265

270-
await userEvent.click(screen.getAllByLabelText('Delete Node')[2]);
266+
await userEvent.click(screen.getAllByLabelText('Delete Node')[1]);
271267

272268
await userEvent.click(screen.getByText('Save Rule'));
273269

@@ -280,10 +276,7 @@ describe('ProjectAlertsCreate', function () {
280276
actions: [],
281277
conditions: [
282278
expect.objectContaining({
283-
id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition',
284-
}),
285-
expect.objectContaining({
286-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
279+
id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
287280
}),
288281
],
289282
filterMatch: 'all',
@@ -340,10 +333,7 @@ describe('ProjectAlertsCreate', function () {
340333
filterMatch: 'any',
341334
conditions: [
342335
expect.objectContaining({
343-
id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition',
344-
}),
345-
expect.objectContaining({
346-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
336+
id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
347337
}),
348338
],
349339
actions: [],
@@ -392,10 +382,7 @@ describe('ProjectAlertsCreate', function () {
392382
actions: [],
393383
conditions: [
394384
expect.objectContaining({
395-
id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition',
396-
}),
397-
expect.objectContaining({
398-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
385+
id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
399386
}),
400387
],
401388
filterMatch: 'all',
@@ -455,11 +442,7 @@ describe('ProjectAlertsCreate', function () {
455442
},
456443
],
457444
actions: [],
458-
conditions: [
459-
expect.objectContaining({
460-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
461-
}),
462-
],
445+
conditions: [],
463446
frequency: 60 * 24,
464447
name: 'myname',
465448
owner: null,
@@ -501,10 +484,7 @@ describe('ProjectAlertsCreate', function () {
501484
],
502485
conditions: [
503486
expect.objectContaining({
504-
id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition',
505-
}),
506-
expect.objectContaining({
507-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
487+
id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
508488
}),
509489
],
510490
filterMatch: 'all',
@@ -551,10 +531,7 @@ describe('ProjectAlertsCreate', function () {
551531
actionMatch: 'any',
552532
conditions: [
553533
expect.objectContaining({
554-
id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition',
555-
}),
556-
expect.objectContaining({
557-
id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition',
534+
id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition',
558535
}),
559536
],
560537
filterMatch: 'all',
@@ -585,7 +562,6 @@ describe('ProjectAlertsCreate', function () {
585562
createWrapper();
586563
// delete existion conditions
587564
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
588-
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
589565

590566
await waitFor(() => {
591567
expect(mock).toHaveBeenCalled();
@@ -629,7 +605,6 @@ describe('ProjectAlertsCreate', function () {
629605
it('shows error for incompatible conditions', async () => {
630606
createWrapper();
631607
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
632-
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
633608

634609
await selectEvent.select(screen.getByText('Add optional trigger...'), [
635610
'A new issue is created',
@@ -656,7 +631,6 @@ describe('ProjectAlertsCreate', function () {
656631
it('test any filterMatch', async () => {
657632
createWrapper();
658633
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
659-
await userEvent.click(screen.getAllByLabelText('Delete Node')[0]);
660634

661635
await selectEvent.select(screen.getByText('Add optional trigger...'), [
662636
'A new issue is created',
@@ -707,7 +681,6 @@ describe('ProjectAlertsCreate', function () {
707681

708682
createWrapper({organization: {features: ['noisy-alert-warning']}});
709683
await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]);
710-
await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]);
711684

712685
await selectEvent.select(screen.getByText('Add action...'), [
713686
'Suggested Assignees, Team, or Member',
@@ -740,7 +713,6 @@ describe('ProjectAlertsCreate', function () {
740713
it('does not display noisy alert banner for legacy integrations', async function () {
741714
createWrapper({organization: {features: ['noisy-alert-warning']}});
742715
await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]);
743-
await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]);
744716

745717
await selectEvent.select(screen.getByText('Add action...'), [
746718
'Send a notification to all legacy integrations',

static/app/views/alerts/rules/issue/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,7 @@ class IssueRuleEditor extends DeprecatedAsyncView<Props, State> {
326326
if (!ruleId && !this.isDuplicateRule) {
327327
// now that we've loaded all the possible conditions, we can populate the
328328
// value of conditions for a new alert
329-
this.handleChange('conditions', [
330-
{id: IssueAlertConditionType.NEW_HIGH_PRIORITY_ISSUE},
331-
{id: IssueAlertConditionType.EXISTING_HIGH_PRIORITY_ISSUE},
332-
]);
329+
this.handleChange('conditions', [{id: IssueAlertConditionType.FIRST_SEEN_EVENT}]);
333330
}
334331
}
335332

0 commit comments

Comments
 (0)