diff --git a/x-pack/plugins/apm/public/components/alerting/rule_types/error_count_rule_type/index.tsx b/x-pack/plugins/apm/public/components/alerting/rule_types/error_count_rule_type/index.tsx index 8868cd6ccce88..09ca441cd26e9 100644 --- a/x-pack/plugins/apm/public/components/alerting/rule_types/error_count_rule_type/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/rule_types/error_count_rule_type/index.tsx @@ -94,11 +94,17 @@ export function ErrorCountRuleType(props: Props) { const fields = [ setRuleParams('serviceName', value)} + onChange={(value) => { + if (value !== params.serviceName) { + setRuleParams('serviceName', value); + setRuleParams('environment', ENVIRONMENT_ALL.value); + } + }} />, setRuleParams('environment', value)} + serviceName={params.serviceName} />, setRuleParams('serviceName', value)} + onChange={(value) => { + if (value !== params.serviceName) { + setRuleParams('serviceName', value); + setRuleParams('transactionType', ''); + setRuleParams('environment', ENVIRONMENT_ALL.value); + } + }} />, setRuleParams('transactionType', value)} + serviceName={params.serviceName} />, setRuleParams('environment', value)} + serviceName={params.serviceName} />, } diff --git a/x-pack/plugins/apm/public/components/alerting/rule_types/transaction_duration_rule_type/index.tsx b/x-pack/plugins/apm/public/components/alerting/rule_types/transaction_duration_rule_type/index.tsx index c2423741a4e9e..1045eff2cc6c5 100644 --- a/x-pack/plugins/apm/public/components/alerting/rule_types/transaction_duration_rule_type/index.tsx +++ b/x-pack/plugins/apm/public/components/alerting/rule_types/transaction_duration_rule_type/index.tsx @@ -146,15 +146,23 @@ export function TransactionDurationRuleType(props: Props) { setRuleParams('serviceName', value)} + onChange={(value) => { + if (value !== params.serviceName) { + setRuleParams('serviceName', value); + setRuleParams('transactionType', ''); + setRuleParams('environment', ENVIRONMENT_ALL.value); + } + }} />, setRuleParams('transactionType', value)} + serviceName={params.serviceName} />, setRuleParams('environment', value)} + serviceName={params.serviceName} />, setRuleParams('serviceName', value)} + onChange={(value) => { + if (value !== params.serviceName) { + setRuleParams('serviceName', value); + setRuleParams('transactionType', ''); + setRuleParams('environment', ENVIRONMENT_ALL.value); + } + }} />, setRuleParams('transactionType', value)} + serviceName={params.serviceName} />, setRuleParams('environment', value)} + serviceName={params.serviceName} />, void; + serviceName?: string; }) { return ( ); @@ -98,9 +101,11 @@ export function EnvironmentField({ export function TransactionTypeField({ currentValue, onChange, + serviceName, }: { currentValue?: string; onChange: (value?: string) => void; + serviceName?: string; }) { const label = i18n.translate('xpack.apm.alerting.fields.type', { defaultMessage: 'Type', @@ -126,6 +131,7 @@ export function TransactionTypeField({ )} start={moment().subtract(24, 'h').toISOString()} end={moment().toISOString()} + serviceName={serviceName} /> ); diff --git a/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx b/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx index 66c8980bf00c6..13b530e0d760f 100644 --- a/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx +++ b/x-pack/plugins/apm/public/components/shared/suggestions_select/index.tsx @@ -23,6 +23,7 @@ interface SuggestionsSelectProps { placeholder: string; dataTestSubj?: string; prepend?: string; + serviceName?: string; } export function SuggestionsSelect({ @@ -38,6 +39,7 @@ export function SuggestionsSelect({ dataTestSubj, isClearable = true, prepend, + serviceName, }: SuggestionsSelectProps) { let defaultOption: EuiComboBoxOptionOption | undefined; @@ -59,11 +61,12 @@ export function SuggestionsSelect({ fieldValue: searchValue, start, end, + serviceName, }, }, }); }, - [fieldName, searchValue, start, end], + [fieldName, searchValue, start, end, serviceName], { preservePreviousData: false } );