Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.15] edit correlation Alert Trigger fix #1182

Merged
merged 1 commit into from
Oct 10, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ export const CreateCorrelationRule: React.FC<CreateCorrelationRuleProps> = (
setInitialValues(ruleRes);
}
};

setAction('Edit');
setInitialRuleValues();
}
Expand Down Expand Up @@ -1064,7 +1063,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);
}}
/>
</EuiFormRow>
</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 @@ -148,6 +148,7 @@ export class CorrelationsStore implements ICorrelationsStore {
name: hit._source.name,
time_window: hit._source.time_window || 300000,
queries,
trigger: hit._source?.trigger
};
}

Expand All @@ -173,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
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
Loading