mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* [APM] fix bug where flyout state did not reflect the currently selected agent config * removed commented code
This commit is contained in:
parent
c1cbeb8bf3
commit
ed18864ae2
3 changed files with 19 additions and 3 deletions
|
@ -18,7 +18,7 @@ import {
|
|||
EuiButtonEmpty,
|
||||
EuiCallOut
|
||||
} from '@elastic/eui';
|
||||
import React, { useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
|
@ -56,6 +56,7 @@ export function AddSettingsFlyout({
|
|||
? selectedConfig.settings.transaction_sample_rate.toString()
|
||||
: ''
|
||||
);
|
||||
|
||||
const { data: serviceNames = [], status: serviceNamesStatus } = useFetcher(
|
||||
() =>
|
||||
callApmApi({
|
||||
|
@ -89,6 +90,18 @@ export function AddSettingsFlyout({
|
|||
env.name === environment && (Boolean(selectedConfig) || env.available)
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedConfig) {
|
||||
setEnvironment(selectedConfig.service.environment);
|
||||
setServiceName(selectedConfig.service.name);
|
||||
setSampleRate(selectedConfig.settings.transaction_sample_rate.toString());
|
||||
} else {
|
||||
setEnvironment(ENVIRONMENT_NOT_DEFINED);
|
||||
setServiceName(undefined);
|
||||
setSampleRate('');
|
||||
}
|
||||
}, [selectedConfig]);
|
||||
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -157,7 +157,11 @@ export function AddSettingFlyoutBody({
|
|||
placeholder={selectPlaceholderLabel}
|
||||
isLoading={environmentStatus === 'loading'}
|
||||
options={environmentOptions}
|
||||
value={environment}
|
||||
value={
|
||||
selectedConfig
|
||||
? environment || ENVIRONMENT_NOT_DEFINED
|
||||
: environment
|
||||
}
|
||||
disabled={!serviceName || Boolean(selectedConfig)}
|
||||
onChange={e => {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -52,7 +52,6 @@ export function Settings() {
|
|||
);
|
||||
|
||||
const hasConfigurations = !isEmpty(data);
|
||||
|
||||
return (
|
||||
<>
|
||||
<AddSettingsFlyout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue