rete icon indicating copy to clipboard operation
rete copied to clipboard

Create a node for looping over code with conditions

Open akshayred opened this issue 6 years ago • 9 comments

Hello, Thanks for all the good work you are doing with rete js. We are using your library for one Drupal 8 module. And it is getting a good response. Here is the link for the module which we are working on https://www.drupal.org/project/if_then_else

We need some help with one functionality which we want to have in our module. We want a loop type of functionality that can loop over a set of nodes. We can handle the programmatic part of it but we need help with UI. We need a node that can hold a set of other nodes in it. I am attaching an image of a rough idea of what we need. Can you please help me with how I can proceed with it?

Loop.pdf

akshayred avatar Oct 21 '19 17:10 akshayred

https://github.com/retejs/rete/issues/243#issuecomment-457853921

Ni55aN avatar Oct 22 '19 07:10 Ni55aN

Hi, Thanks for sharing the other issue which is related to this. I did try what was given there but I think that won't work for my case. The problem is in our module we are not using retejs to do any processing. It is only used for creating a flow of events, actions, and conditions. With foreach node, I want to loop over a subset of nodes that are connected with that foreach. Now there could be multiple foreach nodes in the same graph. The problem is I am not able to make a decision programmatically, which all nodes are to be processed in foreach. So what I was thinking to have a different type of node which can hold a subset of nodes inside it and somehow in the JSON we know that which set of nodes are inside that special type of node. Can you please provide me some direction on how we can achieve that? I have attached a screenshot of what I am visualizing as what that special type of node would look. Let me know if that is possible somehow in retejs?

Thanks

akshayred avatar Nov 08 '19 07:11 akshayred

@akshayred

We can handle the programmatic part of it but we need help with UI. We need a node that can hold a set of other nodes in it.

There is no implementation for this case. Maybe the plugin module will solve your problem

Ni55aN avatar Nov 09 '19 21:11 Ni55aN

@Ni55aN I did check the plugin module as you suggested. Can you help me how I we can add a new node type to it. I think the current node defined there is for normal node and for the loop node we might have to define a totally new node type.

akshayred avatar Nov 15 '19 06:11 akshayred

I do not know how your implementation works. I can only suggest making a loop node as in the example:https://codepen.io/Ni55aN/pen/KJVEMe

Ni55aN avatar Nov 20 '19 15:11 Ni55aN

Hi , I am trying to compile rete example using gulp-babel and use the bundled file in html but I am getting error in console - "ReferenceError: require is not defined". Am I doing something wrong ??

akshayred avatar Dec 02 '19 10:12 akshayred

@Ni55aN Can you help me with understanding how the current node is being generated. Is it called by the area or by editor. I am thinking to create another implementation of node which should be able to include other nodes inside it.

akshayred avatar Dec 02 '19 13:12 akshayred

ReferenceError: require is not defined

It seems that gulp-babel import CommonJS dependencies and doesn't transpile them completely into iife bundle

Ni55aN avatar Dec 06 '19 12:12 Ni55aN

Can you help me with understanding how the current node is being generated

rete creates HTMLElement for node

NodeEditor -> addNode -> EditorView -> addNode-> new NodeView() -> triggerrendernode` -> rete-*-render-plugin insert content into this element

I am thinking to create another implementation of node which should be able to include other nodes inside it.

I think a custom node will solve your issue

Ni55aN avatar Dec 06 '19 12:12 Ni55aN

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]