Hi,
I wanted to disable (remove) deploy button, want to deploy the flow using button.
Example : below is my flow, once I click button in Test node then it should deploy complete flows.
Is this possible with little modification ?
If I get complete flows then we can use REST api to deploy the flow like below
curl -X POST http://localhost:1880/flows -H "Content-Type: application/json" --data "@test.json"
How to get complete flow when we click the button in Test node ?
I just wanted one button to deploy the flows and trigger.
Thanks,
Shankara
Can I ask why you want to make such a change to the UI?
We don't provide a way to hide that button - you'd have to either customise the source of the editor to remove it, or add some additional code to your custom node to do hide it.
I assume this is not for a node you plan to publish for the general community to use?
You can see the work done when the button is clicked here: https://github.com/node-red/node-red/blob/a6ef755139613a7261372c692189f21115b2d0c6/editor/js/ui/deploy.js#L260
Hi,
Presently in we are doing like this,
Prepare the flow, then click the deploy button, this will write complete flow in flow_master.json file
and then we are clicking Test node button, at this time we will be reading flow_master.json file in this.on function.
Now we thought of avoiding one click either deploy button or Test node button.
Our requirement is we need complete flow in Test node once deploy button is clicked. I thought deploy button can hide and inherit deploy function in Test node button.
We tried to get complete flow by RED.nodes.getFlow/s but getting some error saying that getFlow/s is not a function.
Please suggest best solution to get the complete flow in Test node after clicking deploy button.
Thanks,
Shankara
Hi @shankara
I still assume this is for a custom version of Node-RED you are making - this isn't a general node you plan to publish to the community?
I've pointed you at the code for the Deploy button - everything you need to get the current flow configuration is in there. RED.nodes.getFlow
is a runtime api - not an editor api.
More specifically, after it makes all the usual checks it has to do about the general state of the editor, this is the line that gets the exportable node set - https://github.com/node-red/node-red/blob/a6ef755139613a7261372c692189f21115b2d0c6/editor/js/ui/deploy.js#L355
Hi Knolleary,
OK, I got it. This is not to publish to community. Just in our project we are using it.
I will use deploy button itself and remove the button in Test node.
One more query, is there way I can come to know node is changed or not in javascript ?
Because once I did some changes in one of the flow, and remaining flow unchanged, then after clicking the deploy button node constructor function will be called for all the flows. I just want to know in flow is changed or not. I way I am thinking context.flow I can use and check flow is changed or not. I am not sure this will work or not.
Thanks,
Shankara
I will use deploy button itself and remove the button in Test node.
That is up to you. I keep pointing you at the Deploy button code because it holds the answers to your questions and you'd need very similar code in your Test node button handler.
In the runtime or in the editor?
We already have the 'modified nodes' and 'modified flows' type of deploys - they still send the complete flow to the runtime, but with an additional http header that tells the runtime to the type of deploy being done. (As documented here: POST /flows : Node-RED ).
If either of the modified
types deploys are being done, theres a lot of code in the runtime to compare what is being deployed with what is already there - and then making the decisions as to what needs to be stopped/started etc. None of that code is exposed via any api - it is all internal workings of the runtime.
OK, Thanks for your quick reply.