From fb7e285611403d56edb9d49374a92abda976c56f Mon Sep 17 00:00:00 2001 From: cauemarcondes Date: Mon, 4 May 2020 13:13:28 +0200 Subject: [PATCH] accept number and string on amountAndUnitToString --- .../apm/common/agent_configuration/amount_and_unit.ts | 5 ++++- .../SettingsPage/SettingFormRow.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/apm/common/agent_configuration/amount_and_unit.ts b/x-pack/plugins/apm/common/agent_configuration/amount_and_unit.ts index 53d6ea49af8e0..cd64b3025a65b 100644 --- a/x-pack/plugins/apm/common/agent_configuration/amount_and_unit.ts +++ b/x-pack/plugins/apm/common/agent_configuration/amount_and_unit.ts @@ -15,6 +15,9 @@ export function amountAndUnitToObject(value: string): AmountAndUnit { return { amount: parseInt(amount, 10), unit }; } -export function amountAndUnitToString({ amount, unit }: AmountAndUnit) { +export function amountAndUnitToString({ + amount, + unit +}: Omit & { amount: string | number }) { return `${amount}${unit}`; } diff --git a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingFormRow.tsx b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingFormRow.tsx index ff756fea3b3ce..6711fecc2376c 100644 --- a/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingFormRow.tsx +++ b/x-pack/plugins/apm/public/components/app/Settings/AgentConfigurations/AgentConfigurationCreateEdit/SettingsPage/SettingFormRow.tsx @@ -97,7 +97,7 @@ function FormRow({ onChange( setting.key, amountAndUnitToString({ - amount: parseInt(e.target.value, 10), + amount: e.target.value, unit }) )