Skip to content

Commit

Permalink
edit correlation Alert Trigger fix (#1180) (#1184)
Browse files Browse the repository at this point in the history
* edit correlation Alert Trigger fix



* delete correlation alert trigger fix



* delete correlation alert trigger fix



* edit correlation rule trigger fix



* edit correlation rule trigger fix



* edit correlation rule trigger fix



* extra spacing removed



---------


(cherry picked from commit 8220c38)

Signed-off-by: Riya Saxena <riysaxen@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7d22d22 commit bdffca4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
setInitialValues(ruleRes);
}
};

setAction('Edit');
setInitialRuleValues();
}
Expand Down Expand Up @@ -1079,7 +1078,11 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
data-test-subj="delete-alert-trigger-icon"
iconType="trash"
color="danger"
onClick={() => setShowForm(false)}
onClick={() => {
// Clear the trigger values by setting them to an empty object or your initial state
props.setFieldValue('trigger', {});
setShowForm(false);
}}
/>
</EuiCompressedFormRow>
</EuiFlexItem>
Expand Down
2 changes: 2 additions & 0 deletions public/store/CorrelationsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export class CorrelationsStore implements ICorrelationsStore {
name: hit._source.name,
time_window: hit._source.time_window || 300000,
queries,
trigger: hit._source?.trigger
};
}

Expand All @@ -175,6 +176,7 @@ export class CorrelationsStore implements ICorrelationsStore {
name: hit._source.name,
time_window: hit._source.time_window || 300000,
queries,
trigger: hit._source?.trigger
};
});
}
Expand Down
4 changes: 2 additions & 2 deletions types/Correlations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface CorrelationRuleModel {
name: string;
time_window: number; // Time in milliseconds
queries: CorrelationRuleQuery[];
trigger: CorrelationRuleTrigger | undefined;
trigger?: CorrelationRuleTrigger;
}

export interface CorrelationRule extends CorrelationRuleModel {
Expand All @@ -76,7 +76,7 @@ export interface CorrelationRuleSource {
name: string;
time_window: number;
correlate: CorrelationRuleSourceQueries[];
trigger?: CorrelationRuleTrigger | undefined;
trigger?: CorrelationRuleTrigger;
}

export interface CorrelationRuleHit {
Expand Down

0 comments on commit bdffca4

Please sign in to comment.