Closed bartbutenaers closed 4 years ago
in the html file you need to add a function to the oneditprepare function, so if it's undefined... then you define it.
if ($("#node-input-active").val() === undefined) {
$("#node-input-active").val(true);
this.active = true;
}
Or something like that...
Hi @rikukissa , @dceejay ,
I have added an activation/deactivation button. When clicked, the images will be ignored (on the server-side) and not send - via the websocket channel - to the client side. This way you can add as many image-output nodes to your flow, without having to be worried the websocket channel is going to be overloaded.
P.S. This is a bit more convenient compared to "disabling" the node via the Node-RED disable button, since you can use the activation button "live"...
Here is a small demo (that automatically generates images in the cloud):
I have one open issue, but don't know how to solve it ;(
To have no impact on existing flows, I would like to have the existing nodes to be activated by default. However these existing nodes don't have a
node.active
field yet, until the user opens the config screen. As a result:At server side I consider the node being active, when node.active is undefined. This seems to be working fine (i.e. the node is activated):
But on the client side the existing node is deactivated by default:
That is not what I want, since the node has a visual appearance of being deactivated (while it is activated on the server). But don't know how to disable the button by default, based on a
node.active
value that is undefined at that moment...