1
+ import { RowLine } from 'sentry/components/workflowEngine/form/automationBuilderRowLine' ;
1
2
import { AutomationBuilderSelect } from 'sentry/components/workflowEngine/form/automationBuilderSelect' ;
2
- import { tct } from 'sentry/locale' ;
3
+ import { ConditionBadge } from 'sentry/components/workflowEngine/ui/conditionBadge' ;
4
+ import { t , tct } from 'sentry/locale' ;
3
5
import type { SelectValue } from 'sentry/types/core' ;
4
6
import type { DataCondition } from 'sentry/types/workflowEngine/dataConditions' ;
5
7
import { DataConditionType } from 'sentry/types/workflowEngine/dataConditions' ;
@@ -11,45 +13,83 @@ import {
11
13
COMPARISON_INTERVAL_CHOICES ,
12
14
INTERVAL_CHOICES ,
13
15
} from 'sentry/views/automations/components/actionFilters/constants' ;
16
+ import {
17
+ SubfilterDetailsList ,
18
+ SubfiltersList ,
19
+ } from 'sentry/views/automations/components/actionFilters/subfiltersList' ;
14
20
import { useDataConditionNodeContext } from 'sentry/views/automations/components/dataConditionNodes' ;
15
21
16
22
export function EventUniqueUserFrequencyCountDetails ( {
17
23
condition,
18
24
} : {
19
25
condition : DataCondition ;
20
26
} ) {
21
- return tct ( 'Number of users affected by an issue is more than [value] [interval]' , {
22
- value : condition . comparison . value ,
23
- interval :
24
- INTERVAL_CHOICES . find ( choice => choice . value === condition . comparison . interval )
25
- ?. label || condition . comparison . interval ,
26
- } ) ;
27
+ const hasSubfilters = condition . comparison . filters ?. length > 0 ;
28
+ return (
29
+ < div >
30
+ { tct (
31
+ 'Number of users affected by an issue is more than [value] [interval] [where]' ,
32
+ {
33
+ value : condition . comparison . value ,
34
+ interval :
35
+ INTERVAL_CHOICES . find (
36
+ choice => choice . value === condition . comparison . interval
37
+ ) ?. label || condition . comparison . interval ,
38
+ where : hasSubfilters ? t ( 'where' ) : null ,
39
+ }
40
+ ) }
41
+ { hasSubfilters && (
42
+ < SubfilterDetailsList subfilters = { condition . comparison . filters } />
43
+ ) }
44
+ </ div >
45
+ ) ;
27
46
}
28
47
29
48
export function EventUniqueUserFrequencyPercentDetails ( {
30
49
condition,
31
50
} : {
32
51
condition : DataCondition ;
33
52
} ) {
34
- return tct (
35
- 'Number of users affected by an issue is [value]% higher [interval] compared to [comparison_interval]' ,
36
- {
37
- value : condition . comparison . value ,
38
- interval :
39
- INTERVAL_CHOICES . find ( choice => choice . value === condition . comparison . interval )
40
- ?. label || condition . comparison . interval ,
41
- comparison_interval :
42
- COMPARISON_INTERVAL_CHOICES . find (
43
- choice => choice . value === condition . comparison . comparison_interval
44
- ) ?. label || condition . comparison . comparison_interval ,
45
- }
53
+ const hasSubfilters = condition . comparison . filters ?. length > 0 ;
54
+ return (
55
+ < div >
56
+ { tct (
57
+ 'Number of users affected by an issue is [value]% higher [interval] compared to [comparison_interval] [where]' ,
58
+ {
59
+ value : condition . comparison . value ,
60
+ interval :
61
+ INTERVAL_CHOICES . find (
62
+ choice => choice . value === condition . comparison . interval
63
+ ) ?. label || condition . comparison . interval ,
64
+ comparison_interval :
65
+ COMPARISON_INTERVAL_CHOICES . find (
66
+ choice => choice . value === condition . comparison . comparison_interval
67
+ ) ?. label || condition . comparison . comparison_interval ,
68
+ where : hasSubfilters ? t ( 'where' ) : null ,
69
+ }
70
+ ) }
71
+ { hasSubfilters && (
72
+ < SubfilterDetailsList subfilters = { condition . comparison . filters } />
73
+ ) }
74
+ </ div >
46
75
) ;
47
76
}
48
77
49
78
export function EventUniqueUserFrequencyNode ( ) {
50
- return tct ( 'Number of users affected by an issue is [select]' , {
51
- select : < ComparisonTypeField /> ,
52
- } ) ;
79
+ const { condition} = useDataConditionNodeContext ( ) ;
80
+ const hasSubfilters = condition . comparison . filters ?. length > 0 ;
81
+
82
+ return (
83
+ < div >
84
+ < RowLine >
85
+ { tct ( 'Number of users affected by an issue is [select] [where]' , {
86
+ select : < ComparisonTypeField /> ,
87
+ where : hasSubfilters ? < ConditionBadge > { t ( 'Where' ) } </ ConditionBadge > : null ,
88
+ } ) }
89
+ </ RowLine >
90
+ < SubfiltersList />
91
+ </ div >
92
+ ) ;
53
93
}
54
94
55
95
function ComparisonTypeField ( ) {
0 commit comments