From 01ede08a7938d240637fd9486994e4efe5640584 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Sat, 4 Jan 2025 16:41:30 +0800 Subject: [PATCH] feat: rename `input` to `inputs`, `output` to `outputs` --- internal/domain/workflow.go | 12 ++++++------ internal/workflow/node-processor/apply_node.go | 2 +- ui/src/components/workflow/node/DeployNodeForm.tsx | 2 +- ui/src/domain/workflow.ts | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/domain/workflow.go b/internal/domain/workflow.go index 2257cddc..302a58a3 100644 --- a/internal/domain/workflow.go +++ b/internal/domain/workflow.go @@ -32,12 +32,12 @@ type Workflow struct { } type WorkflowNode struct { - Id string `json:"id"` - Name string `json:"name"` - Next *WorkflowNode `json:"next"` - Config map[string]any `json:"config"` - Input []WorkflowNodeIO `json:"input"` - Output []WorkflowNodeIO `json:"output"` + Id string `json:"id"` + Name string `json:"name"` + Next *WorkflowNode `json:"next"` + Config map[string]any `json:"config"` + Inputs []WorkflowNodeIO `json:"inputs"` + Outputs []WorkflowNodeIO `json:"outputs"` Validated bool `json:"validated"` Type string `json:"type"` diff --git a/internal/workflow/node-processor/apply_node.go b/internal/workflow/node-processor/apply_node.go index ea832f44..45ecf627 100644 --- a/internal/workflow/node-processor/apply_node.go +++ b/internal/workflow/node-processor/apply_node.go @@ -88,7 +88,7 @@ func (a *applyNode) Run(ctx context.Context) error { NodeId: a.node.Id, Node: a.node, Succeeded: true, - Outputs: a.node.Output, + Outputs: a.node.Outputs, } certX509, err := x509.ParseCertificateFromPEM(certificate.Certificate) diff --git a/ui/src/components/workflow/node/DeployNodeForm.tsx b/ui/src/components/workflow/node/DeployNodeForm.tsx index 364e26a5..e075a841 100644 --- a/ui/src/components/workflow/node/DeployNodeForm.tsx +++ b/ui/src/components/workflow/node/DeployNodeForm.tsx @@ -237,7 +237,7 @@ const DeployNodeForm = ({ node }: DeployFormProps) => { options={previousOutput.map((item) => { return { label: item.name, - options: item.output?.map((output) => { + options: item.outputs?.map((output) => { return { label: `${item.name} - ${output.label}`, value: `${item.id}#${output.name}`, diff --git a/ui/src/domain/workflow.ts b/ui/src/domain/workflow.ts index afb47ac1..f90854a3 100644 --- a/ui/src/domain/workflow.ts +++ b/ui/src/domain/workflow.ts @@ -83,8 +83,8 @@ export type WorkflowNode = { type: WorkflowNodeType; config?: Record; - input?: WorkflowNodeIO[]; - output?: WorkflowNodeIO[]; + inputs?: WorkflowNodeIO[]; + outputs?: WorkflowNodeIO[]; next?: WorkflowNode; branches?: WorkflowNode[]; @@ -191,8 +191,8 @@ export const newNode = (nodeType: WorkflowNodeType, options: NewNodeOptions = {} case WorkflowNodeType.Deploy: { node.config = {} as Record; - node.input = workflowNodeTypeDefaultInputs.get(nodeType); - node.output = workflowNodeTypeDefaultOutputs.get(nodeType); + node.inputs = workflowNodeTypeDefaultInputs.get(nodeType); + node.outputs = workflowNodeTypeDefaultOutputs.get(nodeType); } break; @@ -347,10 +347,10 @@ export const getWorkflowOutputBeforeId = (node: WorkflowNode, id: string, type: return true; } - if (current.type !== WorkflowNodeType.Branch && current.output && current.output.some((io) => io.type === type)) { + if (current.type !== WorkflowNodeType.Branch && current.outputs && current.outputs.some((io) => io.type === type)) { output.push({ ...current, - output: current.output.filter((io) => io.type === type), + outputs: current.outputs.filter((io) => io.type === type), }); }