refactor: remove onDelete prop from ConditionBranchConfigPanel and associated delete logic in WorkflowConfigPanel

This commit is contained in:
mlogclub
2026-06-30 11:34:41 +08:00
parent b80a7b9ccb
commit fb612eb32e
3 changed files with 0 additions and 29 deletions
@@ -207,14 +207,12 @@ export function ConditionBranchConfigPanel({
branchId, branchId,
variables, variables,
onChange, onChange,
onDelete,
}: { }: {
node: AIWorkflowDefinition["nodes"][number] node: AIWorkflowDefinition["nodes"][number]
nodes: AIWorkflowDefinition["nodes"] nodes: AIWorkflowDefinition["nodes"]
branchId: string branchId: string
variables: WorkflowVariableRef[] variables: WorkflowVariableRef[]
onChange: (nodeId: string, data: AIWorkflowDefinition["nodes"][number]["data"]) => void onChange: (nodeId: string, data: AIWorkflowDefinition["nodes"][number]["data"]) => void
onDelete: (branchId: string) => void
}) { }) {
const config = normalizeNodeConfig(node.data?.config) const config = normalizeNodeConfig(node.data?.config)
const branches = config.branches ?? [] const branches = config.branches ?? []
@@ -279,18 +277,6 @@ export function ConditionBranchConfigPanel({
<ConditionFields branch={branch} variables={variables} onChange={updateBranch} /> <ConditionFields branch={branch} variables={variables} onChange={updateBranch} />
</ConfigCard> </ConfigCard>
)} )}
{branch.default ? null : (
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 px-2 text-xs text-slate-500 hover:text-destructive"
onClick={() => onDelete(branch.id)}
>
</Button>
)}
</div> </div>
) )
} }
@@ -27,7 +27,6 @@ export function WorkflowConfigPanel({
selectedNodeId, selectedNodeId,
selectedBranch, selectedBranch,
onClose, onClose,
onSelectBranch,
onChangeNodeData, onChangeNodeData,
onDeleteNode, onDeleteNode,
}: { }: {
@@ -36,7 +35,6 @@ export function WorkflowConfigPanel({
selectedNodeId: string selectedNodeId: string
selectedBranch: SelectedWorkflowBranch | null selectedBranch: SelectedWorkflowBranch | null
onClose: () => void onClose: () => void
onSelectBranch: (branch: SelectedWorkflowBranch | null) => void
onChangeNodeData: (nodeId: string, data: WorkflowNodeData) => void onChangeNodeData: (nodeId: string, data: WorkflowNodeData) => void
onDeleteNode: (nodeId: string) => void onDeleteNode: (nodeId: string) => void
}) { }) {
@@ -63,17 +61,6 @@ export function WorkflowConfigPanel({
return null return null
} }
const deleteSelectedBranch = (branchId: string) => {
const config = normalizeNodeConfig(selectedNode.data?.config)
onChangeNodeData(selectedNode.id, {
...(selectedNode.data ?? {}),
config: {
...config,
branches: (config.branches ?? []).filter((branch) => branch.id !== branchId),
},
})
onSelectBranch(null)
}
const updatePanelTitle = (title: string) => { const updatePanelTitle = (title: string) => {
if (selectedBranchItem && selectedBranch) { if (selectedBranchItem && selectedBranch) {
const config = normalizeNodeConfig(selectedNode.data?.config) const config = normalizeNodeConfig(selectedNode.data?.config)
@@ -170,7 +157,6 @@ export function WorkflowConfigPanel({
branchId={selectedBranch.branchId} branchId={selectedBranch.branchId}
variables={availableVariables} variables={availableVariables}
onChange={onChangeNodeData} onChange={onChangeNodeData}
onDelete={deleteSelectedBranch}
/> />
) : ( ) : (
<NodeConfigPanel <NodeConfigPanel
@@ -386,7 +386,6 @@ function WorkflowEditorInner({
selectedNodeId={selectedNodeId} selectedNodeId={selectedNodeId}
selectedBranch={selectedBranch} selectedBranch={selectedBranch}
onClose={closeConfigPanel} onClose={closeConfigPanel}
onSelectBranch={onSelectBranch}
onChangeNodeData={updateNodeData} onChangeNodeData={updateNodeData}
onDeleteNode={removeNode} onDeleteNode={removeNode}
/> />