Skip to content

[suggestion] flatNodes and treeNodes #46

Closed
@fabrifls

Description

@fabrifls

I see that the nodes (FlowNodeJSON) don't have an attribute like "path" that indicates their position in the tree.

This is very useful when we need to save all the nodes in a database. Let's imagine a scenario where we have many flows, and each flow can contain many nodes.
To save in the database, each node (a Document) can have infinite nested nodes, and each Document can have a storage limit.

So, having a flatNodes(treeNodes) function that converts the tree into a complete list of nodes (each node having its own 'path') would be much simpler and more optimal for saving in the database. Each node would be a Document (without nesting).

So, when we need to retrieve the nodes for a certain flowId, what we would do is use another function, treeNodes(flatNodes), to convert the list to a tree.

flatNodes (same level, to save in db):

|->node1
|->node2
|->node2_1
|->node2_2
|->node3

treeNodes (to use in component):

|->node1
|->node2
      |->node2_1
      |->node2_2
|->node3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions