1+ import { RowLine } from 'sentry/components/workflowEngine/form/automationBuilderRowLine' ;
12import { 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' ;
35import type { SelectValue } from 'sentry/types/core' ;
46import type { DataCondition } from 'sentry/types/workflowEngine/dataConditions' ;
57import { DataConditionType } from 'sentry/types/workflowEngine/dataConditions' ;
@@ -11,45 +13,83 @@ import {
1113 COMPARISON_INTERVAL_CHOICES ,
1214 INTERVAL_CHOICES ,
1315} from 'sentry/views/automations/components/actionFilters/constants' ;
16+ import {
17+ SubfilterDetailsList ,
18+ SubfiltersList ,
19+ } from 'sentry/views/automations/components/actionFilters/subfiltersList' ;
1420import { useDataConditionNodeContext } from 'sentry/views/automations/components/dataConditionNodes' ;
1521
1622export function EventUniqueUserFrequencyCountDetails ( {
1723 condition,
1824} : {
1925 condition : DataCondition ;
2026} ) {
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+ ) ;
2746}
2847
2948export function EventUniqueUserFrequencyPercentDetails ( {
3049 condition,
3150} : {
3251 condition : DataCondition ;
3352} ) {
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 >
4675 ) ;
4776}
4877
4978export 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+ ) ;
5393}
5494
5595function ComparisonTypeField ( ) {
0 commit comments