|
@@ -46,14 +46,14 @@ spec:
|
|
supplied: {}`
|
|
supplied: {}`
|
|
|
|
|
|
type Flow struct {
|
|
type Flow struct {
|
|
- Name string
|
|
|
|
- ChildNodes []Node
|
|
|
|
|
|
+ name string
|
|
|
|
+ childNodes []Node
|
|
}
|
|
}
|
|
|
|
|
|
func NewFlow(name string, childNodes ...Node) *Flow {
|
|
func NewFlow(name string, childNodes ...Node) *Flow {
|
|
return &Flow{
|
|
return &Flow{
|
|
- Name: name,
|
|
|
|
- ChildNodes: childNodes,
|
|
|
|
|
|
+ name: name,
|
|
|
|
+ childNodes: childNodes,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -65,9 +65,17 @@ func (flow *Flow) GetWhen() string {
|
|
return ""
|
|
return ""
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (flow *Flow) AddNodes(childNodes ...Node) *Flow {
|
|
|
|
+ if childNodes == nil || len(childNodes) == 0 {
|
|
|
|
+ flow.childNodes = append(flow.childNodes, childNodes...)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return flow
|
|
|
|
+}
|
|
|
|
+
|
|
func (flow *Flow) Render(_ Node) (string, error) {
|
|
func (flow *Flow) Render(_ Node) (string, error) {
|
|
childNodesContents := make([]string, 0)
|
|
childNodesContents := make([]string, 0)
|
|
- for i, childNode := range flow.ChildNodes {
|
|
|
|
|
|
+ for i, childNode := range flow.childNodes {
|
|
var childNodeContent string
|
|
var childNodeContent string
|
|
|
|
|
|
if i == 0 {
|
|
if i == 0 {
|
|
@@ -78,7 +86,7 @@ func (flow *Flow) Render(_ Node) (string, error) {
|
|
|
|
|
|
childNodeContent = content
|
|
childNodeContent = content
|
|
} else {
|
|
} else {
|
|
- content, err := childNode.Render(flow.ChildNodes[i-1])
|
|
|
|
|
|
+ content, err := childNode.Render(flow.childNodes[i-1])
|
|
if err != nil {
|
|
if err != nil {
|
|
return "", err
|
|
return "", err
|
|
}
|
|
}
|
|
@@ -90,7 +98,7 @@ func (flow *Flow) Render(_ Node) (string, error) {
|
|
}
|
|
}
|
|
|
|
|
|
return render("flow", flowTemplate, map[string]any{
|
|
return render("flow", flowTemplate, map[string]any{
|
|
- "name": flow.Name,
|
|
|
|
|
|
+ "name": flow.name,
|
|
"childNodesContentLines": childNodesContents,
|
|
"childNodesContentLines": childNodesContents,
|
|
})
|
|
})
|
|
}
|
|
}
|