Installed node names in exported flow and info panel

It would often be helpful when attempting to offer support for users if an exported flow included the name of the installed node for each node in the flow (node-red-contrib-whatever for example). Maybe this is not even technically possible, I don't know.

In fact even for myself it would sometimes be useful if the info panel for a node included that information.

1 Like

This might indeed be useful.

As a workaround, have you seen the flow that analyses you flow file for node use? It tells you how many nodes of each type you have in use in your flow.

Do you mean [1]? I don't think that provides the installed node type does it? Just the short type that appears in the flow file. For instance there are several contrib pid nodes that all have the type pid. It is not possible to tell from the flow which one it is.


Correct! the short type.

Am I right in thinking that the information @Colin wants is not available in the flow file? It seems that one would need to use whatever mechanism the editor employs to link node instances to their source files.

Yes, that is why I am not sure if it even possible.

There is a function RED.nodes.getNodeList() that seems to return a list of all available nodes but I don't know whether it is public.

I did the analysis with a flow but it is the same as the node. mostly, it is fairly easy to get the node module from the node name. But it isn't fully automatic.

When I try to use RED.nodes in a function node it is undefined.

How does one do that? By interrogating the files in the node_modules folder, or is there an alternative?

You are over thinking - Try the manual method. :slight_smile:

Clearly though, the Node-RED "Manage Palette" capability is able to work this out as it displays nodes under their module. So you could dig into the source code for that and see how it does it.

You might start here:

Good point.
I notice also that the file .config.json includes this information.

It would be interesting to hear from the node-RED Powers that Be what they think of the idea of showing the node's parent in the info tab. Also the idea of including it in the flow file and/or exported flows.

Ah! I'd missed that! Of course, the data is all there. Now we just need to hack through some JSONata to pull it together. Shouldn't be too hard actually. Firing up the dev environment now ....

OK, done. Sorry it took so long, had to go deal with the washing :smile:

Here is the JSONata we need:

payload.nodes {
    "TOTAL": $count($keys($)),
    "node_modules": $keys($)

And here is an example flow. Note the example has two file read's to illustrate Linux and Windows file paths. You will need to adjust the file paths to suit your own installation.

[{"id":"57f9f3a.e32620c","type":"file in","z":"d480ffdb.73b02","name":"","filename":"/home/pi//node/nrlive/.data/.config.json","format":"utf8","chunk":false,"sendError":false,"x":470,"y":1040,"wires":[["d1d4a711.9a25d8"]]},{"id":"d1d4a711.9a25d8","type":"json","z":"d480ffdb.73b02","name":"","pretty":false,"x":690,"y":1040,"wires":[["e1bdf411.316238"]]},{"id":"e1bdf411.316238","type":"change","z":"d480ffdb.73b02","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.nodes {\t    \"TOTAL\": $count($keys($)),\t    \"node_modules\": $keys($)\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1040,"wires":[["1a0235f0.8c486a"]]},{"id":"1a0235f0.8c486a","type":"debug","z":"d480ffdb.73b02","name":"","active":true,"console":"false","complete":"false","x":1050,"y":1040,"wires":[]},{"id":"b6c696f6.b0bbe8","type":"inject","z":"d480ffdb.73b02","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":240,"y":1040,"wires":[["57f9f3a.e32620c","62b31849.ce3328"]]},{"id":"bae74244.be8fa","type":"comment","z":"d480ffdb.73b02","name":"How Many Node modules in my configuration?","info":"","x":350,"y":1000,"wires":[]},{"id":"62b31849.ce3328","type":"file in","z":"d480ffdb.73b02","name":"","filename":"C:\\src\\nr\\data\\.config.json","format":"utf8","chunk":false,"sendError":false,"x":430,"y":1080,"wires":[["d1d4a711.9a25d8"]]}]

Trivial in the end.

And added to the flows site for reference:

1 Like

Whilst useful if one wants a list of installed nodes, it does not tell one which installed node a particular node on the flow comes from, which is principally what I am after.

That is a slightly harder JSONata query that I haven't quite got my head around.

Isn't the problem linking it into the editor somehow so it can be shown in the info tab or something?

Well, depends what you ultimately want to do with the information. Just use a debug as I have and that will show it just fine. Or dump to a Dashboard, save to file - whatever really, Node-RED's your oyster (or something like that).

One of my main reasons for asking for this is for the regular situation we have here when someone says, for example, that they have a modbus problem and it can be like getting the proverbial blood from the stone to find out which modbus node they are using. If we could just tell them to look on the info tab of the node, or possibly even better, if the parent node name was included in the exported flow, then it might be rather easier.

If the name were included in an exported flow then on import one would be able immediately to determine which nodes were required to run the flow.