Skip to content

Commit e1d02a4

Browse files
authored
feat(aci): add issue category data condition (#94677)
this is a legacy condition that we still have to account for due to migrated workflows
1 parent be07ed7 commit e1d02a4

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import {AutomationBuilderSelect} from 'sentry/components/workflowEngine/form/automationBuilderSelect';
2+
import {tct} from 'sentry/locale';
3+
import type {SelectValue} from 'sentry/types/core';
4+
import type {DataCondition} from 'sentry/types/workflowEngine/dataConditions';
5+
import {useDataConditionNodeContext} from 'sentry/views/automations/components/dataConditionNodes';
6+
7+
enum GroupCategory {
8+
ERROR = 1,
9+
FEEDBACK = 6,
10+
OUTAGE = 10,
11+
METRIC = 11,
12+
DB_QUERY = 12,
13+
HTTP_CLIENT = 13,
14+
FRONTEND = 14,
15+
MOBILE = 15,
16+
}
17+
18+
const GROUP_CATEGORY_CHOICES = [
19+
{value: GroupCategory.ERROR, label: 'error'},
20+
{value: GroupCategory.FEEDBACK, label: 'feedback'},
21+
{value: GroupCategory.OUTAGE, label: 'outage'},
22+
{value: GroupCategory.METRIC, label: 'metric'},
23+
{value: GroupCategory.DB_QUERY, label: 'db_query'},
24+
{value: GroupCategory.HTTP_CLIENT, label: 'http_client'},
25+
{value: GroupCategory.FRONTEND, label: 'frontend'},
26+
{value: GroupCategory.MOBILE, label: 'mobile'},
27+
];
28+
29+
export function IssueCategoryDetails({condition}: {condition: DataCondition}) {
30+
return tct('Issue category is equal to [category]', {
31+
category:
32+
GROUP_CATEGORY_CHOICES.find(choice => choice.value === condition.comparison.value)
33+
?.label || condition.comparison.value,
34+
});
35+
}
36+
37+
export function IssueCategoryNode() {
38+
const {condition, condition_id, onUpdate} = useDataConditionNodeContext();
39+
return tct('Issue category is equal to [category]', {
40+
category: (
41+
<AutomationBuilderSelect
42+
name={`${condition_id}.comparison.value`}
43+
value={condition.comparison.value}
44+
options={GROUP_CATEGORY_CHOICES}
45+
onChange={(option: SelectValue<GroupCategory>) => {
46+
onUpdate({comparison: {value: option.value}});
47+
}}
48+
/>
49+
),
50+
});
51+
}

static/app/views/automations/components/dataConditionNodes.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ import {
3939
EventUniqueUserFrequencyNode,
4040
EventUniqueUserFrequencyPercentDetails,
4141
} from 'sentry/views/automations/components/actionFilters/eventUniqueUserFrequency';
42+
import {
43+
IssueCategoryDetails,
44+
IssueCategoryNode,
45+
} from 'sentry/views/automations/components/actionFilters/issueCategory';
4246
import {
4347
IssueOccurrencesDetails,
4448
IssueOccurrencesNode,
@@ -153,6 +157,14 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
153157
details: IssueOccurrencesDetails,
154158
},
155159
],
160+
[
161+
DataConditionType.ISSUE_CATEGORY,
162+
{
163+
label: t('Issue category'),
164+
dataCondition: IssueCategoryNode,
165+
details: IssueCategoryDetails,
166+
},
167+
],
156168
[
157169
DataConditionType.ISSUE_PRIORITY_GREATER_OR_EQUAL,
158170
{

0 commit comments

Comments
 (0)