mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Updated Design: subflows (markdown)
parent
ecd0386fdc
commit
b8758dd2ef
@ -1,19 +1,21 @@
|
||||
A subflow is a set of connected nodes that can be easily referenced and reused within a larger flow.
|
||||
A subflow is a set of connected nodes that can be easily reused within a larger flow.
|
||||
|
||||
A subflow is represented as a single node in the workspace which can be opened up in a tab to see the underlying flow.
|
||||
|
||||
A subflow can be used in one of two modes: (this is tbd. Might just stick with singleton for v1)
|
||||
|
||||
1. Singleton : only one copy of the flow exists.
|
||||
2. Instance : each reference to the subflow is its own copy.
|
||||
|
||||
### Creating a subflow
|
||||
|
||||
#### An empty subflow
|
||||
1. Selects 'Create subflow' option.
|
||||
2. Creates a new subflow with a default name, added to palette
|
||||
3. Opens the subflow tab
|
||||
|
||||
#### From existing nodes
|
||||
1. User selects some existing nodes.
|
||||
2. Selects 'convert to subflow' option.
|
||||
2. Selects 'Convert to subflow' option.
|
||||
3. Nodes are removed from workspace and replaced by a subflow node.
|
||||
4. Subflow node given a default name and added to palette
|
||||
|
||||
|
||||
**Questions:**
|
||||
|
||||
* how to automatically identify the input/output ports to map to
|
||||
@ -26,18 +28,14 @@ A subflow can be used in one of two modes: (this is tbd. Might just stick with s
|
||||
### Editing a subflow
|
||||
|
||||
1. Double click subflow node.
|
||||
2. Opens in closeable tab containing the flow.
|
||||
3. Tab toolbar includes options to name.
|
||||
|
||||
**Questions:**
|
||||
|
||||
* how to rename the flow? Via subflow sidebar tab?
|
||||
* how to pick singleton/instance mode?
|
||||
2. Opens the edit-node dialog for the instance of the subflow
|
||||
3. Click the 'edit subflow' option in the dialog opens a closeable tab containing the flow.
|
||||
4. Tab toolbar includes but to open subflow edit dialog (also accessed by dblclicking on tab, or any input/output node in the flow)
|
||||
|
||||
### Delete subflow
|
||||
|
||||
1. Open a subflow sidebar tab that lists all subflows with usage count (cf config node tab - perhaps combine them...?)
|
||||
2. ...
|
||||
1. Open subflow edit dialog
|
||||
2. Click delete
|
||||
|
||||
|
||||
## Definition
|
||||
@ -47,17 +45,13 @@ A subflow node has the following properties:
|
||||
* `type` : `subflow`
|
||||
* `id`
|
||||
* `name`
|
||||
* `in` - the id of the internal node that provides the flow's input port.
|
||||
* `in` - an array identifying the internal nodes that are mapped to the flow inputs. It will have zero or one elements.
|
||||
* `out` - an array identifying the internal nodes and their output ports that are mapped to the flows outputs. Elements are objects of the form: `{id:ID, port:PORT}`.
|
||||
|
||||
|
||||
A node that is part of a subflow has their `z` property set to the `id` of the subflow.
|
||||
|
||||
An instance of a subflow has the following properties:
|
||||
|
||||
* `type` : `subflow:ID`
|
||||
* `id`
|
||||
* `singleton` : true/false
|
||||
* `name` - if singleton, inherits from parent subflow
|
||||
|
||||
|
||||
* `name`
|
||||
|
Loading…
Reference in New Issue
Block a user