Update some core nodes info

This commit is contained in:
Dave Conway-Jones 2017-04-24 20:36:27 +01:00
parent 4689d56955
commit 45fbd22e28
No known key found for this signature in database
GPG Key ID: 81B04231572A9A2D
10 changed files with 114 additions and 209 deletions

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="catch">
<div class="form-row">
@ -41,6 +26,20 @@
</script>
<script type="text/x-red" data-help-name="catch">
<p>Catch errors thrown by nodes on the same tab.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>the original msg object message (if available).</dd>
<dt>msg.error.message <span class="property-type">string</span></dt>
<dd>the error message.</dd>
<dt>msg.error.source.id <span class="property-type">string</span></dt>
<dd>the id of the node that threw the error.</dd>
<dt>msg.error.source.type <span class="property-type">string</span></dt>
<dd>the type of the node that threw the error.</dd>
<dt>msg.error.source.name <span class="property-type">string</span></dt>
<dd>the name, if set, of the node that threw the error.</dd>
</dl>
<h3>Details</h3>
<p>If a node throws a error whilst handling a message, the flow will typically
halt. This node can be used to catch those errors and handle them with a
dedicated flow.</p>
@ -49,16 +48,6 @@
<p>If an error is thrown within a subflow, the error will get handled by any
catch nodes within the subflow. If none exists, the error is propagated
up to the tab the subflow instance is on.</p>
<p>The message sent by this node will be the original message if the node that
threw the error provided it. The message will have an <code>error</code>
property with the following attributes:
<ul>
<li><code>message</code> : the error message</li>
<li><code>source.id</code> : the id of the node that threw the error</li>
<li><code>source.type</code> : the type of the node that threw the error</li>
<li><code>source.name</code> : the name, if set, of the node that threw the error</li>
</ul>
</p>
<p>If the message already had a <code>error</code> property, it is copied to <code>_error</code>.</p>
</script>
<style>
@ -123,7 +112,7 @@
var editorRow = $("#dialog-form>div.node-input-target-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-catch-target-container-div").css("height",height+"px");
}
};
function createNodeList() {
var scope = node.scope || [];
@ -233,11 +222,11 @@
$("#node-input-target-sort-type").click(function(e) {
e.preventDefault();
sortNodeList('sublabel')
sortNodeList('sublabel');
});
$("#node-input-target-node-checkbox-all").change(function() {
$(".node-input-target-node-checkbox").prop('checked',this.checked);
})
});
@ -251,7 +240,7 @@
}
node.resize();
});
if (this.scope == null) {
if (this.scope === null) {
$("#node-input-scope-select").val("all");
} else {
$("#node-input-scope-select").val("target");
@ -269,7 +258,7 @@
if ($(this).prop("checked")) {
node.scope.push($(this).data('node-id'));
}
})
});
}
},
oneditresize: function(size) {

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="status">
<div class="form-row">
@ -40,17 +25,22 @@
</div>
</script>
<script type="text/x-red" data-help-name="status">
<p>Send status messages from other nodes on the same tab.</p>
<p>The message sent by this node will have a <code>status</code> property
with the following attributes:
<ul>
<li><code>text</code> : the status text</li>
<li><code>source.type</code> : the type of the node that reported status</li>
<li><code>source.id</code> : the id of the node that reported status</li>
<li><code>source.name</code> : the name, if set, of the node that reported status</li>
</ul>
</p>
<p>Report status messages from other nodes on the same tab.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>status.text <span class="property-type">string</span></dt>
<dd>the status text.</dd>
<dt>status.source.type <span class="property-type">string</span></dt>
<dd>the type of the node that reported status.</dd>
<dt>status.source.id <span class="property-type">string</span></dt>
<dd>the id of the node that reported status.</dd>
<dt>status.source.name <span class="property-type">string</span></dt>
<dd>the name, if set, of the node that reported status.</dd>
</dl>
<h3>Details</h3>
<p>This node does not produce a <code>payload</code>.</p>
<p>By default the node reports status for all nodes on the same workspace tab.
It can be configured to selectively report status for individual nodes.</p>
</script>
<style>
#node-input-status-target-container {
@ -114,7 +104,7 @@
var editorRow = $("#dialog-form>div.node-input-target-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-status-target-container-div").css("height",height+"px");
}
};
function createNodeList() {
var scope = node.scope || [];
@ -213,7 +203,7 @@
if (labelA > labelB) { return currentSortOrder==='a'?1:-1; }
return 0;
});
$.each(items, function(i, li){
$.each(items, function(i, li) {
nodeList.append(li);
});
}
@ -224,11 +214,11 @@
$("#node-input-target-sort-type").click(function(e) {
e.preventDefault();
sortNodeList('sublabel')
sortNodeList('sublabel');
});
$("#node-input-target-node-checkbox-all").change(function() {
$(".node-input-target-node-checkbox").prop('checked',this.checked);
})
});
$("#node-input-scope-select").change(function(e) {
var scope = $(this).val();
@ -240,7 +230,7 @@
}
node.resize();
});
if (this.scope == null) {
if (this.scope === null) {
$("#node-input-scope-select").val("all");
} else {
$("#node-input-scope-select").val("target");
@ -258,8 +248,7 @@
if ($(this).prop("checked")) {
node.scope.push($(this).data('node-id'));
}
})
});
}
},
oneditresize: function(size) {

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="debug">
<div class="form-row">
@ -36,13 +21,16 @@
<script type="text/x-red" data-help-name="debug">
<p>The Debug node can be connected to the output of any node. It can be used to display the output of any message
property in the debug tab of the sidebar. The default is to display <code>msg.payload</code>.</p>
<p>Each message will also display the timestamp, <code>msg.topic</code> and the type of property chosen to output.</p>
<p>The sidebar can be accessed under the options drop-down in the top right corner.</p>
<p>Each message will also display the date, time, node-id and the type of the chosen property.</p>
<p>The sidebar can be accessed under the options drop-down ( <i class="fa fa-bars"></i> ) in the top right corner.</p>
<p>The button to the right of the node will toggle its output on and off so you can de-clutter the debug window.</p>
<p>If the payload is an object or buffer it will be stringified first for display and indicate that by saying "(Object)" or "(Buffer)".</p>
<p>Selecting any particular message will highlight (in red) the debug node that reported it. This is useful if you wire up multiple debug nodes.</p>
<p>Optionally can show the complete <code>msg</code> object, and send messages to the console log (⇶).</p>
<p>In addition any calls to node.warn or node.error will appear here.</p>
<p>You can explore the received messages further by clicking on them. Numbers will be shown in decimal and hex and
as a timestamp if appropriate. Objects and arrays can be further expanded as required. Buffers may be able to be
shown as strings if possible.</p>
<p>Selecting the node-id of any particular message will highlight (in red) the debug node that reported it.
This is useful if you wire up multiple debug nodes.</p>
<p>The node can also be configured to send all messages to the console log (⇶).</p>
<p><b>Note: </b>In addition, any calls to <b>node.warn</b> or <b>node.error</b> will also appear in the debug tab.</p>
</script>
<script src="debug/view/debug-utils.js"></script>
@ -105,7 +93,7 @@
error: function(jqXHR,textStatus,errorThrown) {
if (jqXHR.status == 404) {
RED.notify(node._("common.notification.error", {message: node._("common.notification.errors.not-deployed")}),"error");
} else if (jqXHR.status == 0) {
} else if (jqXHR.status === 0) {
RED.notify(node._("common.notification.error", {message: node._("common.notification.errors.no-response")}),"error");
} else {
RED.notify(node._("common.notification.error",{message:node._("common.notification.errors.unexpected",{status:err.status,message:err.response})}),"error");
@ -147,7 +135,7 @@
});
RED.view.redraw();
}
}
};
var uiComponents = RED.debug.init(options);
@ -159,7 +147,7 @@
toolbar: uiComponents.footer,
enableOnEdit: true
});
RED.actions.add("core:show-debug-tab",function() { RED.sidebar.show('debug')});
RED.actions.add("core:show-debug-tab",function() { RED.sidebar.show('debug'); });
var that = this;
RED._debug = function(msg) {
@ -167,18 +155,18 @@
name:"debug",
msg:msg
});
}
};
this.refreshMessageList = function() {
RED.debug.refreshMessageList(RED.workspaces.active());
if (subWindow) {
try {
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*")
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*");
} catch(err) {
console.log(err);
}
}
}
};
this.handleDebugMessage = function(t,o) {
var sourceNode = RED.nodes.node(o.id) || RED.nodes.node(o.z);
@ -189,7 +177,7 @@
RED.debug.handleDebugMessage(o);
if (subWindow) {
try {
subWindow.postMessage({event:"message",msg:o},"*")
subWindow.postMessage({event:"message",msg:o},"*");
} catch(err) {
console.log(err);
}
@ -204,13 +192,13 @@
subWindow = window.open(document.location.toString().replace(/[?#].*$/,"")+"debug/view/view.html"+document.location.search,"nodeREDDebugView","menubar=no,location=no,toolbar=no,chrome,height=500,width=600");
subWindow.onload = function() {
subWindow.postMessage({event:"workspaceChange",activeWorkspace:RED.workspaces.active()},"*");
}
};
});
$(window).unload(function() {
if (subWindow) {
try {
subWindow.close()
subWindow.close();
} catch(err) {
console.log(err);
}
@ -228,7 +216,7 @@
} else if (msg.event === "clear") {
options.clear();
}
}
};
window.addEventListener('message',this.handleWindowMessage);
},
onpaletteremove: function() {
@ -251,8 +239,7 @@
$("#node-input-typed-complete").typedInput('value',property);
}
$("#node-input-typed-complete").on('change',function() {
if ($("#node-input-typed-complete").typedInput('type') === 'msg'
&&
if ($("#node-input-typed-complete").typedInput('type') === 'msg' &&
$("#node-input-typed-complete").typedInput('value') === ''
) {
$("#node-input-typed-complete").typedInput('value','payload');

View File

@ -1,18 +1,3 @@
/**
* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
module.exports = function(RED) {
"use strict";
@ -86,6 +71,8 @@ module.exports = function(RED) {
});
function sendDebug(msg) {
// don't put blank errors in sidebar (but do add to logs)
//if ((msg.msg === "") && (msg.hasOwnProperty("level")) && (msg.level === 20)) { return; }
if (msg.msg instanceof Error) {
msg.format = "error";
var errorMsg = {};
@ -129,7 +116,7 @@ module.exports = function(RED) {
msg.msg = msg.msg.slice(0,debuglength);
}
}
if (isArray || msg.format === "Object") {
if (isArray || (msg.format === "Object")) {
msg.msg = safeJSONStringify(msg.msg, function(key, value) {
if (key === '_req' || key === '_res') {
return "[internal]"

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="link in">
<div class="form-row">
@ -30,21 +15,33 @@
</script>
<script type="text/x-red" data-help-name="link in">
<p>Create virtual wires between flows.</p>
<p>The node can be connected to any <b>link out</b> node that exists on any tab.
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>a msg object that was sent to a link out node.</dd>
</dl>
<h3>Details</h3>
<p>The node can be connected to any <code>link out</code> node that exists on any tab.
Once connected, they behave as if they were wired together.</p>
<p>The wires between link nodes are only displayed when a link node is selected.
If there are any wires to other tabs, a virtual node is show that can be clicked
If there are any wires to other tabs, a virtual node is shown that can be clicked
on to jump to the appropriate tab.</p>
<p>Links cannot be created going into, or out of, a subflow.</p>
<p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p>
</script>
<script type="text/x-red" data-help-name="link out">
<p>Create virtual wires between flows.</p>
<p>The node can be connected to any <b>link in</b> node that exists on any tab.
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>a msg object to send to a link in node.</dd>
</dl>
<h3>Details</h3>
<p>The node can be connected to any <code>link in</code> node that exists on any tab.
Once connected, they behave as if they were wired together.</p>
<p>The wires between link nodes are only displayed when a link node is selected.
If there are any wires to other tabs, a virtual node is show that can be clicked
on to jump to the appropriate tab.</p>
<p>Links cannot be created going into, or out of, a subflow.</p>
<p><b>Note: </b>Links cannot be created going into, or out of, a subflow.</p>
</script>
<style>
#node-input-link-container {
@ -141,14 +138,14 @@
var nodeList = $("#node-input-link-container");
var candidateNodes = RED.nodes.filterNodes({type:targetType});
var inSubflow = (RED.nodes.subflow(node.z) != null);
var inSubflow = (RED.nodes.subflow(node.z) !== null);
candidateNodes.forEach(function(n) {
if (inSubflow) {
if (n.z !== node.z) {
return;
}
} else {
if (RED.nodes.subflow(n.z)!=null) {
if (RED.nodes.subflow(n.z) !== null) {
return;
}
}
@ -223,7 +220,7 @@
if ($(this).prop("checked")) {
node.links.push($(this).data('node-id'));
}
})
});
node.oldLinks.sort();
node.links.sort();
var nodeMap = {};

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="function">
<div class="form-row">
@ -42,14 +27,14 @@
<h4>Logging and Error Handling</h4>
<p>To log any information, or report an error, the following functions are available:</p>
<ul>
<li><code>node.log("Log")</code></li>
<li><code>node.log("Log message")</code></li>
<li><code>node.warn("Warning")</code></li>
<li><code>node.error("Error")</code></li>
</ul>
</p>
<p>The Catch node can also be used to handle errors. To invoke a Catch node,
pass <code>msg</code> as a second argument to <code>node.error</code>:</p>
<pre>node.error("Error",msg)</pre>
<pre>node.error("Error",msg);</pre>
<h4>Sending messages</h4>
<p>The function can either return the messages it wants to pass on to the next nodes
in the flow, or can call <code>node.send(messages)</code>.</p>
@ -63,7 +48,6 @@
<p>If null is returned, either by itself or as an element of the array, no
message is passed on.</p>
<p>See the <a target="_blank" href="http://nodered.org/docs/writing-functions.html">online documentation</a> for more help.</p>
</script>
<script type="text/javascript">
@ -74,7 +58,7 @@
name: {value:""},
func: {value:"\nreturn msg;"},
outputs: {value:1},
noerr: {value:0,required:true,validate:function(v){ return ((!v) || (v === 0)) ? true : false; }}
noerr: {value:0,required:true,validate:function(v) { return ((!v) || (v === 0)) ? true : false; }}
},
inputs:1,
outputs:1,

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="template">
<div class="form-row">
@ -64,6 +49,17 @@
<script type="text/x-red" data-help-name="template">
<p>Sets a property based on the provided template.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>A msg object containing information to populate the template.</dd>
</dl>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>msg <span class="property-type">object</span></dt>
<dd>a msg with a property set by populating the configured template with properties from the incoming msg.</dd>
</dl>
<h3>Details</h3>
<p>By default this uses the <i><a href="http://mustache.github.io/mustache.5.html" target="_blank">mustache</a></i>
format, but this can be switched off if required.</p>
<p>For example, when a template of:
@ -76,8 +72,8 @@
}</pre>
<p>The resulting property will be:
<pre>Hello Fred. Today is Monday</pre>
<p>It is possible to use property from flow context or global context. Just use <code>{{flow.name}}</code> or <code>{{global.name}}</code>.
<p>By default, mustache will escape any HTML entities in the values it substitutes.
<p>It is possible to use a property from the flow context or global context. Just use <code>{{flow.name}}</code> or <code>{{global.name}}</code>.
<p><b>Note: </b>By default, <i>mustache</i> will escape any HTML entities in the values it substitutes.
To prevent this, use <code>{{{triple}}}</code> braces.
</script>
@ -131,9 +127,9 @@
$("#node-input-format").change(function() {
var mod = "ace/mode/"+$("#node-input-format").val();
that.editor.getSession().setMode({
path: mod,
v: Date.now()
})
path: mod,
v: Date.now()
});
});
},
oneditsave: function() {

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="comment">
<div class="form-row">
@ -31,6 +16,9 @@
<script type="text/x-red" data-help-name="comment">
<p>A node you can use to add comments to your flows.</p>
<h3>Details</h3>
<p>The edit panel will accept Markdown syntax. The text will be rendered into
this information side panel.</p>
</script>
<script type="text/javascript">

View File

@ -1,18 +1,3 @@
<!--
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="unknown">
<div class="form-tips"><span data-i18n="[html]unknown.tip"></span></div>
@ -20,11 +5,14 @@
<script type="text/x-red" data-help-name="unknown">
<p>This node is a type unknown to your installation of Node-RED.</p>
<p><i>If you deploy with the node in this state, it's configuration will be preserved, but
<h3>Details</h3>
<p><i>If you deploy with the node in this state, its configuration will be preserved, but
the flow will not start until the missing type is installed.</i></p>
<p>It is possible this node type is already installed, but is missing a dependency. Check the Node-RED start-up log for
any error messages associated with the missing node type. Use <b>npm install &lt;module&gt;</b> to install any missing modules
and restart Node-RED and reimport the nodes.</p>
<p>Use the <code>Menu - Manage Palette</code> option
to search for and install nodes, or <b>npm install &lt;module&gt;</b> to
install, any missing modules and restart Node-RED and reimport the nodes.</p>
<p>It is possible this node type is already installed, but is missing a dependency. Check the Node-RED start-up
log for any error messages associated with the missing node type.</p>
<p>Otherwise, you should contact the author of the flow to obtain a copy of the missing node type.</p>
</script>

View File

@ -23,7 +23,7 @@
"enabled": "Enabled",
"disabled":"Disabled",
"info": "Description",
"tip": "Description will accept Markdown and will appear in the Info tab."
"tip": "Description accepts Markdown and will appear in the Info tab."
},
"menu": {
"label": {