feat: rename input to inputs, output to outputs

This commit is contained in:
Fu Diwei 2025-01-04 16:41:30 +08:00
parent ae11d5ee3d
commit 01ede08a79
4 changed files with 14 additions and 14 deletions

View File

@ -32,12 +32,12 @@ type Workflow struct {
} }
type WorkflowNode struct { type WorkflowNode struct {
Id string `json:"id"` Id string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Next *WorkflowNode `json:"next"` Next *WorkflowNode `json:"next"`
Config map[string]any `json:"config"` Config map[string]any `json:"config"`
Input []WorkflowNodeIO `json:"input"` Inputs []WorkflowNodeIO `json:"inputs"`
Output []WorkflowNodeIO `json:"output"` Outputs []WorkflowNodeIO `json:"outputs"`
Validated bool `json:"validated"` Validated bool `json:"validated"`
Type string `json:"type"` Type string `json:"type"`

View File

@ -88,7 +88,7 @@ func (a *applyNode) Run(ctx context.Context) error {
NodeId: a.node.Id, NodeId: a.node.Id,
Node: a.node, Node: a.node,
Succeeded: true, Succeeded: true,
Outputs: a.node.Output, Outputs: a.node.Outputs,
} }
certX509, err := x509.ParseCertificateFromPEM(certificate.Certificate) certX509, err := x509.ParseCertificateFromPEM(certificate.Certificate)

View File

@ -237,7 +237,7 @@ const DeployNodeForm = ({ node }: DeployFormProps) => {
options={previousOutput.map((item) => { options={previousOutput.map((item) => {
return { return {
label: item.name, label: item.name,
options: item.output?.map((output) => { options: item.outputs?.map((output) => {
return { return {
label: `${item.name} - ${output.label}`, label: `${item.name} - ${output.label}`,
value: `${item.id}#${output.name}`, value: `${item.id}#${output.name}`,

View File

@ -83,8 +83,8 @@ export type WorkflowNode = {
type: WorkflowNodeType; type: WorkflowNodeType;
config?: Record<string, unknown>; config?: Record<string, unknown>;
input?: WorkflowNodeIO[]; inputs?: WorkflowNodeIO[];
output?: WorkflowNodeIO[]; outputs?: WorkflowNodeIO[];
next?: WorkflowNode; next?: WorkflowNode;
branches?: WorkflowNode[]; branches?: WorkflowNode[];
@ -191,8 +191,8 @@ export const newNode = (nodeType: WorkflowNodeType, options: NewNodeOptions = {}
case WorkflowNodeType.Deploy: case WorkflowNodeType.Deploy:
{ {
node.config = {} as Record<string, unknown>; node.config = {} as Record<string, unknown>;
node.input = workflowNodeTypeDefaultInputs.get(nodeType); node.inputs = workflowNodeTypeDefaultInputs.get(nodeType);
node.output = workflowNodeTypeDefaultOutputs.get(nodeType); node.outputs = workflowNodeTypeDefaultOutputs.get(nodeType);
} }
break; break;
@ -347,10 +347,10 @@ export const getWorkflowOutputBeforeId = (node: WorkflowNode, id: string, type:
return true; 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({ output.push({
...current, ...current,
output: current.output.filter((io) => io.type === type), outputs: current.outputs.filter((io) => io.type === type),
}); });
} }