@gregoriusrippenstein/node-red-contrib-introspection 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,6 +85,14 @@ GetFlows supports version selection of the flows and it has limited authenticati
85
85
 
86
86
  Inspired by the [dsm](https://flows.nodered.org/node/node-red-contrib-dsm) package that has a [backup](https://github.com/cflurin/node-red-contrib-dsm/wiki/Backup) state machine.
87
87
 
88
+ ### SendFlow
89
+
90
+ Send a flow to another Node-RED instance. This will replace **any existing** flows on the other server, use with care. Under the hood this uses the [Node-RED API](https://nodered.org/docs/api/admin/methods/post/flows/) to post a new flow to the server. This node also supports authentication if the other server happens to have some.
91
+
92
+ ### TriggerImport
93
+
94
+ This node will open the Node-RED import dialog and insert the payload, i.e. a flow object, into the dialog. The flow can then be imported into the existing workspace. See the [RSS example](https://flowhub.org/f/e02ba6e534f7a0f4) for more details. Payload must be a valid flow object, i.e. a Javascript array with one object per node. The import dialog will complain should this not be the case.
95
+
88
96
  ## Node-RED Versions
89
97
 
90
98
  These nodes have been tested and found to work on Node-RED 3.0.2 and 3.1.0.beta.4.
@@ -98,6 +106,7 @@ There are [example flows](/examples) contained in the package, examples can also
98
106
  - [Screenshot](https://flowhub.org/f/07b2d0f3b0445ab5)
99
107
  - [DrawSVG](https://flowhub.org/f/141037dcda5b69fd)
100
108
  - [GetFlows](https://flowhub.org/f/0b1bfbf6e540be66)
109
+ - [TriggerImport](https://flowhub.org/f/e02ba6e534f7a0f4)
101
110
 
102
111
  ## License
103
112
 
@@ -0,0 +1,48 @@
1
+ <script type="text/javascript">
2
+ RED.comms.subscribe('introspect:trigger-import-tripped', (event,data) => {
3
+ if ( data.msg == "import-flow" ) {
4
+ RED.clipboard.import();
5
+
6
+ setTimeout( () => {
7
+ var content = data.flowContent;
8
+
9
+ $('#red-ui-clipboard-dialog-import-text').val(
10
+ JSON.stringify(content)
11
+ ).trigger("paste");
12
+ }, 300);
13
+ }
14
+ });
15
+
16
+ RED.nodes.registerType('TriggerImport',{
17
+ color: '#e5e4ef',
18
+ icon: "icons/subflow.svg",
19
+ category: 'introspection',
20
+ paletteLabel: "TriggerImport",
21
+ defaults: {
22
+ name: {
23
+ value:"",
24
+ },
25
+ },
26
+ inputs:1,
27
+ outputs:1,
28
+
29
+ label: function() {
30
+ return (this.name || this._def.paletteLabel);
31
+ },
32
+
33
+ labelStyle: function() {
34
+ return this.name?"node_label_italic":"";
35
+ },
36
+ });
37
+ </script>
38
+
39
+ <script type="text/html" data-template-name="TriggerImport">
40
+ <div class="form-row">
41
+ <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name">Name</span></label>
42
+ <input type="text" id="node-input-name" placeholder="Name">
43
+ </div>
44
+ </script>
45
+
46
+ <script type="text/html" data-help-name="TriggerImport">
47
+ <p>Trigger import opens the flow import dialog with data that came from the server.</p>
48
+ </script>
@@ -0,0 +1,24 @@
1
+ module.exports = function(RED) {
2
+ function TriggerImportFunctionality(config) {
3
+ RED.nodes.createNode(this,config);
4
+
5
+ var node = this;
6
+ var cfg = config;
7
+
8
+ node.on('close', function() {
9
+ node.status({});
10
+ });
11
+
12
+ node.on("input", function(msg, send, done) {
13
+ RED.comms.publish("introspect:trigger-import-tripped",
14
+ RED.util.encodeObject({
15
+ flowContent: msg.payload,
16
+ msg: "import-flow",
17
+ })
18
+ );
19
+
20
+ send(msg);
21
+ });
22
+ }
23
+ RED.nodes.registerType("TriggerImport", TriggerImportFunctionality);
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gregoriusrippenstein/node-red-contrib-introspection",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "dependencies": {
5
5
  "got": "latest"
6
6
  },
@@ -16,15 +16,16 @@
16
16
  "node-red": {
17
17
  "version": ">=2.0.0",
18
18
  "nodes": {
19
- "seeker": "nodes/05-seeker.js",
20
- "sink": "nodes/10-sink.js",
21
- "screenshot": "nodes/15-screenshot.js",
22
- "orphans": "nodes/20-orphans.js",
23
- "ismobile": "nodes/25-ismobile.js",
24
- "navigator": "nodes/30-navigator.js",
25
- "drawsvg": "nodes/40-drawsvg.js",
26
- "getflows": "nodes/45-get-flows.js",
27
- "sendflow": "nodes/50-send-flow.js"
19
+ "seeker": "nodes/05-seeker.js",
20
+ "sink": "nodes/10-sink.js",
21
+ "screenshot": "nodes/15-screenshot.js",
22
+ "orphans": "nodes/20-orphans.js",
23
+ "ismobile": "nodes/25-ismobile.js",
24
+ "navigator": "nodes/30-navigator.js",
25
+ "drawsvg": "nodes/40-drawsvg.js",
26
+ "getflows": "nodes/45-get-flows.js",
27
+ "sendflow": "nodes/50-send-flow.js",
28
+ "triggerimport": "nodes/55-trigger-import.js"
28
29
  }
29
30
  },
30
31
  "description": "Node-RED Editor-only nodes for introspecting flows.",