Compare commits

...

19 Commits

Author SHA1 Message Date
Nick O'Leary
e94634544c Add script to generate npm publish script 2019-10-14 15:50:48 +01:00
Nick O'Leary
07fe5b247b Bump for 1.0.2 2019-10-14 13:17:48 +01:00
Nick O'Leary
c1c694035d Allow node.status() to be passed number/bool types
Adds to the existing support for string types. Also
adds unit tests for all three cases
2019-10-14 13:06:59 +01:00
Nick O'Leary
147d2a02be Ensure node status is refreshed whenever node is edited
Fixes an issue where, if the number of node outputs was changes
the node would resize, but the status text would not reposition
until a new status message arrived.

This change marks status as dirty whenever the node has been
edited, forcing it to be redrawn.
2019-10-14 13:05:45 +01:00
Nick O'Leary
6f91786f4d Fixup Change node use of node.done 2019-10-11 11:08:25 +01:00
Nick O'Leary
f62a933d1c Ensure z property included in full message debug payload
Fixes #2315 #2316
2019-10-11 11:07:48 +01:00
1ft-seabass
451835fbeb Fixed editor.json (#2321) 2019-10-11 08:55:23 +01:00
Nick O'Leary
547e7a1b21 Allow node emitted events to have multiple arguments
This is fixing a regression introduced in 1.0 where a custom
`Node.emit` function was added that could only handle a single
argument.
2019-10-10 16:35:12 +01:00
Nick O'Leary
053e3ba923 Merge pull request #2313 from kazuhitoyokoi/master-fixvisualeditor
Fix menu in visual JSON editor
2019-10-10 14:31:19 +01:00
Nick O'Leary
bf65dcd49b Merge pull request #2314 from ThierryLeGal/addItem-insert-divider
Insert divider in menu by calling RED.menu.addItem('id', null);
2019-10-10 14:29:14 +01:00
Nick O'Leary
a1d186112a Merge pull request #2323 from boisei0/jsdoc-red-util
Fixed docstrings to have them match the function signature
2019-10-10 14:26:52 +01:00
Arlena Derksen
ca7a298509 Fixed docstrings to have them match the function signature (name of parameters). 2019-10-10 14:57:19 +02:00
Kazuhito Yokoi
ff4d58f648 Fix invalid JSON data in template node (#2322) 2019-10-10 10:34:10 +01:00
kitazaki
a1e10e99fa Update 10-file.html (#2320) 2019-10-09 14:51:38 +01:00
Ryoichi Obara
16bda530f6 Remove unnecessary comma. (#2312) 2019-10-09 08:41:33 +01:00
Ryoichi Obara
bf9e04d9db Unify translations of "boolean". (#2318) 2019-10-09 08:40:36 +01:00
Ryoichi Obara
8df86a75b1 Interval of inject node should be 596 hours or less. (#2319) 2019-10-09 08:39:08 +01:00
Thierry Le Gal
5056203023 Insert divider in menu by calling RED.menu.addItem('id', null); 2019-10-07 14:47:20 +02:00
Kazuhito Yokoi
a0026e66ce Fix element to collapse items in visual JSON editor 2019-10-07 16:13:04 +09:00
28 changed files with 155 additions and 49 deletions

View File

@@ -1,3 +1,25 @@
#### 1.0.2: Maintenance Release
Runtime
- Allow node.status() to be passed number/bool types
- Allow node emitted events to have multiple arguments
- #2323 Fixed docstrings to have them match the function signature (name of parameters).
- #2318 NLS: Unify translations of "boolean"
Editor
- Ensure node status is refreshed whenever node is edited
- #2315 #2316 Ensure z property included in full message debug payload
- #2321 Fixed editor.json (JA nls)
- #2313 Fix element to collapse items in visual JSON editor
- #2314 Insert divider in menu by calling RED.menu.addItem('id', null);
Nodes
- Change: Fixup use of node.done
- #2322 Template: Fix invalid JSON data in template node docs
- #2320 File: Fixed a typo in 10-file.html (JA nls)
- #2312 Template: Remove unnecessary comma in help text
- #2319 Inject: Interval of inject node should be 596 hours or less.
#### 1.0.1: Maintenance Release
Runtime

View File

@@ -562,7 +562,20 @@ module.exports = function(grunt) {
return false;
}
});
grunt.registerTask('generatePublishScript',
'Generates a script to publish build output to npm',
function () {
const done = this.async();
const generatePublishScript = require("./scripts/generate-publish-script.js");
generatePublishScript().then(function(output) {
grunt.log.writeln(output);
const filePath = path.join(grunt.config.get('paths.dist'),"modules","publish.sh");
grunt.file.write(filePath,output);
done();
});
});
grunt.registerTask('setDevEnv',
'Sets NODE_ENV=development so non-minified assets are used',
function () {
@@ -605,7 +618,7 @@ module.exports = function(grunt) {
grunt.registerTask('release',
'Create distribution zip file',
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules']);
['build','verifyPackageDependencies','clean:release','mkdir:release','chmod:release','compress:release','pack-modules','generatePublishScript']);
grunt.registerTask('pack-modules',
'Create module pack files for release',

View File

@@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "1.0.1",
"version": "1.0.2",
"description": "Low-code programming for event-driven applications",
"homepage": "http://nodered.org",
"license": "Apache-2.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-api",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@@ -16,8 +16,8 @@
}
],
"dependencies": {
"@node-red/util": "1.0.1",
"@node-red/editor-client": "1.0.1",
"@node-red/util": "1.0.2",
"@node-red/editor-client": "1.0.2",
"bcryptjs": "2.4.3",
"body-parser": "1.19.0",
"clone": "2.1.2",

View File

@@ -955,7 +955,7 @@
"confirm": "<p>デプロイされていない変更は失われます。</p><p>続けますか?</p>"
},
"send-req": {
"auth-req": "リポジトリ対する認証が必要です",
"auth-req": "リポジトリ対する認証が必要です",
"username": "ユーザ名",
"password": "パスワード",
"passphrase": "パスフレーズ",

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/editor-client",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@@ -244,7 +244,7 @@ RED.menu = (function() {
function addItem(id,opt) {
var item = createMenuItem(opt);
if (opt.group) {
if (opt !== null && opt.group) {
var groupItems = $("#"+id+"-submenu").children(".red-ui-menu-group-"+opt.group);
if (groupItems.length === 0) {
item.appendTo("#"+id+"-submenu");

View File

@@ -202,6 +202,7 @@ RED.editor = (function() {
function updateNodeProperties(node, outputMap) {
node.resize = true;
node.dirty = true;
node.dirtyStatus = true;
var removedLinks = [];
if (node.ports) {
if (outputMap) {

View File

@@ -141,6 +141,7 @@
})
}});
options.push({id:"red-ui-editor-type-json-menu-collapse-children",icon:"fa fa-angle-double-up", label:RED._('jsonEditor.collapseItems'),onselect:function(){
item.treeList.collapse();
item.children.forEach(function(child) {
child.treeList.collapse();
})

View File

@@ -62,7 +62,7 @@ module.exports = function(RED) {
if (err) {
done(RED._("debug.invalid-exp", {error: editExpression}));
} else {
done(null,{id:node.id, name:node.name, topic:msg.topic, msg:value, _path:msg._path});
done(null,{id:node.id, z:node.z, name:node.name, topic:msg.topic, msg:value, _path:msg._path});
}
});
} else {
@@ -88,7 +88,7 @@ module.exports = function(RED) {
node.log("\n"+util.inspect(msg, {colors:useColors, depth:10}));
}
if (this.active && this.tosidebar) {
sendDebug({id:node.id, name:node.name, topic:msg.topic, msg:msg, _path:msg._path});
sendDebug({id:node.id, z:node.z, name:node.name, topic:msg.topic, msg:msg, _path:msg._path});
}
done();
} else {

View File

@@ -448,7 +448,7 @@ RED.debug = (function() {
var metaRow = $('<div class="red-ui-debug-msg-meta"></div>').appendTo(msg);
$('<span class="red-ui-debug-msg-date">'+ getTimestamp()+'</span>').appendTo(metaRow);
if (sourceNode) {
$('<a>',{href:"#",class:"red-ui-debug-msg-name"}).text('node: '+(sourceNode.name||sourceNode.id))
$('<a>',{href:"#",class:"red-ui-debug-msg-name"}).text('node: '+sanitize(o.name||sourceNode.name||sourceNode.id))
.appendTo(metaRow)
.on("click", function(evt) {
evt.preventDefault();

View File

@@ -331,11 +331,11 @@ module.exports = function(RED) {
this.on('input', function(msg, send, done) {
applyRules(msg, 0, (err,msg) => {
if (err) {
node.error(err,msg);
done(err);
} else if (msg) {
send(msg);
done();
}
done();
})
});
}

View File

@@ -35,10 +35,12 @@
<p> Beispiel: Wenn eine Vorlage von:
<pre> Hallo {{payload.name}}. Heute ist {{date}} </pre>
<p> eine Nachricht empfangt, die folgendes enthält:
<pre> {
Datum: "Montag"
Payload: { Name: "Fred"}
} </pre>
<pre>{
date: "Montag",
payload: {
name: "Fred"
}
}</pre>
<p> wird die resultierende Nachrich wie folgt sein:
<pre> Hallo Fred. Heute ist Montag </pre>
<p> Es ist möglich, eine Eigenschaft aus dem Flowkontext oder dem globalen Kontext zu verwenden.

View File

@@ -36,9 +36,9 @@
<pre>Hello {{payload.name}}. Today is {{date}}</pre>
<p>receives a message containing:
<pre>{
date: "Monday"
date: "Monday",
payload: {
name: "Fred",
name: "Fred"
}
}</pre>
<p>The resulting property will be:

View File

@@ -79,7 +79,7 @@
"on": "on",
"onstart": "Inject once after",
"onceDelay": "seconds, then",
"tip": "<b>Note:</b> \"interval between times\" and \"at a specific time\" will use cron.<br/>\"interval\" should be less than 596 hours.<br/>See info box for details.",
"tip": "<b>Note:</b> \"interval between times\" and \"at a specific time\" will use cron.<br/>\"interval\" should be 596 hours or less.<br/>See info box for details.",
"success": "Successfully injected: __label__",
"errors": {
"failed": "inject failed, see log for details",

View File

@@ -25,7 +25,7 @@
</dl>
<h3>詳細</h3>
<p>injectードを用いることで指定したペイロード値を用いてフローを開始できますデフォルトのペイロード値は現在時刻のタイムスタンプを1970年1月1日からの経過ミリ秒で表現した値です</p>
<p>文字列数値論理JavaScriptオブジェクトフロー/グローバルコンテキストの値などの送出も可能です</p>
<p>文字列数値真偽JavaScriptオブジェクトフロー/グローバルコンテキストの値などの送出も可能です</p>
<p> デフォルト設定ではエディタ内に表示されるボタンをクリックすることでノードを手動で起動できます指定間隔もしくはスケジュールに従ってメッセージを送出するように設定することも可能です</p>
<p>またフロー開始の際に一度だけメッセージを送出させることもできます</p>
<p><i>時間間隔</i>596(24)</p>

View File

@@ -34,9 +34,9 @@
<pre>こんにちは{{payload.name}}さん今日は{{date}}です</pre>
<p>というテンプレートに対して
<pre>{
date: "月曜日"
date: "月曜日",
payload: {
name: "山田",
name: "山田"
}
}</pre>
<p>というメッセージを受信した場合</p>

View File

@@ -52,7 +52,7 @@
<p>Windowsではパスの区切り文字を(例えば<code>\\ユーザー\\名前</code>)</p>
<p>テキストファイルの場合行毎に分割して各々メッセージを送信することができますまたバイナリファイルの場合小さな塊のバッファに分割して送信できますバッファの分割単位はオペレーティングシステム依存ですが一般に64k(Linux/Mac)もしくは41k(Windows)です</p>
<p>複数のメッセージに分割する場合各メッセージには<code>parts</code></p>
<p>力形式が文字列の場合入力データのエンコーディングをエンコーディングリストから選択できます</p>
<p>力形式が文字列の場合入力データのエンコーディングをエンコーディングリストから選択できます</p>
<h4>旧式のエラー処理</h4>
<p>Node-RED 0.17より前の版ではファイルの読み込み時にエラーが発生すると<code>payload</code><code>error</code></p>
<p>エラーはcatchードで補足して処理することを推奨します</p>

View File

@@ -34,9 +34,9 @@
<pre>안녕하세요, {{payload.name}}. 오늘은 {{date}}입니다.</pre>
<p>라는 템플릿에 대해,
<pre>{
date: "월요일"
date: "월요일",
payload: {
name: "홍길동",
name: "홍길동"
}
}</pre>
<p>이라는 메세지를 수신한 경우,</p>

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/nodes",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/registry",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@@ -16,7 +16,7 @@
}
],
"dependencies": {
"@node-red/util": "1.0.1",
"@node-red/util": "1.0.2",
"semver": "6.3.0",
"uglify-js": "3.6.0",
"when": "3.7.8"

View File

@@ -169,20 +169,20 @@ Node.prototype._emit = Node.prototype.emit;
/**
* Emit an event to all registered listeners.
*/
Node.prototype.emit = function(event,arg) {
Node.prototype.emit = function(event, ...args) {
var node = this;
if (event === "input") {
// When Pluggable Message Routing arrives, this will be called from
// that and will already be sync/async depending on the router.
if (this._asyncDelivery) {
setImmediate(function() {
node._emitInput(arg);
node._emitInput.apply(node,args);
});
} else {
this._emitInput(arg);
this._emitInput.apply(this,args);
}
} else {
this._emit(event,arg);
this._emit.apply(this,arguments);
}
}
@@ -539,7 +539,12 @@ Node.prototype.metric = function(eventname, msg, metricValue) {
* status: "simple text status"
*/
Node.prototype.status = function(status) {
if (typeof(status) === "string") { status = {text:status}; }
switch (typeof status) {
case "string":
case "number":
case "boolean":
status = {text:""+status}
}
this._flow.handleStatus(this,status);
};

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/runtime",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"main": "./lib/index.js",
"repository": {
@@ -16,8 +16,8 @@
}
],
"dependencies": {
"@node-red/registry": "1.0.1",
"@node-red/util": "1.0.1",
"@node-red/registry": "1.0.2",
"@node-red/util": "1.0.2",
"clone": "2.1.2",
"express": "4.17.1",
"fs-extra": "8.1.0",

View File

@@ -301,7 +301,7 @@ function normalisePropertyExpression(str) {
* front of the property expression if present.
*
* @param {Object} msg - the message object
* @param {String} str - the property expression
* @param {String} expr - the property expression
* @return {any} the message property, or undefined if it does not exist
* @memberof @node-red/util_util
*/
@@ -316,7 +316,7 @@ function getMessageProperty(msg,expr) {
* Gets a property of an object.
*
* @param {Object} msg - the object
* @param {String} str - the property expression
* @param {String} expr - the property expression
* @return {any} the object property, or undefined if it does not exist
* @memberof @node-red/util_util
*/
@@ -468,7 +468,7 @@ function evaluateEnvProperty(value, node) {
*
* For example, `#:(file)::foo` results in ` { store: "file", key: "foo" }`.
*
* @param {String} value - the context property string to parse
* @param {String} key - the context property string to parse
* @return {Object} The parsed property
* @memberof @node-red/util_util
*/

View File

@@ -1,6 +1,6 @@
{
"name": "@node-red/util",
"version": "1.0.1",
"version": "1.0.2",
"license": "Apache-2.0",
"repository": {
"type": "git",

View File

@@ -1,6 +1,6 @@
{
"name": "node-red",
"version": "1.0.1",
"version": "1.0.2",
"description": "Low-code programming for event-driven applications",
"homepage": "http://nodered.org",
"license": "Apache-2.0",
@@ -31,10 +31,10 @@
"flow"
],
"dependencies": {
"@node-red/editor-api": "1.0.1",
"@node-red/runtime": "1.0.1",
"@node-red/util": "1.0.1",
"@node-red/nodes": "1.0.1",
"@node-red/editor-api": "1.0.2",
"@node-red/runtime": "1.0.2",
"@node-red/util": "1.0.2",
"@node-red/nodes": "1.0.2",
"basic-auth": "2.0.1",
"bcryptjs": "2.4.3",
"express": "4.17.1",

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env node
const path = require("path");
const fs = require("fs-extra");
const should = require("should");
function generateScript() {
return new Promise((resolve, reject) => {
const packages = [
"node-red-util",
"node-red-runtime",
"node-red-registry",
"node-red-nodes",
"node-red-editor-client",
"node-red-editor-api",
"node-red"
];
const rootPackage = require(path.join(__dirname,"..","package.json"));
const version = rootPackage.version;
const tagArg = /-/.test(version) ? "--tag next" : ""
const lines = [];
packages.forEach(name => {
lines.push(`npm publish ${name}-${version}.tgz ${tagArg}\n`);
})
resolve(lines.join(""))
});
}
if (require.main === module) {
generateScript().then(output => {
console.log(output);
});
} else {
module.exports = generateScript;
}

View File

@@ -613,9 +613,6 @@ describe('Node', function() {
}
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
var status = {fill:"green",shape:"dot",text:"connected"};
var topic;
var message;
var retain;
n.status(status);
@@ -624,6 +621,33 @@ describe('Node', function() {
flow.handleStatus.args[0][1].should.eql(status);
done();
});
it('publishes status for plain string', function(done) {
var flow = { handleStatus: sinon.stub() }
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
n.status("text status");
flow.handleStatus.called.should.be.true();
flow.handleStatus.args[0][0].should.eql(n);
flow.handleStatus.args[0][1].should.eql({text:"text status"});
done();
});
it('publishes status for plain boolean', function(done) {
var flow = { handleStatus: sinon.stub() }
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
n.status(false);
flow.handleStatus.called.should.be.true();
flow.handleStatus.args[0][0].should.eql(n);
flow.handleStatus.args[0][1].should.eql({text:"false"});
done();
});
it('publishes status for plain number', function(done) {
var flow = { handleStatus: sinon.stub() }
var n = new RedNode({_flow:flow,id:'123',type:'abc'});
n.status(123);
flow.handleStatus.called.should.be.true();
flow.handleStatus.args[0][0].should.eql(n);
flow.handleStatus.args[0][1].should.eql({text:"123"});
done();
});
});
});