From ee030bd5e41f82bc98e52d0d7997f4c8bd46202a Mon Sep 17 00:00:00 2001 From: Mohammad Qureshi Date: Wed, 1 Sep 2021 21:25:38 -0700 Subject: [PATCH] Update formik conversion for Bucket-Level Trigger to handle throttle change Signed-off-by: Mohammad Qureshi --- .../components/Action/actions/Message.js | 11 ++++++----- .../containers/CreateTrigger/utils/formikToTrigger.js | 11 ++--------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/public/pages/CreateTrigger/components/Action/actions/Message.js b/public/pages/CreateTrigger/components/Action/actions/Message.js index 60ef73195..f09fcd176 100644 --- a/public/pages/CreateTrigger/components/Action/actions/Message.js +++ b/public/pages/CreateTrigger/components/Action/actions/Message.js @@ -162,9 +162,10 @@ export default function Message( const isBucketLevelMonitor = _.get(context, 'ctx.monitor.monitor_type', MONITOR_TYPE.QUERY_LEVEL) === MONITOR_TYPE.BUCKET_LEVEL; + const actionPath = `${fieldPath}actions.${index}`; const actionExecutionPolicyPath = isBucketLevelMonitor - ? `${fieldPath}actions.${index}.action_execution_policy` - : `${fieldPath}actions.${index}`; + ? `${actionPath}.action_execution_policy` + : actionPath; let actionExecutionScopeId = isBucketLevelMonitor ? _.get( @@ -182,8 +183,8 @@ export default function Message( ); if (actionExecutionScopeId === NOTIFY_OPTIONS_VALUES.PER_ALERT) { - if (_.get(values, `${actionExecutionPolicyPath}.throttle.value`) === undefined) { - _.set(values, `${actionExecutionPolicyPath}.throttle.value`, 10); + if (_.get(values, `${actionPath}.throttle.value`) === undefined) { + _.set(values, `${actionPath}.throttle.value`, 10); } if (actionableAlertsSelections === undefined) { @@ -390,7 +391,7 @@ export default function Message(