Skip to content

Commit

Permalink
removed Generate Message Button
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <riysaxen@amazon.com>
  • Loading branch information
riysaxen-amzn committed Jun 18, 2024
1 parent e8a72d7 commit aaf938b
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions public/pages/Correlations/containers/CreateCorrelationRule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,6 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
});
}, [initialValues, notificationChannels]);


const onNotificationChannelsChange = (selectedOptions: EuiComboBoxOptionOption<string>[], trigger: CorrelationRuleTrigger) => {
const updatedTrigger = { ...trigger };

// Update actions directly
if (updatedTrigger.actions && updatedTrigger.actions.length > 0) {
if (selectedOptions.length > 0 && selectedOptions[0].value !== undefined) {
updatedTrigger.actions[0].destination_id = selectedOptions[0].value;
} else {
updatedTrigger.actions[0].destination_id = '';
}
}
// Update trigger state directly
trigger.actions = updatedTrigger.actions; // Directly updating state
};

const onMessageSubjectChange = (subject: string) => {
const newActions = initialValues?.trigger?.actions;
if (newActions) {
Expand Down Expand Up @@ -384,6 +368,12 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
// Set default values for ids
values.trigger.id = randomTriggerId;
values.trigger.ids?.push(randomTriggerId);
if (!values.trigger.severity) {
values.trigger.severity = ALERT_SEVERITY_OPTIONS.HIGHEST.value;
}
if (!values.trigger.name) {
values.trigger.name = `trigger-${randomTriggerId}`;
}
// Set default values for actions if present
if (values.trigger.actions) {
values.trigger.actions.forEach((action) => {
Expand Down Expand Up @@ -864,7 +854,6 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
errors.name = 'Invalid rule name.';
}
}

if (
Number.isNaN(values.time_window) ||
values.time_window > 86400000 ||
Expand Down Expand Up @@ -1036,6 +1025,7 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
props.setFieldValue('trigger.name', triggerName)
}}
value={trigger?.name}
required={true}
data-test-subj="alert-condition-name"
/>
</EuiFormRow>
Expand Down Expand Up @@ -1197,14 +1187,6 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
/>
</EuiFormRow>
</EuiFlexItem>

<EuiFlexItem>
<EuiFormRow>
<EuiButton fullWidth={false} onClick={() => prepareMessage(true)}>
Generate message
</EuiButton>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
</EuiAccordion>

Expand Down

0 comments on commit aaf938b

Please sign in to comment.