Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions public/pages/CreateTrigger/components/Action/actions/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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) {
Expand Down Expand Up @@ -390,7 +391,7 @@ export default function Message(
<EuiFlexItem grow={false} style={{ marginRight: '0px' }}>
<EuiFormRow label="Throttle actions to only trigger every">
<FormikFieldNumber
name={`${actionExecutionPolicyPath}.throttle.value`}
name={`${actionPath}.throttle.value`}
fieldProps={{ validate: validateActionThrottle(action) }}
formRow={true}
rowProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,10 @@ export function formikToBucketLevelTriggerAction(values) {

switch (formattedAction.throttle_enabled) {
case true:
_.set(
formattedAction,
'action_execution_policy.throttle.unit',
FORMIK_INITIAL_ACTION_VALUES.throttle.unit
);
_.set(formattedAction, 'throttle.unit', FORMIK_INITIAL_ACTION_VALUES.throttle.unit);
break;
case false:
formattedAction = _.omit(formattedAction, [
'throttle',
`${executionPolicyPath}.throttle`,
]);
formattedAction = _.omit(formattedAction, ['throttle']);
break;
}

Expand Down