From d3eef75481af1165d477578fecd917afe2713b8d Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Thu, 10 Apr 2025 16:27:18 +0000 Subject: [PATCH] Improve dynamic group rule editor to correctly handle connection IDs. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 705f2157-ef97-4fbd-89e4-8c7f2ecaea90 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7ed01c5f-a82d-405a-b728-b2e3d127c60c/b6bb9e86-10d4-45d0-8f83-e336d9109dfa.jpg --- .../components/dynamic-groups/rule-editor.tsx | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/client/src/components/dynamic-groups/rule-editor.tsx b/client/src/components/dynamic-groups/rule-editor.tsx index d861d19..f7a0877 100644 --- a/client/src/components/dynamic-groups/rule-editor.tsx +++ b/client/src/components/dynamic-groups/rule-editor.tsx @@ -47,9 +47,25 @@ interface RuleEditorProps { onCancel: () => void; } -// Extend the DynamicGroupRule type to include connectionIds for frontend use -interface ExtendedDynamicGroupRule extends DynamicGroupRule { - connectionIds?: number[]; +// Define a custom type matching what the onSave function expects +interface DynamicGroupRuleWithConnectionIds { + id: number; + name: string; + description: string | null; + targetGroup: string; + enabled: boolean; + schedule: string; + createdAt: Date; + updatedAt: Date; + lastRun: Date | null; + lastRunStatus: string | null; + variablePattern: string | null; + useAdvancedScheduling: boolean; + createGroupIfNotExists: boolean; + createOUIfNotExists: boolean; + createGroupForEachAttributeValue: boolean; + createOUForEachAttributeValue: boolean; + connectionIds: number[]; } export const RuleEditor: React.FC = ({ rule, onSave, onCancel }) => { @@ -237,7 +253,7 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } const targetGroupDN = getTargetGroupDN(); - const ruleData: ExtendedDynamicGroupRule = { + const ruleData: DynamicGroupRuleWithConnectionIds = { id: rule?.id || 0, // Default to 0 for new records name: formData.name, description: formData.description || null, @@ -252,7 +268,9 @@ export const RuleEditor: React.FC = ({ rule, onSave, onCancel } createGroupIfNotExists: formData.createGroupIfNotExists, createOUIfNotExists: formData.createOUIfNotExists, createGroupForEachAttributeValue: formData.createGroupForEachAttributeValue, - createOUForEachAttributeValue: formData.createOUForEachAttributeValue + createOUForEachAttributeValue: formData.createOUForEachAttributeValue, + schedule: rule?.schedule || "0 0 * * *", // Default: daily at midnight + useAdvancedScheduling: rule?.useAdvancedScheduling || false }; onSave(ruleData, schedules);