Skip to content

Commit

Permalink
edit correlation rule trigger fix
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <[email protected]>
  • Loading branch information
riysaxen-amzn committed Oct 9, 2024
1 parent 619b8cc commit 625c54a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 10 additions & 8 deletions public/pages/Correlations/containers/CreateCorrelationRule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,20 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
setNotificationChannels(parsedChannels);
setLoadingNotifications(false);
};
const setInitialRuleValues = async (ruleId: string) => {
const ruleRes = await correlationStore.getCorrelationRule(ruleId);
if (ruleRes) {
setInitialValues(ruleRes);
}
};

if (props.history.location.state?.rule) {
setAction('Edit');
setInitialRuleValues(props.history.location.state?.rule.id);
setInitialValues(props.history.location.state?.rule);
} else if (params.ruleId) {
setInitialRuleValues(params.ruleId);
const setInitialRuleValues = async () => {
const ruleRes = await correlationStore.getCorrelationRule(params.ruleId);
if (ruleRes) {
setInitialValues(ruleRes);
}
};

setAction('Edit');
setInitialRuleValues();
}

const setupLogTypeOptions = async () => {
Expand Down
1 change: 1 addition & 0 deletions public/store/CorrelationsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export class CorrelationsStore implements ICorrelationsStore {
name: hit._source.name,
time_window: hit._source.time_window || 300000,
queries,
trigger: hit._source?.trigger
};
});
}
Expand Down

0 comments on commit 625c54a

Please sign in to comment.