feat: enhance condition node functionality with branches and validation

- Introduced WorkflowConditionBranch and WorkflowNodeConfig types to manage condition branches in nodes.
- Updated NodeConfigPanel and ConditionNodePanel components to support adding, editing, and deleting branches.
- Implemented validation for condition nodes to ensure at least one branch exists and that default branches are correctly configured.
- Modified workflow-utils to handle condition branches and updated toApiDefinition and fromApiDefinition functions to maintain branch integrity during serialization.
- Removed edge condition handling from WorkflowEditor and related components, simplifying edge management.
- Added tests to ensure condition branches are preserved in API definitions.
This commit is contained in:
mlogclub
2026-06-25 21:08:59 +08:00
parent 072c2f0105
commit b806a2208b
12 changed files with 745 additions and 511 deletions
+15 -4
View File
@@ -24,10 +24,21 @@ type Position struct {
}
type Edge struct {
ID string `json:"id"`
Source string `json:"source"`
Target string `json:"target"`
Condition *Condition `json:"condition,omitempty"`
ID string `json:"id"`
Source string `json:"source"`
Target string `json:"target"`
}
type ConditionConfig struct {
Branches []ConditionBranch `json:"branches,omitempty"`
}
type ConditionBranch struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
TargetNodeID string `json:"targetNodeId"`
Condition *Condition `json:"condition,omitempty"`
Default bool `json:"default,omitempty"`
}
type Condition struct {