@@ -12,6 +12,7 @@ import {
12
12
} from 'sentry/components/alerts/onDemandMetricAlert' ;
13
13
import { Alert } from 'sentry/components/core/alert' ;
14
14
import { Select } from 'sentry/components/core/select' ;
15
+ import { Tooltip } from 'sentry/components/core/tooltip' ;
15
16
import { getHasTag } from 'sentry/components/events/searchBar' ;
16
17
import {
17
18
STATIC_FIELD_TAGS ,
@@ -66,11 +67,17 @@ import {
66
67
DATA_SOURCE_TO_SET_AND_EVENT_TYPES ,
67
68
} from 'sentry/views/alerts/utils' ;
68
69
import type { AlertType } from 'sentry/views/alerts/wizard/options' ;
69
- import { getSupportedAndOmittedTags } from 'sentry/views/alerts/wizard/options' ;
70
+ import {
71
+ DEPRECATED_TRANSACTION_ALERTS ,
72
+ getSupportedAndOmittedTags ,
73
+ } from 'sentry/views/alerts/wizard/options' ;
70
74
import { useSpanTags } from 'sentry/views/explore/contexts/spanTagsContext' ;
71
75
import { TraceItemAttributeProvider } from 'sentry/views/explore/contexts/traceItemAttributeContext' ;
72
76
import { TraceItemDataset } from 'sentry/views/explore/types' ;
73
- import { hasEAPAlerts } from 'sentry/views/insights/common/utils/hasEAPAlerts' ;
77
+ import {
78
+ deprecateTransactionAlerts ,
79
+ hasEAPAlerts ,
80
+ } from 'sentry/views/insights/common/utils/hasEAPAlerts' ;
74
81
75
82
import {
76
83
DEFAULT_AGGREGATE ,
@@ -263,6 +270,24 @@ class RuleConditionsForm extends PureComponent<Props, State> {
263
270
} ;
264
271
}
265
272
273
+ get disableTransactionAlertType ( ) {
274
+ const { organization, alertType, isEditing} = this . props ;
275
+
276
+ return (
277
+ isEditing &&
278
+ alertType &&
279
+ deprecateTransactionAlerts ( organization ) &&
280
+ DEPRECATED_TRANSACTION_ALERTS . includes ( alertType ) &&
281
+ hasEAPAlerts ( organization )
282
+ ) ;
283
+ }
284
+
285
+ get transactionAlertDisabledMessage ( ) {
286
+ return t (
287
+ 'Transaction based alerts are no longer supported. Create span alerts instead.'
288
+ ) ;
289
+ }
290
+
266
291
renderEventTypeFilter ( ) {
267
292
const { organization, disabled, alertType, isErrorMigration} = this . props ;
268
293
@@ -387,7 +412,9 @@ class RuleConditionsForm extends PureComponent<Props, State> {
387
412
388
413
return (
389
414
< Select
390
- isDisabled = { disabled || disableProjectSelector }
415
+ isDisabled = {
416
+ disabled || disableProjectSelector || this . disableTransactionAlertType
417
+ }
391
418
value = { selectedProject . id }
392
419
options = { projectOptions }
393
420
onChange = { ( { value} : { value : Project [ 'id' ] } ) => {
@@ -436,6 +463,7 @@ class RuleConditionsForm extends PureComponent<Props, State> {
436
463
dataset,
437
464
comparisonType,
438
465
onTimeWindowChange,
466
+ isEditing,
439
467
} = this . props ;
440
468
441
469
return (
@@ -445,34 +473,46 @@ class RuleConditionsForm extends PureComponent<Props, State> {
445
473
< div > { t ( 'Define your metric' ) } </ div >
446
474
</ StyledListTitle >
447
475
</ StyledListItem >
448
- < FormRow >
449
- < WizardField
450
- name = "aggregate"
451
- help = { null }
452
- organization = { organization }
453
- disabled = { disabled }
454
- project = { project }
455
- style = { {
456
- ...this . formElemBaseStyle ,
457
- flex : 1 ,
458
- } }
459
- inline = { false }
460
- flexibleControlStateSize
461
- columnWidth = { 200 }
462
- alertType = { alertType }
463
- required
464
- />
465
- < Select
466
- name = "timeWindow"
467
- styles = { this . selectControlStyles }
468
- options = { getTimeWindowOptions ( dataset , comparisonType ) }
469
- isDisabled = { disabled }
470
- value = { timeWindow }
471
- onChange = { ( { value} : any ) => onTimeWindowChange ( value ) }
472
- inline = { false }
473
- flexibleControlStateSize
474
- />
475
- </ FormRow >
476
+ < Tooltip
477
+ title = { this . transactionAlertDisabledMessage }
478
+ disabled = { ! this . disableTransactionAlertType }
479
+ isHoverable
480
+ >
481
+ < FormRow >
482
+ < WizardField
483
+ name = "aggregate"
484
+ help = { null }
485
+ organization = { organization }
486
+ disabled = { disabled }
487
+ project = { project }
488
+ style = { {
489
+ ...this . formElemBaseStyle ,
490
+ flex : 1 ,
491
+ } }
492
+ inline = { false }
493
+ flexibleControlStateSize
494
+ columnWidth = { 200 }
495
+ alertType = { alertType }
496
+ required
497
+ isEditing = { isEditing }
498
+ disabledReason = {
499
+ this . disableTransactionAlertType
500
+ ? this . transactionAlertDisabledMessage
501
+ : undefined
502
+ }
503
+ />
504
+ < Select
505
+ name = "timeWindow"
506
+ styles = { this . selectControlStyles }
507
+ options = { getTimeWindowOptions ( dataset , comparisonType ) }
508
+ isDisabled = { disabled || this . disableTransactionAlertType }
509
+ value = { timeWindow }
510
+ onChange = { ( { value} : any ) => onTimeWindowChange ( value ) }
511
+ inline = { false }
512
+ flexibleControlStateSize
513
+ />
514
+ </ FormRow >
515
+ </ Tooltip >
476
516
</ Fragment >
477
517
) ;
478
518
}
@@ -545,34 +585,43 @@ class RuleConditionsForm extends PureComponent<Props, State> {
545
585
) }
546
586
{ ! isErrorMigration && this . renderInterval ( ) }
547
587
< StyledListItem > { t ( 'Filter events' ) } </ StyledListItem >
548
- < FormRow noMargin columns = { 1 + ( allowChangeEventTypes ? 1 : 0 ) + 1 } >
549
- { this . renderProjectSelector ( ) }
550
- < SelectField
551
- name = "environment"
552
- placeholder = { t ( 'All Environments' ) }
553
- style = { {
554
- ...this . formElemBaseStyle ,
555
- minWidth : 230 ,
556
- flex : 1 ,
557
- } }
558
- styles = { {
559
- singleValue : ( base : any ) => ( {
560
- ...base ,
561
- } ) ,
562
- option : ( base : any ) => ( {
563
- ...base ,
564
- } ) ,
565
- } }
566
- options = { environmentOptions }
567
- isDisabled = {
568
- disabled || this . state . environments === null || isErrorMigration
569
- }
570
- isClearable
571
- inline = { false }
572
- flexibleControlStateSize
573
- />
574
- { allowChangeEventTypes && this . renderEventTypeFilter ( ) }
575
- </ FormRow >
588
+ < Tooltip
589
+ title = { this . transactionAlertDisabledMessage }
590
+ disabled = { ! this . disableTransactionAlertType }
591
+ isHoverable
592
+ >
593
+ < FormRow noMargin columns = { 1 + ( allowChangeEventTypes ? 1 : 0 ) + 1 } >
594
+ { this . renderProjectSelector ( ) }
595
+ < SelectField
596
+ name = "environment"
597
+ placeholder = { t ( 'All Environments' ) }
598
+ style = { {
599
+ ...this . formElemBaseStyle ,
600
+ minWidth : 230 ,
601
+ flex : 1 ,
602
+ } }
603
+ styles = { {
604
+ singleValue : ( base : any ) => ( {
605
+ ...base ,
606
+ } ) ,
607
+ option : ( base : any ) => ( {
608
+ ...base ,
609
+ } ) ,
610
+ } }
611
+ options = { environmentOptions }
612
+ isDisabled = {
613
+ disabled ||
614
+ this . state . environments === null ||
615
+ isErrorMigration ||
616
+ this . disableTransactionAlertType
617
+ }
618
+ isClearable
619
+ inline = { false }
620
+ flexibleControlStateSize
621
+ />
622
+ { allowChangeEventTypes && this . renderEventTypeFilter ( ) }
623
+ </ FormRow >
624
+ </ Tooltip >
576
625
< FormRow noMargin >
577
626
< FormField
578
627
name = "query"
@@ -604,7 +653,11 @@ class RuleConditionsForm extends PureComponent<Props, State> {
604
653
placeholder = { this . searchPlaceholder }
605
654
searchSource = "alert_builder"
606
655
filterKeys = { filterKeys }
607
- disabled = { disabled || isErrorMigration }
656
+ disabled = {
657
+ disabled ||
658
+ isErrorMigration ||
659
+ this . disableTransactionAlertType
660
+ }
608
661
onChange = { onChange }
609
662
invalidMessages = { {
610
663
[ InvalidReason . WILDCARD_NOT_ALLOWED ] : t (
0 commit comments