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 {
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"`

View File

@ -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)

View File

@ -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}`,

View File

@ -83,8 +83,8 @@ export type WorkflowNode = {
type: WorkflowNodeType;
config?: Record<string, unknown>;
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<string, unknown>;
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),
});
}