From c8d254ee893e20d3288a20f5cac393019d52b9af Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Tue, 7 May 2024 10:06:15 +0300 Subject: [PATCH] fix(ui): edit correlation group when only 1 group exists --- keep-ui/app/rules/CorrelationTable.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/keep-ui/app/rules/CorrelationTable.tsx b/keep-ui/app/rules/CorrelationTable.tsx index 0f33a14b2..cb0470a5f 100644 --- a/keep-ui/app/rules/CorrelationTable.tsx +++ b/keep-ui/app/rules/CorrelationTable.tsx @@ -43,18 +43,18 @@ export const CorrelationTable = ({ rules }: CorrelationTableProps) => { const correlationFormFromRule: CorrelationForm = useMemo(() => { if (selectedRule) { const query = parseCEL(selectedRule.definition_cel); + const anyCombinator = query.rules.some((rule) => "combinator" in rule); const queryInGroup: DefaultRuleGroupType = { ...query, - rules: - query.rules.length > 1 - ? query.rules - : [ - { - combinator: "and", - rules: query.rules, - }, - ], + rules: anyCombinator + ? query.rules + : [ + { + combinator: "and", + rules: query.rules, + }, + ], }; return {