Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic created node based on connector #423

Open
igmt opened this issue Aug 7, 2024 · 1 comment
Open

Dynamic created node based on connector #423

igmt opened this issue Aug 7, 2024 · 1 comment
Labels
qa Questions on how to use Baklava

Comments

@igmt
Copy link

igmt commented Aug 7, 2024

First of all thanks for your work on this great package!

I have a use-case where I have a "source" node and "destination" node.
A source node has a set of fields that need to be mapped to the fields in the destination node.

Would it be possible to create a dynamic "Mapping" node when the user connects the source node with the destination node?
The mapping node should then be placed in between the source and destination nodes.

So from this:
image

To this:
image

@newcat
Copy link
Owner

newcat commented Oct 22, 2024

It is probably possible, but I don't know an easy solution. In your mapping node, you essentially have to check which nodes it is connected to. This can be achieved by subscribing to the setConnectionCount event of your input/output interfaces of the mapping node. Then you can use the graph instance (the AbstractNode has the graph property so you can access it via this.graph) to find the nodes connected to the mapping node and create the mapping interfaces dynamically. This also includes custom logic for saving and loading. The Advanced Node in the playground is a much more simple example compared to your use case, but maybe it helps you get some ideas on how to do it.

@newcat newcat added the qa Questions on how to use Baklava label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa Questions on how to use Baklava
Projects
None yet
Development

No branches or pull requests

2 participants