1
1
import type React from 'react' ;
2
2
import { createContext , useContext } from 'react' ;
3
+ import styled from '@emotion/styled' ;
3
4
5
+ import { Flex } from 'sentry/components/core/layout' ;
4
6
import { t } from 'sentry/locale' ;
7
+ import { space } from 'sentry/styles/space' ;
5
8
import {
6
9
type DataCondition ,
7
10
DataConditionType ,
@@ -109,6 +112,7 @@ type DataConditionNode = {
109
112
dataCondition ?: React . ComponentType < any > ;
110
113
defaultComparison ?: any ;
111
114
details ?: React . ComponentType < any > ;
115
+ warningMessage ?: React . ComponentType < any > ;
112
116
} ;
113
117
114
118
export const dataConditionNodesMap = new Map < DataConditionType , DataConditionNode > ( [
@@ -212,6 +216,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
212
216
environment : '' ,
213
217
} ,
214
218
validate : validateLatestAdoptedReleaseCondition ,
219
+ warningMessage : OccurenceBasedMonitorsWarning ,
215
220
} ,
216
221
] ,
217
222
[
@@ -221,6 +226,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
221
226
dataCondition : LatestReleaseNode ,
222
227
details : LatestReleaseNode ,
223
228
validate : undefined ,
229
+ warningMessage : OccurenceBasedMonitorsWarning ,
224
230
} ,
225
231
] ,
226
232
[
@@ -234,6 +240,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
234
240
match : MatchType . CONTAINS ,
235
241
} ,
236
242
validate : validateEventAttributeCondition ,
243
+ warningMessage : OccurenceBasedMonitorsWarning ,
237
244
} ,
238
245
] ,
239
246
[
@@ -264,6 +271,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
264
271
label : t ( 'Number of events' ) ,
265
272
dataCondition : EventFrequencyNode ,
266
273
validate : validateEventFrequencyCondition ,
274
+ warningMessage : OccurenceBasedMonitorsWarning ,
267
275
} ,
268
276
] ,
269
277
[
@@ -274,6 +282,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
274
282
details : EventFrequencyCountDetails ,
275
283
defaultComparison : { value : 100 , interval : Interval . ONE_HOUR } ,
276
284
validate : validateEventFrequencyCondition ,
285
+ warningMessage : OccurenceBasedMonitorsWarning ,
277
286
} ,
278
287
] ,
279
288
[
@@ -288,6 +297,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
288
297
comparison_interval : Interval . ONE_WEEK ,
289
298
} ,
290
299
validate : validateEventFrequencyCondition ,
300
+ warningMessage : OccurenceBasedMonitorsWarning ,
291
301
} ,
292
302
] ,
293
303
[
@@ -296,6 +306,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
296
306
label : t ( 'Number of users affected' ) ,
297
307
dataCondition : EventUniqueUserFrequencyNode ,
298
308
validate : validateEventUniqueUserFrequencyCondition ,
309
+ warningMessage : OccurenceBasedMonitorsWarning ,
299
310
} ,
300
311
] ,
301
312
[
@@ -306,6 +317,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
306
317
details : EventUniqueUserFrequencyCountDetails ,
307
318
defaultComparison : { value : 100 , interval : Interval . ONE_HOUR } ,
308
319
validate : validateEventUniqueUserFrequencyCondition ,
320
+ warningMessage : OccurenceBasedMonitorsWarning ,
309
321
} ,
310
322
] ,
311
323
[
@@ -320,6 +332,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
320
332
comparison_interval : Interval . ONE_WEEK ,
321
333
} ,
322
334
validate : validateEventUniqueUserFrequencyCondition ,
335
+ warningMessage : OccurenceBasedMonitorsWarning ,
323
336
} ,
324
337
] ,
325
338
[
@@ -328,6 +341,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
328
341
label : t ( 'Percentage of sessions affected' ) ,
329
342
dataCondition : PercentSessionsNode ,
330
343
validate : validatePercentSessionsCondition ,
344
+ warningMessage : OccurenceBasedMonitorsWarning ,
331
345
} ,
332
346
] ,
333
347
[
@@ -338,6 +352,7 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
338
352
details : PercentSessionsCountDetails ,
339
353
defaultComparison : { value : 100 , interval : Interval . ONE_HOUR } ,
340
354
validate : validatePercentSessionsCondition ,
355
+ warningMessage : OccurenceBasedMonitorsWarning ,
341
356
} ,
342
357
] ,
343
358
[
@@ -352,18 +367,26 @@ export const dataConditionNodesMap = new Map<DataConditionType, DataConditionNod
352
367
comparison_interval : Interval . ONE_WEEK ,
353
368
} ,
354
369
validate : validatePercentSessionsCondition ,
370
+ warningMessage : OccurenceBasedMonitorsWarning ,
355
371
} ,
356
372
] ,
357
373
] ) ;
358
374
359
- export const frequencyTypeMapping : Partial < Record < DataConditionType , DataConditionType > > =
360
- {
361
- [ DataConditionType . PERCENT_SESSIONS_COUNT ] : DataConditionType . PERCENT_SESSIONS ,
362
- [ DataConditionType . PERCENT_SESSIONS_PERCENT ] : DataConditionType . PERCENT_SESSIONS ,
363
- [ DataConditionType . EVENT_FREQUENCY_COUNT ] : DataConditionType . EVENT_FREQUENCY ,
364
- [ DataConditionType . EVENT_FREQUENCY_PERCENT ] : DataConditionType . EVENT_FREQUENCY ,
365
- [ DataConditionType . EVENT_UNIQUE_USER_FREQUENCY_COUNT ] :
366
- DataConditionType . EVENT_UNIQUE_USER_FREQUENCY ,
367
- [ DataConditionType . EVENT_UNIQUE_USER_FREQUENCY_PERCENT ] :
368
- DataConditionType . EVENT_UNIQUE_USER_FREQUENCY ,
369
- } ;
375
+ function OccurenceBasedMonitorsWarning ( ) {
376
+ return (
377
+ < Flex direction = "column" gap = { space ( 1 ) } >
378
+ < WarningLine >
379
+ { t ( 'These filters will only apply to some of your monitors and triggers.' ) }
380
+ </ WarningLine >
381
+ < WarningLine >
382
+ { t (
383
+ 'They are only available for occurrence-based monitors \(errors, N+1, and replay\) and only apply to the triggers "A new event is captured for an issue" and "A new issue is created."'
384
+ ) }
385
+ </ WarningLine >
386
+ </ Flex >
387
+ ) ;
388
+ }
389
+
390
+ const WarningLine = styled ( 'p' ) `
391
+ margin: 0;
392
+ ` ;
0 commit comments