33 * or more contributor license agreements. Licensed under the Elastic License;
44 * you may not use this file except in compliance with the Elastic License.
55 */
6- import { EuiText , EuiSelect , EuiExpression } from '@elastic/eui' ;
6+ import { EuiSelect } from '@elastic/eui' ;
77import { i18n } from '@kbn/i18n' ;
88import React from 'react' ;
99import { ALERT_TYPES_CONFIG } from '../../../../common/alert_types' ;
@@ -20,6 +20,10 @@ import {
2020 ENVIRONMENT_ALL ,
2121 getEnvironmentLabel ,
2222} from '../../../../common/environment_filter_values' ;
23+ import {
24+ TRANSACTION_PAGE_LOAD ,
25+ TRANSACTION_REQUEST ,
26+ } from '../../../../common/transaction_types' ;
2327
2428interface Params {
2529 windowSize : number ;
@@ -42,15 +46,18 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
4246 const transactionTypes = useServiceTransactionTypes ( urlParams ) ;
4347 const { serviceName, start, end } = urlParams ;
4448 const { environmentOptions } = useEnvironments ( { serviceName, start, end } ) ;
49+ const supportedTransactionTypes = transactionTypes . filter ( ( transactionType ) =>
50+ [ TRANSACTION_PAGE_LOAD , TRANSACTION_REQUEST ] . includes ( transactionType )
51+ ) ;
4552
46- if ( ! transactionTypes . length || ! serviceName ) {
53+ if ( ! supportedTransactionTypes . length || ! serviceName ) {
4754 return null ;
4855 }
4956
5057 const defaults : Params = {
5158 windowSize : 15 ,
5259 windowUnit : 'm' ,
53- transactionType : transactionTypes [ 0 ] ,
60+ transactionType : supportedTransactionTypes [ 0 ] , // 'page-load' for RUM, 'request' otherwise
5461 serviceName,
5562 environment : urlParams . environment || ENVIRONMENT_ALL . value ,
5663 anomalyScore : 75 ,
@@ -62,19 +69,6 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
6269 } ;
6370
6471 const fields = [
65- < EuiExpression
66- description = { i18n . translate (
67- 'xpack.apm.transactionDurationAnomalyAlertTrigger.service' ,
68- {
69- defaultMessage : 'Service' ,
70- }
71- ) }
72- value = {
73- < EuiText className = "eui-displayInlineBlock" >
74- < h5 > { serviceName } </ h5 >
75- </ EuiText >
76- }
77- /> ,
7872 < PopoverExpression
7973 value = { getEnvironmentLabel ( params . environment ) }
8074 title = { i18n . translate (
@@ -91,27 +85,6 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
9185 compressed
9286 />
9387 </ PopoverExpression > ,
94- < PopoverExpression
95- value = { params . transactionType }
96- title = { i18n . translate (
97- 'xpack.apm.transactionDurationAnomalyAlertTrigger.type' ,
98- {
99- defaultMessage : 'Type' ,
100- }
101- ) }
102- >
103- < EuiSelect
104- value = { params . transactionType }
105- options = { transactionTypes . map ( ( key ) => {
106- return {
107- text : key ,
108- value : key ,
109- } ;
110- } ) }
111- onChange = { ( e ) => setAlertParams ( 'transactionType' , e . target . value ) }
112- compressed
113- />
114- </ PopoverExpression > ,
11588 < PopoverExpression
11689 value = { < AnomalySeverity severityScore = { params . anomalyScore } /> }
11790 title = { i18n . translate (
0 commit comments