Skip to content

Commit 62f3212

Browse files
committed
220 release blog post
1 parent 9c6e3fb commit 62f3212

File tree

1 file changed

+154
-0
lines changed

1 file changed

+154
-0
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
layout: blog
3+
title: Version 2.2 released
4+
author: nick
5+
---
6+
7+
Node-RED 2.2 is now available to [install](https://npmjs.org/package/node-red). If upgrading, please read the [upgrade instructions](http://nodered.org/docs/getting-started/upgrading.html).
8+
9+
The [Change Log](https://github.com/node-red/node-red/blob/3a69af9034a6f3a59f35c17aa16e018807a38e93/CHANGELOG.md) has the full list of changes in this release, but here are the highlights.
10+
11+
---
12+
13+
<iframe width="560" height="315" src="https://www.youtube.com/embed/vAS3gK2Wans" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
14+
15+
---
16+
17+
- [Highlights](#highlights)
18+
- [Search History](#search-history)
19+
- [Aligning nodes](#aligning-nodes)
20+
- [Detaching nodes](#detaching-nodes)
21+
- [Selecting multiple wires](#selecting-multiple-wires)
22+
- [Slicing wires](#slicing-wires)
23+
- [Subflow Output labels](#subflow-output-labels)
24+
- [Predefined Environment Variables](#predefined-environment-variables)
25+
- [Node Paths](#node-paths)
26+
- [Node Updates](#node-updates)
27+
- [What's next?](#whats-next)
28+
29+
## Highlights
30+
31+
32+
### Search History
33+
34+
The main search dialog now keeps a history of your searches. This makes it easy
35+
to repeatedly search for the same thing.
36+
37+
![](/blog/content/images/2022/01/search-history.png)
38+
39+
40+
### Aligning nodes
41+
42+
With snap-to-grid enabled, nodes with hidden labels (for example, link nodes) can
43+
now be aligned on either their left or right edge. This will make it easier to
44+
get everything to line up in the workspace
45+
46+
![](/blog/content/images/2022/01/align-nodes.png)
47+
48+
### Detaching nodes
49+
50+
You can now delete a node from the middle of a flow and have the wiring automatically
51+
repair itself in the background.
52+
53+
![](/blog/content/images/2022/01/delete-reconnect.gif)
54+
55+
This is done by holding the Ctrl (or Cmd) key when you press delete.
56+
57+
You can also detach a node from the flow *without* deleting it:
58+
59+
![](/blog/content/images/2022/01/detach-node.gif)
60+
61+
We haven't assigned a default shortcut for that, but you can assign one yourself
62+
in the Keyboard pane of the Settings dialog. The action is called `core:detach-selected-nodes`.
63+
64+
### Selecting multiple wires
65+
66+
You can also select multiple wires by ctrl-clicking on them.
67+
68+
When you select multiple nodes, we also highlight any wires between them. This can make it easier to follow a flow once you have selected it.
69+
70+
![](/blog/content/images/2022/01/select-wires.png)
71+
72+
73+
### Slicing wires
74+
75+
We've added the ability to remove wires by slicing through them. You do this by holding the ctrl (or cmd) key, then dragging the mouse with the right-hand button pressed:
76+
77+
![](/blog/content/images/2022/01/slice-wires.gif)
78+
79+
### Subflow Output labels
80+
81+
If you have set output labels for a subflow template (via the Appearance tab of its
82+
edit dialog), the editor will now display those labels whilst you are editing
83+
the subflow template.
84+
85+
![](/blog/content/images/2022/01/subflow-labels.png)
86+
87+
### Predefined Environment Variables
88+
89+
We have added a number of predefined Environment Variables that provide access to
90+
information about the node, group and flow at the point they are evaluated.
91+
92+
- `NR_NODE_ID` - the ID of the node
93+
- `NR_NODE_NAME` - the Name of the node
94+
- `NR_NODE_PATH` - the Path of the node - this is a new concept that we'll explain below.
95+
- `NR_GROUP_ID` - the ID of the containing group
96+
- `NR_GROUP_NAME` - the Name of the containing group
97+
- `NR_FLOW_ID` - the ID of the flow the node is on
98+
- `NR_FLOW_NAME` - the Name of the flow the node is on
99+
100+
The guide for using Environment Variables in your flow is available [here](https://nodered.org/docs/user-guide/environment-variables).
101+
102+
For example, in a Function node, you can do:
103+
104+
```
105+
const functionName = env.get("NR_NODE_NAME")
106+
const flowName = env.get("NR_FLOW_NAME")
107+
msg.payload = `I was sent by Function '${functionName}', on flow '${flowName}'`
108+
return msg
109+
```
110+
111+
### Node Paths
112+
113+
This is a new internal property of Nodes we've added that helps identify where
114+
exactly any node is within the overall flows.
115+
116+
The following may sound a bit abstract, and it's something most users can skip over.
117+
But it can be useful when creating your own subflow modules with custom logging
118+
messages inside.
119+
120+
If a `NodeA` is on `Flow1`, it will have a `path` of `Flow1/NodeA`.
121+
122+
That isn't very interesting, but it gets more interesting when dealing with subflows
123+
and, in particular, nested subflows.
124+
125+
When we create an instance of a subflow, all of the nodes in the subflow are given
126+
randonly generated ids. If that node logs an error, you see the generated ID, not the
127+
'true' id as appears in the editor. It gets harder when you have nested subflows
128+
because you need to be able to identify which instance of the node, in which instance
129+
of the subflow to go looking for.
130+
131+
The `path` property can solve that by providing the ids of the top-level flow and
132+
each subflow instance to identify exactly where the node is.
133+
134+
135+
This property is exposed in the following ways:
136+
- For node authors, it is available as `this._path` on the node object.
137+
- Inside the Function node, it is exposed as `node.path`.
138+
- It is also available as the environment variable `NR_NODE_PATH` when evaluated
139+
by a node.
140+
141+
142+
## Node Updates
143+
144+
- The JSON node will now attempt to parse Buffer objects if they contain a valid string
145+
- The TCP Client nodes support TLS connections
146+
- The WebSocket client node now lets you specify a sub-protocol to connect with
147+
148+
## What's next?
149+
150+
Next on the [release plan](/about/releases/) is Node-RED 3.0, scheduled for the end of April.
151+
152+
This coincides with Node.js 12 reaching its end of life.
153+
154+
As ever, if there are any particular features you're interested in, now is a great time to jump into the [forum](https://discourse.nodered.org) to share your feedback.

0 commit comments

Comments
 (0)