From 771e43583a25c18b32ec1fe3e6e7e11eb2efbd9a Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 29 Jan 2018 11:21:43 +0000 Subject: [PATCH 1/6] Typo in Batch node help --- nodes/core/logic/19-batch.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes/core/logic/19-batch.html b/nodes/core/logic/19-batch.html index 371a48bf9..997a3b734 100644 --- a/nodes/core/logic/19-batch.html +++ b/nodes/core/logic/19-batch.html @@ -75,7 +75,7 @@
Number of messages
groups messages into sequences of a given length. The overlap - option specifies how many messages and the end of one sequence should be + option specifies how many messages at the end of one sequence should be repeated at the start of the next sequence.
Time interval
From 8672fcd2bbe6e1ad39172a5ad43b351091de69a1 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 29 Jan 2018 21:47:20 +0000 Subject: [PATCH 2/6] Fix authServer on Windows path Fixes #1588 --- .../storage/localfilesystem/projects/git/authServer.js | 2 +- .../storage/localfilesystem/projects/git/authWriter_spec.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/red/runtime/storage/localfilesystem/projects/git/authServer.js b/red/runtime/storage/localfilesystem/projects/git/authServer.js index d38ea9fd0..95b4eda0c 100644 --- a/red/runtime/storage/localfilesystem/projects/git/authServer.js +++ b/red/runtime/storage/localfilesystem/projects/git/authServer.js @@ -24,7 +24,7 @@ function getListenPath() { var fn = 'node-red-git-askpass-'+seed+'-sock'; var listenPath; if (process.platform === 'win32') { - listenPath = '\\\\.\\pipe\\'+getListenPath; + listenPath = '\\\\.\\pipe\\'+fn; } else { listenPath = path.join(process.env['XDG_RUNTIME_DIR'] || os.tmpdir(), fn); } diff --git a/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js b/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js index 71fb52a4e..a0b1ab5f5 100644 --- a/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js +++ b/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js @@ -29,7 +29,7 @@ function getListenPath() { var fn = 'node-red-git-askpass-'+seed+'-sock'; var listenPath; if (process.platform === 'win32') { - listenPath = '\\\\.\\pipe\\'+getListenPath; + listenPath = '\\\\.\\pipe\\'+fn; } else { listenPath = path.join(process.env['XDG_RUNTIME_DIR'] || os.tmpdir(), fn); } @@ -55,9 +55,10 @@ describe("localfilesystem/projects/git/authWriter", function() { var listenPath = getListenPath(); server.listen(listenPath, function(ready) { - child_process.exec(process.execPath+' "'+authWriter+'" "'+listenPath+'" TEST_PHRASE_FOO',{cwd:__dirname}, (error,stdout,stderr) => { + child_process.exec('"'+process.execPath+'" "'+authWriter+'" "'+listenPath+'" TEST_PHRASE_FOO',{cwd:__dirname}, (error,stdout,stderr) => { server.close(); try { + error.should.equal(0); receivedData.should.eql("TEST_PHRASE_FOO\n"); done(); } catch(err) { From 9f0c567794a8f0e64acd6c4c0c5324a72fc3179b Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 29 Jan 2018 21:58:53 +0000 Subject: [PATCH 3/6] Fix authWriter test again --- .../storage/localfilesystem/projects/git/authWriter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js b/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js index a0b1ab5f5..b55eaf30f 100644 --- a/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js +++ b/test/red/runtime/storage/localfilesystem/projects/git/authWriter_spec.js @@ -58,7 +58,7 @@ describe("localfilesystem/projects/git/authWriter", function() { child_process.exec('"'+process.execPath+'" "'+authWriter+'" "'+listenPath+'" TEST_PHRASE_FOO',{cwd:__dirname}, (error,stdout,stderr) => { server.close(); try { - error.should.equal(0); + should.not.exist(error); receivedData.should.eql("TEST_PHRASE_FOO\n"); done(); } catch(err) { From 3938550ea8bf161b4b94f96781dc2dba0080b9a7 Mon Sep 17 00:00:00 2001 From: Jeremy Barlow Date: Mon, 29 Jan 2018 15:23:19 -0800 Subject: [PATCH 4/6] Support at sign in module examples path for flows endpoint This commit allows an example from an npm package that has an org scoped name (which includes an @ character) to be retrieved and loaded properly through the flows endpoint. --- red/api/editor/library.js | 2 +- test/red/api/editor/library_spec.js | 51 +++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/red/api/editor/library.js b/red/api/editor/library.js index 5bbbc7bb9..d5cbb020f 100644 --- a/red/api/editor/library.js +++ b/red/api/editor/library.js @@ -95,7 +95,7 @@ module.exports = { }, get: function(req,res) { if (req.params[0].indexOf("_examples_/") === 0) { - var m = /^_examples_\/([^\/]+)\/(.*)$/.exec(req.params[0]); + var m = /^_examples_\/(@.*?\/[^\/]+|[^\/]+)\/(.*)$/.exec(req.params[0]); if (m) { var module = m[1]; var path = m[2]; diff --git a/test/red/api/editor/library_spec.js b/test/red/api/editor/library_spec.js index 7520154e1..65e53e459 100644 --- a/test/red/api/editor/library_spec.js +++ b/test/red/api/editor/library_spec.js @@ -15,6 +15,9 @@ **/ var should = require("should"); +var sinon = require("sinon"); +var fs = require("fs"); +var fspath = require('path'); var request = require('supertest'); var express = require('express'); var bodyParser = require('body-parser'); @@ -27,7 +30,7 @@ var auth = require("../../../../red/api/auth"); describe("api/editor/library", function() { - function initLibrary(_flows,_libraryEntries,_examples) { + function initLibrary(_flows,_libraryEntries,_examples,_exampleFlowPathFunction) { var flows = _flows; var libraryEntries = _libraryEntries; library.init(app,{ @@ -88,7 +91,8 @@ describe("api/editor/library", function() { nodes: { getNodeExampleFlows: function() { return _examples; - } + }, + getNodeExampleFlowPath: _exampleFlowPathFunction } }); } @@ -100,6 +104,13 @@ describe("api/editor/library", function() { app.get("/library/flows",library.getAll); app.post(new RegExp("/library/flows\/(.*)"),library.post); app.get(new RegExp("/library/flows\/(.*)"),library.get); + app.response.sendFile = function (path) { + app.response.json.call(this, {sendFile: path}); + }; + sinon.stub(fs,"statSync",function() { return true; }); + }); + after(function() { + fs.statSync.restore(); }); it('returns empty result', function(done) { initLibrary({},{flows:{}}); @@ -200,6 +211,42 @@ describe("api/editor/library", function() { done(); }); }); + + it('can retrieve an example flow', function(done) { + var examples = {"d":{"node-module":{"f":["example-one"]}}}; + initLibrary({},{},examples,function(module,path) { + return module + ':' + path + }); + request(app) + .get('/library/flows/_examples_/node-module/example-one') + .expect(200) + .end(function(err,res) { + if (err) { + throw err; + } + res.body.should.have.property('sendFile', + 'node-module:example-one'); + done(); + }); + }); + + it('can retrieve an example flow in an org scoped package', function(done) { + var examples = {"d":{"@org_scope/node_package":{"f":["example-one"]}}}; + initLibrary({},{},examples,function(module,path) { + return module + ':' + path + }); + request(app) + .get('/library/flows/_examples_/@org_scope/node_package/example-one') + .expect(200) + .end(function(err,res) { + if (err) { + throw err; + } + res.body.should.have.property('sendFile', + '@org_scope/node_package:example-one'); + done(); + }); + }); }); describe("type", function() { From 2d0264116cd56b49097fe7ba28be762c58ab6118 Mon Sep 17 00:00:00 2001 From: Jeremy Barlow Date: Mon, 29 Jan 2018 15:27:34 -0800 Subject: [PATCH 5/6] Handle at sign in module example path for UI import menu This commit allows an example from an npm package that has an org scoped name (which includes an @ character) to be abbreviated properly in the import menu - i.e., showing 'myexample' for a package name of '@myorg/node-red-contrib-myexample' rather than '@myorg/node red-contrib-myexample'. --- editor/js/ui/library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/js/ui/library.js b/editor/js/ui/library.js index a8c75695b..8c29ccae8 100644 --- a/editor/js/ui/library.js +++ b/editor/js/ui/library.js @@ -38,7 +38,7 @@ RED.library = (function() { li.className = "dropdown-submenu pull-left"; a = document.createElement("a"); a.href="#"; - var label = i.replace(/^node-red-contrib-/,"").replace(/^node-red-node-/,"").replace(/-/," ").replace(/_/," "); + var label = i.replace(/^@.*\//,"").replace(/^node-red-contrib-/,"").replace(/^node-red-node-/,"").replace(/-/," ").replace(/_/," "); a.innerHTML = label; li.appendChild(a); li.appendChild(buildMenu(data.d[i],root+(root!==""?"/":"")+i)); From 57ebb93dc031ee1e6e378f443a57af7a0087a46b Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 30 Jan 2018 11:16:04 +0000 Subject: [PATCH 6/6] trigger node - add mention of per topic capability to info. --- nodes/core/core/89-trigger.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodes/core/core/89-trigger.html b/nodes/core/core/89-trigger.html index 0b1194fe0..bd3cea665 100644 --- a/nodes/core/core/89-trigger.html +++ b/nodes/core/core/89-trigger.html @@ -70,7 +70,7 @@