diff --git a/public/pages/Correlations/containers/CreateCorrelationRule.tsx b/public/pages/Correlations/containers/CreateCorrelationRule.tsx index 7cc6fd17..cd5175c8 100644 --- a/public/pages/Correlations/containers/CreateCorrelationRule.tsx +++ b/public/pages/Correlations/containers/CreateCorrelationRule.tsx @@ -243,7 +243,6 @@ export const CreateCorrelationRule: React.FC = ( setInitialValues(ruleRes); } }; - setAction('Edit'); setInitialRuleValues(); } @@ -1064,7 +1063,11 @@ export const CreateCorrelationRule: React.FC = ( 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); + }} /> diff --git a/public/store/CorrelationsStore.ts b/public/store/CorrelationsStore.ts index 4c0e81f9..b1d3b4b7 100644 --- a/public/store/CorrelationsStore.ts +++ b/public/store/CorrelationsStore.ts @@ -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 }; } @@ -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 }; }); } diff --git a/types/Correlations.ts b/types/Correlations.ts index 0e35c25e..51881e6d 100644 --- a/types/Correlations.ts +++ b/types/Correlations.ts @@ -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 { @@ -76,7 +76,7 @@ export interface CorrelationRuleSource { name: string; time_window: number; correlate: CorrelationRuleSourceQueries[]; - trigger?: CorrelationRuleTrigger | undefined; + trigger?: CorrelationRuleTrigger; } export interface CorrelationRuleHit {