From f7a4a35faa5b99f27796cecad29b5c6c2cf75314 Mon Sep 17 00:00:00 2001 From: Vladimir Filonov Date: Sat, 7 Dec 2024 23:30:53 +0400 Subject: [PATCH] Add Rule.create_on to UI form --- .../CorrelationSidebar/CorrelationForm.tsx | 30 +++++++++++++++---- .../CorrelationSidebarBody.tsx | 2 ++ .../(keep)/rules/CorrelationSidebar/index.tsx | 2 ++ keep-ui/app/(keep)/rules/CorrelationTable.tsx | 1 + keep-ui/utils/hooks/useRules.ts | 1 + tests/test_rules_engine.py | 1 - 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/keep-ui/app/(keep)/rules/CorrelationSidebar/CorrelationForm.tsx b/keep-ui/app/(keep)/rules/CorrelationSidebar/CorrelationForm.tsx index 888ffb5d8..67f2f8d7d 100644 --- a/keep-ui/app/(keep)/rules/CorrelationSidebar/CorrelationForm.tsx +++ b/keep-ui/app/(keep)/rules/CorrelationSidebar/CorrelationForm.tsx @@ -87,7 +87,7 @@ export const CorrelationForm = ({ /> -
+
-
+
( + render={({field: {value, onChange}}) => ( { groupedAttributes: selectedRule.grouping_criteria, requireApprove: selectedRule.require_approve, resolveOn: selectedRule.resolve_on, + createOn: selectedRule.create_on, query: queryInGroup, incidents: selectedRule.incidents, }; diff --git a/keep-ui/utils/hooks/useRules.ts b/keep-ui/utils/hooks/useRules.ts index 957036614..e78f3ed54 100644 --- a/keep-ui/utils/hooks/useRules.ts +++ b/keep-ui/utils/hooks/useRules.ts @@ -18,6 +18,7 @@ export type Rule = { update_time: string | null; require_approve: boolean; resolve_on: "all" | "first" | "last" | "never"; + create_on: "any" | "all"; distribution: { [group: string]: { [timestamp: string]: number } }; incidents: number; }; diff --git a/tests/test_rules_engine.py b/tests/test_rules_engine.py index 235b07ce9..7401550ce 100644 --- a/tests/test_rules_engine.py +++ b/tests/test_rules_engine.py @@ -7,7 +7,6 @@ import pytest -from boom import fingerprint from keep.api.core.db import create_rule as create_rule_db from keep.api.core.db import get_incident_alerts_by_incident_id, get_last_incidents, set_last_alert from keep.api.core.db import get_rules as get_rules_db