|
| 1 | +--- |
| 2 | +layout: blog |
| 3 | +title: Version 1.1 released |
| 4 | +author: nick |
| 5 | +--- |
| 6 | + |
| 7 | +Node-RED 1.1 is now available to [install](https://npmjs.org/package/node-red). |
| 8 | + |
| 9 | +If upgrading, please read the [upgrade instructions](http://nodered.org/docs/getting-started/upgrading.html). |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +<iframe width="560" height="315" src="https://www.youtube.com/embed/FHP7qsaz7ZI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | + |
| 18 | +- [Editor Updates](#editor-updates) |
| 19 | + - [Information sidebar redesign](#information-sidebar-redesign) |
| 20 | + - [New Help sidebar](#new-help-sidebar) |
| 21 | + - [Grouping nodes](#grouping-nodes) |
| 22 | +- [Runtime features](#runtime-features) |
| 23 | + - [node-red-admin built-in](#node-red-admin-built-in) |
| 24 | + - [Overriding individual settings](#overriding-individual-settings) |
| 25 | + - [`httpAdminMiddleware` setting](#httpadminmiddleware-setting) |
| 26 | + - [Custom `adminAuth` token handling](#custom-adminauth-token-handling) |
| 27 | + - [Installing nodes from other locations](#installing-nodes-from-other-locations) |
| 28 | + - [Refreshing HTTPS certificates](#refreshing-https-certificates) |
| 29 | +- [Node updates](#node-updates) |
| 30 | + - [JSONata `$moment` support](#jsonata-moment-support) |
| 31 | + - [Inject node properties](#inject-node-properties) |
| 32 | + - [Function node lifecycle](#function-node-lifecycle) |
| 33 | + - [Debug node status](#debug-node-status) |
| 34 | + - [Trigger node](#trigger-node) |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +## Editor Updates |
| 39 | + |
| 40 | +### Information sidebar redesign |
| 41 | + |
| 42 | +The info sidebar now includes a tree-view of your flows - we call it the outliner. |
| 43 | +This gives another way to navigate your flows and quickly find things. |
| 44 | + |
| 45 | +{:width="40%"} |
| 46 | + |
| 47 | +Each node has a button that takes you to it in the workspace, a button to |
| 48 | +enable/disable it and, in the case of the Inject and Debug nodes, a button to |
| 49 | +trigger their action. Double-clicking on a node will bring up its edit dialog. |
| 50 | + |
| 51 | +[more...](/docs/user-guide/editor/sidebar/info) |
| 52 | + |
| 53 | +### New Help sidebar |
| 54 | + |
| 55 | +To make room for the outliner, the help section of the sidebar has now moved |
| 56 | +to its own sidebar tab. The added benefit of putting the help in its own tab |
| 57 | +is you can now browse all of the available help topics without having to select |
| 58 | +a node of the right type in the workspace. |
| 59 | + |
| 60 | +It will also give us a space to add other help topics in the editor in the future. |
| 61 | + |
| 62 | +[more...](/docs/user-guide/editor/sidebar/help) |
| 63 | + |
| 64 | +### Grouping nodes |
| 65 | + |
| 66 | +To help organise your flows you can now group your nodes in the editor. |
| 67 | +The group can have a custom border and background colour and an optional label. |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +Groups are added to the flow as a new type of node. As people start using them, |
| 72 | +it will make it harder to share flows with users who haven't yet upgraded. |
| 73 | +To help out, we've published [`node-red-node-group`](https://flows.nodered.org/node/node-red-node-group) |
| 74 | +which registers a `group` node type but does absolutely nothing. Installing this |
| 75 | +module will allow older versions of Node-RED to import flows that include a |
| 76 | +group - although they won't see the groups in the editor. And the module knows |
| 77 | +not to register itself when it isn't needed, so there's no issue upgrading to 1.1 |
| 78 | +with it installed. |
| 79 | + |
| 80 | +[more ...](/docs/user-guide/editor/workspace/groups) |
| 81 | + |
| 82 | +## Runtime features |
| 83 | + |
| 84 | +### node-red-admin built-in |
| 85 | + |
| 86 | +The `node-red-admin` command-line tool has existed since the start of the project, |
| 87 | +but it isn't something widely known about or used. It can be used to remotely |
| 88 | +administer a Node-RED runtime. |
| 89 | + |
| 90 | +To make it more useful, it is now integrated into the `node-red` command. You run it with: |
| 91 | + |
| 92 | +``` |
| 93 | +node-red admin |
| 94 | +``` |
| 95 | + |
| 96 | +One of the useful commands it provides is a way to hash passwords suitable for |
| 97 | +`adminAuth`. It prompts you for the password you want to use and it gives you |
| 98 | +back the hash you can paste into your settings file. |
| 99 | + |
| 100 | +``` |
| 101 | +$ node-red admin hash-pw |
| 102 | +Password: |
| 103 | +$2b$08$sjxLvq8MmycyWJpxPLyweuw/WlYt1MX56eG5Q5nlyxJs2fASGm2jm |
| 104 | +``` |
| 105 | + |
| 106 | +The other commands let you list what nodes are installed, enable/disable them, |
| 107 | +install new ones or remove old ones. You can also search the flow library. |
| 108 | + |
| 109 | +[more...](/docs/getting-started/local#command-line-usage) |
| 110 | + |
| 111 | +### Overriding individual settings |
| 112 | + |
| 113 | +The `node-red` command now supports the `-D` option to override individual settings. |
| 114 | +For example, to temporarily run with a different level of logging you can use: |
| 115 | + |
| 116 | +``` |
| 117 | +node-red -D logging.console.level=trace |
| 118 | +``` |
| 119 | + |
| 120 | +[more...](/docs/getting-started/local#override-individual-settings) |
| 121 | + |
| 122 | + |
| 123 | +### `httpAdminMiddleware` setting |
| 124 | + |
| 125 | +We've had the `httpNodeMiddleware` option for a while now - allowing a custom |
| 126 | +middleware to be added to the HTTP In node routes. This release adds |
| 127 | +`httpAdminMiddleware` that does the same thing for all of the admin routes, |
| 128 | +which includes the editor itself. This can be used, for example, to add custom |
| 129 | +http headers to all admin requests. Not something most end users need, but has |
| 130 | +been a requirement from those who embed the editor into their own applications. |
| 131 | + |
| 132 | +[more...](/docs/user-guide/runtime/securing-node-red#custom-middleware) |
| 133 | + |
| 134 | +### Custom `adminAuth` token handling |
| 135 | + |
| 136 | +`adminAuth` now supports a custom `tokens` function that can be used to validate any auth token passed to the admin api. This opens up some more flexible options to integrate Node-RED admin security with other authentication systems. |
| 137 | + |
| 138 | +[more...](/docs/user-guide/runtime/securing-node-red#custom-authentication-tokens) |
| 139 | + |
| 140 | +### Installing nodes from other locations |
| 141 | + |
| 142 | +The admin api for installing new nodes has been extended to support a 'url' |
| 143 | +parameter - which should be a full url to a `tgz` containing the node to install. |
| 144 | + |
| 145 | +This hasn't been written up in the docs yet, but for now, you can read the original |
| 146 | +[design note](https://github.com/node-red/designs/tree/master/designs/node-installation) |
| 147 | + |
| 148 | +### Refreshing HTTPS certificates |
| 149 | + |
| 150 | +The runtime can now be configured to periodically refresh its https certificates. |
| 151 | +This feature requires Node.js 12 or later. |
| 152 | + |
| 153 | +The default [settings file has been updated](https://github.com/node-red/node-red/blob/c048b1a25b36040f169f443701b9a0dde2f57914/packages/node_modules/node-red/settings.js#L139-L171) with examples for how to configure this. |
| 154 | + |
| 155 | +[more...](/docs/user-guide/runtime/securing-node-red#refreshing-https-certificates) |
| 156 | + |
| 157 | +## Node updates |
| 158 | + |
| 159 | +### JSONata `$moment` support |
| 160 | + |
| 161 | +We've added support for the Moment date/time library within JSONata expressions via the `$moment` function. |
| 162 | + |
| 163 | +This adds some long needed timezone awareness into the core of Node-RED. For example, you can get the current time in Auckland with the expression: |
| 164 | + |
| 165 | +``` |
| 166 | +$moment().tz("Pacific/Auckland") |
| 167 | +``` |
| 168 | + |
| 169 | +If you wanted to get the time 2 hours from now, you can do: |
| 170 | + |
| 171 | +``` |
| 172 | +$moment().add(2, "hours") |
| 173 | +``` |
| 174 | + |
| 175 | +It can also do a much better job of parsing dates: |
| 176 | + |
| 177 | +``` |
| 178 | +$moment($.payload, "YYYY-MM-DD") |
| 179 | +``` |
| 180 | + |
| 181 | +We're considering making the Moment library available as a default built-in of the Function node as well, but that will |
| 182 | +be a future release. |
| 183 | + |
| 184 | +### Inject node properties |
| 185 | + |
| 186 | +The Inject node can now set any properties on the message it sends - you aren't limited to just `topic` and `payload`. |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | +### Function node lifecycle |
| 191 | + |
| 192 | +The Function node now lets you provide code that should be run when the node is |
| 193 | +deployed and when it is being stopped. This lets you initialise any state in the |
| 194 | +node before it starts handling any messages. Note that each piece of code is in |
| 195 | +a separate scope - you cannot declare variables in one and access them in the others. |
| 196 | +You need to use `context` to pass things between them. |
| 197 | + |
| 198 | +The main Function has also been made a proper async Function so you can use `await` at the top level, if that's your sort of thing. |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | +### Debug node status |
| 203 | + |
| 204 | +The Debug node can now set its status message independently of what it passes |
| 205 | +to the Debug sidebar. Useful if you want to Debug a shorter summary to status, |
| 206 | +whilst showing more complete information in the sidebar where there is more space. |
| 207 | + |
| 208 | +Whilst talking about the Debug node, we've added a number of actions in the editor |
| 209 | +to help activate/deactive lots of nodes in one go. |
| 210 | + |
| 211 | +You can searching for them in the Action List (`Ctrl/Cmd-Shift-P` or `View -> Action List`) |
| 212 | +and you can assign keyboard shortcuts to them: |
| 213 | + |
| 214 | + - `core:activate-selected-debug-nodes` |
| 215 | + - `core:activate-all-debug-nodes` |
| 216 | + - `core:activate-all-flow-debug-nodes` |
| 217 | + - `core:deactivate-selected-debug-nodes` |
| 218 | + - `core:deactivate-all-debug-nodes` |
| 219 | + - `core:deactivate-all-flow-debug-nodes` |
| 220 | + |
| 221 | + |
| 222 | +### Trigger node |
| 223 | + |
| 224 | +The Trigger node can now optionally send its 'second message' on a separate output. |
| 225 | + |
| 226 | +If you want it to handle separate streams of messages, you are no longer tied |
| 227 | +to using `msg.topic` to identify the streams - you can use any message property. |
| 228 | + |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
0 commit comments