question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FeatureRequest: Dynamically allow changing nodes

See original GitHub issue

Just started working with baklavajs, and it is a great project!

It would be nice however to allow to dynamically change the layout of a node during runtime. Based on an IntegerOption or SelectOption have the number of outputs that have been entered / selected For example:

  constructor() {
    super();
    this.type = 'SplitterNode';
    this.name = 'Splitter';
    this.addInputInterface('Source');
    this.addOption('NrOutputs', 'SelectOption', '4', undefined, {
      items: ['2', '4', '6', '8', '16'],
    });
  }
  calculate() {
    const outputs = this.getOptionValue('NrOutputs');
     outputs.forEach(() => {
       this.addOutputInterface('outputPort');
     });
  }

However, this example does not work, nor when just trying to add a single output (without the .forEach) in the calculate() function.

Use case for me: Not for passing “real data” through the nodes, just as a visual representation of systems / software connected to each other. However this functionality could be useful for other use cases as well, where a calculation may output multiple results and these want to be received on multiple outputs, dynamically based on a selection done on the node. This reduces the need to have dozens of nodes that do basically the same thing, but the only difference is the number of outputs.

Is that possible and within your scope of the project? Thank you

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DJManuelcommented, Mar 17, 2021

Hello @LukasLoeffler ,

Thank you very much for this suggestion. Based on that, I’ve created a fork of the Sandbox with added functionnality. I extended it so that not only adding outputs is possible, but also removing then (when selecting a smaller number in the selection). Additionally make the numbering more “human friendly” with starting at 1 instead of 0.

I completely understand that this is a bit hacky, however as an intermediate solution this works fine for me. I am rather new to JS, so my implementation may not be that good. Long-term it would be however very useful to have this functionality in the library itself.

Thank you very much!

0reactions
newcatcommented, Dec 6, 2021

@dev-dsp Does the code I posted here work for you? You need to click on “JavaScript Splitter Node” to expand it; then you’ll see the JS code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FR : Dynamic Link node enhancement request
Hi, I would like to put a request for enhancement of Link Call Node (Dynamic call part). If the team can put it...
Read more >
Node custom properties in dynamic query for applications
It would be good to be able to populate based on the assigned node's custom properties, rather than using other methods (manually changing...
Read more >
developing node-red stream - 25th October 2021 - YouTube
Ensuring node settings are refreshed whenever a new node is installed/enabled in the editorBroadcasted live on Twitch -- Watch live at ...
Read more >
Feature Toggles (aka Feature Flags) - Martin Fowler
Feature Toggles (often also refered to as Feature Flags) are a powerful technique, allowing teams to modify system behavior without changing code.
Read more >
Azure Service Fabric dynamic node tags - Microsoft Learn
Node tagging is very flexible and allows changes to service placement without application or cluster upgrades. Tags can be added or removed from ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found