mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Updated dynamic palette (markdown)
parent
9e306dde7a
commit
56c20df4dc
@ -22,21 +22,14 @@ Some points that need to be considered:
|
|||||||
To add a new node to the palette:
|
To add a new node to the palette:
|
||||||
|
|
||||||
1. a request is POSTed to `{admin root}/nodes` to trigger the add.
|
1. a request is POSTed to `{admin root}/nodes` to trigger the add.
|
||||||
The post body is a JSON structure that identifies where the node information comes from, either a local file (`filename`) or an npm module (`npm`).
|
The post body is a JSON structure that identifies where the node information comes from, either a local file (`file`) or an npm module (`module`).
|
||||||
|
|
||||||
{
|
{
|
||||||
filename: "path to local node .js file or package.json",
|
file: "path to local node .js file or package.json",
|
||||||
npm: "npm module name"
|
module: "npm module name"
|
||||||
}
|
}
|
||||||
|
|
||||||
2. For `filename`, we require that the files already exist somewhere under `NODE_RED_HOME/nodes/`
|
2. An event is fired over the comms link telling any connected editors that nodes have been added. This triggers a HTTP Get back to `{admin root}/nodes/{node-set-id}` to load the node definition/help/edit template.
|
||||||
This reduces security concerns over exposing arbitrary files and removes the need for the runtime to remember what extra nodes have been added.
|
|
||||||
|
|
||||||
For `npm`, we npm install the node.
|
|
||||||
|
|
||||||
3. The node's `.js` is then loaded using the existing node loading code. This generates a unique id for the set of nodes loaded (ie hash of the filename/module name)
|
|
||||||
|
|
||||||
4. An event is fired over the comms link telling any connected editors that nodes have been added. This triggers a HTTP Get back to `{admin root}/nodes/{node-set-id}` to load the node definition/help/edit template.
|
|
||||||
|
|
||||||
### Remove node type
|
### Remove node type
|
||||||
To remove a node from the palette:
|
To remove a node from the palette:
|
||||||
@ -45,5 +38,3 @@ To remove a node from the palette:
|
|||||||
2. If the any of the corresponding nodes are in use, the request is rejected
|
2. If the any of the corresponding nodes are in use, the request is rejected
|
||||||
3. The runtime registry removes the corresponding nodes.
|
3. The runtime registry removes the corresponding nodes.
|
||||||
4. An event is fired over the comms link telling any connected editors that the nodes have been removed.
|
4. An event is fired over the comms link telling any connected editors that the nodes have been removed.
|
||||||
|
|
||||||
In the case of `filename` being specified, the user is expected to delete the files after the request completes. For `npm`, the system will uninstall the module.
|
|
Loading…
Reference in New Issue
Block a user