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
This commit is contained in:
alphaeusmote
2025-04-10 16:27:18 +00:00
@@ -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<RuleEditorProps> = ({ rule, onSave, onCancel }) => {
@@ -237,7 +253,7 @@ export const RuleEditor: React.FC<RuleEditorProps> = ({ 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<RuleEditorProps> = ({ 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);