1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Restructure info tab

This commit is contained in:
Nick O'Leary 2017-04-06 23:17:06 +01:00
parent 203539841d
commit 624befd704
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
7 changed files with 242 additions and 131 deletions

View File

@ -20,37 +20,46 @@ RED.stack = (function() {
var entries = []; var entries = [];
var visible = true;
return { return {
add: function(entry) { add: function(entry) {
entries.push(entry); entries.push(entry);
var entryContainer = $('<div class="palette-category">').appendTo(container); entry.container = $('<div class="palette-category">').appendTo(container);
if (!visible) {
var header = $('<div class="palette-header"></div>').appendTo(entryContainer); entry.container.hide();
var icon = $('<i class="fa fa-angle-down"></i>').appendTo(header);
$('<span></span>').html(entry.title).appendTo(header);
entry.content = $('<div class="editor-tray-content"></div>').appendTo(entryContainer);
if (entry.expanded) {
icon.addClass("expanded");
} else {
entry.content.hide();
} }
var header = $('<div class="palette-header"></div>').appendTo(entry.container);
header.click(function() { entry.content = $('<div></div>').appendTo(entry.container);
if (options.singleExpanded) { if (entry.collapsible !== false) {
if (!entry.isExpanded()) { header.click(function() {
for (var i=0;i<entries.length;i++) { if (options.singleExpanded) {
if (entries[i].isExpanded()) { if (!entry.isExpanded()) {
entries[i].collapse(); for (var i=0;i<entries.length;i++) {
if (entries[i].isExpanded()) {
entries[i].collapse();
}
} }
entry.expand();
} }
entry.expand(); } else {
entry.toggle();
} }
});
var icon = $('<i class="fa fa-angle-down"></i>').appendTo(header);
if (entry.expanded) {
icon.addClass("expanded");
} else { } else {
entry.toggle(); entry.content.hide();
} }
}); } else {
header.css("cursor","default");
}
entry.title = $('<span></span>').html(entry.title).appendTo(header);
entry.toggle = function() { entry.toggle = function() {
if (entry.isExpanded()) { if (entry.isExpanded()) {
entry.collapse(); entry.collapse();
@ -85,6 +94,21 @@ RED.stack = (function() {
}, },
hide: function() {
visible = false;
entries.forEach(function(entry) {
entry.container.hide();
});
return this;
},
show: function() {
visible = true;
entries.forEach(function(entry) {
entry.container.show();
});
return this;
}
} }
} }

View File

@ -963,12 +963,16 @@ RED.editor = (function() {
title: RED._("editor.nodeProperties"), title: RED._("editor.nodeProperties"),
expanded: true expanded: true
}); });
nodeProperties.content.addClass("editor-tray-content");
var portLabels = stack.add({ var portLabels = stack.add({
title: RED._("editor.portLabels"), title: RED._("editor.portLabels"),
onexpand: function() { onexpand: function() {
refreshLabelForm(this.content,node); refreshLabelForm(this.content,node);
} }
}); });
portLabels.content.addClass("editor-tray-content");
if (editing_node) { if (editing_node) {
RED.sidebar.info.refresh(editing_node); RED.sidebar.info.refresh(editing_node);
@ -1537,9 +1541,11 @@ RED.editor = (function() {
title: RED._("editor.nodeProperties"), title: RED._("editor.nodeProperties"),
expanded: true expanded: true
}); });
nodeProperties.content.addClass("editor-tray-content");
var portLabels = stack.add({ var portLabels = stack.add({
title: RED._("editor.portLabels") title: RED._("editor.portLabels")
}); });
portLabels.content.addClass("editor-tray-content");

View File

@ -101,7 +101,7 @@ RED.palette = (function() {
if (label != type) { if (label != type) {
l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b><br/><i>"+type+"</i></p>"; l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b><br/><i>"+type+"</i></p>";
} }
popOverContent = $(l+(info?info:$("script[data-help-name$='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim()) popOverContent = $(l+(info?info:$("script[data-help-name='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
.filter(function(n) { .filter(function(n) {
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0) return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
}).slice(0,2); }).slice(0,2);
@ -205,7 +205,7 @@ RED.palette = (function() {
if (nt.indexOf("subflow:") === 0) { if (nt.indexOf("subflow:") === 0) {
helpText = marked(RED.nodes.subflow(nt.substring(8)).info||""); helpText = marked(RED.nodes.subflow(nt.substring(8)).info||"");
} else { } else {
helpText = $("script[data-help-name$='"+d.type+"']").html()||""; helpText = $("script[data-help-name='"+d.type+"']").html()||"";
} }
var help = '<div class="node-help">'+helpText+"</div>"; var help = '<div class="node-help">'+helpText+"</div>";
RED.sidebar.info.set(help); RED.sidebar.info.set(help);

View File

@ -26,20 +26,40 @@ RED.sidebar.info = (function() {
smartypants: false smartypants: false
}); });
var content = document.createElement("div"); var content;
content.style.paddingTop = "4px"; var sections;
content.style.paddingLeft = "4px"; var nodeSection;
content.style.paddingRight = "4px"; var infoSection;
content.className = "sidebar-node-info" var tipBox;
var expandedSections = { var expandedSections = {
"node": true, "property": false
"property": false,
"info": true,
"subflow": true
}; };
function init() { function init() {
content = document.createElement("div");
content.className = "sidebar-node-info"
tipBox = $('<div class="node-info-tip collapsed hide"></div>').appendTo(content);
RED.actions.add("core:show-info-tab",show);
sections = RED.stack.create({
container: content
}).hide();
nodeSection = sections.add({
title: "Node",
collapsible: false
});
infoSection = sections.add({
title: "Information",
collapsible: false
});
infoSection.content.css("padding","6px");
infoSection.container.css("border-bottom","none");
RED.sidebar.addTab({ RED.sidebar.addTab({
id: "info", id: "info",
label: RED._("sidebar.info.label"), label: RED._("sidebar.info.label"),
@ -47,7 +67,6 @@ RED.sidebar.info = (function() {
content: content, content: content,
enableOnEdit: true enableOnEdit: true
}); });
RED.actions.add("core:show-info-tab",show);
} }
function show() { function show() {
@ -82,84 +101,100 @@ RED.sidebar.info = (function() {
} }
function refresh(node) { function refresh(node) {
tips.stop(); tips.stop();
$(content).empty(); sections.show();
$(nodeSection.content).empty();
$(infoSection.content).empty();
var table = $('<table class="node-info"></table>'); var table = $('<table class="node-info"></table>');
var tableBody = $('<tbody>').appendTo(table); var tableBody = $('<tbody>').appendTo(table);
$('<tr class="blank"><th colspan="2"><a href="#" class="node-info-node-header'+(expandedSections.node?" expanded":"")+'"><i class="fa fa-angle-right"></i> '+RED._("sidebar.info.node")+'</a></th></tr>').appendTo(tableBody); var propRow;
if (node.type === "tab") {
nodeSection.title.html("Flow");
propRow = $('<tr class="node-info-node-row"><td>Name</td><td></td></tr>').appendTo(tableBody);
$(propRow.children()[1]).html('&nbsp;'+(node.label||""))
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.id")+"</td><td></td></tr>").appendTo(tableBody);
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
propRow = $('<tr class="node-info-node-row"><td>Enabled</td><td></td></tr>').appendTo(tableBody);
RED.utils.createObjectElement((!!!node.disabled)).appendTo(propRow.children()[1]);
} else {
if (node.type != "subflow" && node.name) { nodeSection.title.html("Node");
$('<tr class="node-info-node-row'+(expandedSections.node?"":" hide")+'"><td>'+RED._("common.label.name")+'</td><td>&nbsp;<span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'">'+node.name+'</span></td></tr>').appendTo(tableBody); if (node.type !== "subflow" && node.name) {
} $('<tr class="node-info-node-row"><td>'+RED._("common.label.name")+'</td><td>&nbsp;<span class="bidiAware" dir="'+RED.text.bidi.resolveBaseTextDir(node.name)+'">'+node.name+'</span></td></tr>').appendTo(tableBody);
$('<tr class="node-info-node-row'+(expandedSections.node?"":" hide")+'"><td>'+RED._("sidebar.info.type")+"</td><td>&nbsp;"+node.type+"</td></tr>").appendTo(tableBody);
$('<tr class="node-info-node-row'+(expandedSections.node?"":" hide")+'"><td>'+RED._("sidebar.info.id")+"</td><td>&nbsp;"+node.id+"</td></tr>").appendTo(tableBody);
var m = /^subflow(:(.+))?$/.exec(node.type);
var subflowNode;
if (m) {
if (m[2]) {
subflowNode = RED.nodes.subflow(m[2]);
} else {
subflowNode = node;
} }
$('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.type")+"</td><td>&nbsp;"+node.type+"</td></tr>").appendTo(tableBody);
propRow = $('<tr class="node-info-node-row"><td>'+RED._("sidebar.info.id")+"</td><td></td></tr>").appendTo(tableBody);
RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]);
$('<tr class="blank"><th colspan="2"><a href="#" class="node-info-subflow-header'+(expandedSections.subflow?" expanded":"")+'"><i class="fa fa-angle-right"></i> '+RED._("sidebar.info.subflow")+'</a></th></tr>').appendTo(tableBody); var m = /^subflow(:(.+))?$/.exec(node.type);
var subflowNode;
var userCount = 0; if (!m && node.type != "subflow" && node.type != "comment") {
var subflowType = "subflow:"+subflowNode.id; if (node._def) {
RED.nodes.eachNode(function(n) { var count = 0;
if (n.type === subflowType) { for (var n in node._def.defaults) {
userCount++; if (n != "name" && node._def.defaults.hasOwnProperty(n)) {
} var val = node[n];
}); var type = typeof val;
$('<tr class="node-info-subflow-row'+(expandedSections.subflow?"":" hide")+'"><td>'+RED._("common.label.name")+'</td><td><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.name)+'">'+subflowNode.name+'</span></td></tr>').appendTo(tableBody); count++;
$('<tr class="node-info-subflow-row'+(expandedSections.subflow?"":" hide")+'"><td>'+RED._("sidebar.info.instances")+"</td><td>"+userCount+'</td></tr>').appendTo(tableBody); propRow = $('<tr class="node-info-property-row'+(expandedSections.property?"":" hide")+'"><td>'+n+"</td><td></td></tr>").appendTo(tableBody);
} RED.utils.createObjectElement(val).appendTo(propRow.children()[1]);
}
if (!m && node.type != "subflow" && node.type != "comment") { }
$('<tr class="blank"><th colspan="2"><a href="#" class="node-info-property-header'+(expandedSections.property?" expanded":"")+'"><i class="fa fa-angle-right"></i> '+RED._("sidebar.info.properties")+'</a></th></tr>').appendTo(tableBody); if (count > 0) {
if (node._def) { $('<tr class="node-info-property-expand blank"><td colspan="2"><a href="#" class=" node-info-property-header'+(expandedSections.property?" expanded":"")+'"><span class="node-info-property-show-more">show more</span><span class="node-info-property-show-less">show less</span> <i class="fa fa-caret-down"></i></a></td></tr>').appendTo(tableBody);
for (var n in node._def.defaults) {
if (n != "name" && node._def.defaults.hasOwnProperty(n)) {
var val = node[n];
var type = typeof val;
var propRow = $('<tr class="node-info-property-row'+(expandedSections.property?"":" hide")+'"><td>'+n+"</td><td></td></tr>").appendTo(tableBody);
RED.utils.createObjectElement(val).appendTo(propRow.children()[1]);
} }
} }
} }
if (m) {
if (m[2]) {
subflowNode = RED.nodes.subflow(m[2]);
} else {
subflowNode = node;
}
$('<tr class="blank"><th colspan="2"><a href="#" class="node-info-subflow-header">'+RED._("sidebar.info.subflow")+'</a></th></tr>').appendTo(tableBody);
var userCount = 0;
var subflowType = "subflow:"+subflowNode.id;
RED.nodes.eachNode(function(n) {
if (n.type === subflowType) {
userCount++;
}
});
$('<tr class="node-info-subflow-row"><td>'+RED._("common.label.name")+'</td><td><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(subflowNode.name)+'">'+subflowNode.name+'</span></td></tr>').appendTo(tableBody);
$('<tr class="node-info-subflow-row"><td>'+RED._("sidebar.info.instances")+"</td><td>"+userCount+'</td></tr>').appendTo(tableBody);
}
} }
$(table).appendTo(content);
$(table).appendTo(nodeSection.content);
var infoText = ""; var infoText = "";
if (!subflowNode && node.type != "comment") { if (!subflowNode && node.type != "comment") {
var helpText = $("script[data-help-name$='"+node.type+"']").html()||""; var helpText = $("script[data-help-name='"+node.type+"']").html()||"";
infoText = helpText; infoText = helpText;
} }
if (subflowNode) { if (subflowNode) {
infoText = marked(subflowNode.info||""); infoText = infoText + marked(subflowNode.info||"");
} else if (node._def && node._def.info) { } else if (node._def && node._def.info) {
var info = node._def.info; var info = node._def.info;
var textInfo = (typeof info === "function" ? info.call(node) : info); var textInfo = (typeof info === "function" ? info.call(node) : info);
infoText = marked(textInfo); // TODO: help
infoText = infoText + marked(textInfo);
} }
if (infoText) { if (infoText) {
$('<tr class="blank"><th colspan="2"><a href="#" class="node-info-info-header'+(expandedSections.info?" expanded":"")+'"><i class="fa fa-angle-right"></i> '+RED._("sidebar.info.info")+'</a></th></tr>').appendTo(tableBody); addTargetToExternalLinks($('<div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(infoText)+'">'+infoText+'</span></div>')).appendTo(infoSection.content);
addTargetToExternalLinks($('<tr class="blank node-info-info-row'+(expandedSections.info?"":" hide")+'"><td colspan="2"><div class="node-help"><span class="bidiAware" dir=\"'+RED.text.bidi.resolveBaseTextDir(infoText)+'">'+infoText+'</span></div></td></tr>')).appendTo(tableBody);
} }
["node","subflow","property","info"].forEach(function(t) { $(".node-info-property-header").click(function(e) {
$(".node-info-"+t+"-header").click(function(e) { e.preventDefault();
e.preventDefault(); expandedSections["property"] = !expandedSections["property"];
console.log(t,expandedSections[t]); $(this).toggleClass("expanded",expandedSections["property"]);
expandedSections[t] = !expandedSections[t]; $(".node-info-property-row").toggle(expandedSections["property"]);
$(this).toggleClass("expanded",expandedSections[t]); });
$(".node-info-"+t+"-row").toggle(expandedSections[t]);
})
})
} }
@ -203,15 +238,14 @@ RED.sidebar.info = (function() {
while ((m=/(\[(.*?)\])/.exec(tip))) { while ((m=/(\[(.*?)\])/.exec(tip))) {
tip = tip.replace(m[1],RED.keyboard.formatKey(m[2])); tip = tip.replace(m[1],RED.keyboard.formatKey(m[2]));
} }
$('<div class="node-info-tip hide">'+tip+'</div>').appendTo(content).fadeIn(200); tipBox.html(tip).fadeIn(200);
if (startTimeout) { if (startTimeout) {
startTimeout = null; startTimeout = null;
refreshTimeout = setInterval(cycleTips,cycleDelay); refreshTimeout = setInterval(cycleTips,cycleDelay);
} }
} }
function cycleTips() { function cycleTips() {
$(".node-info-tip").fadeOut(300,function() { tipBox.fadeOut(300,function() {
$(this).remove();
setTip(); setTip();
}) })
} }
@ -219,7 +253,6 @@ RED.sidebar.info = (function() {
started = true; started = true;
if (enabled) { if (enabled) {
if (!startTimeout && !refreshTimeout) { if (!startTimeout && !refreshTimeout) {
$(content).html("");
if (tipCount === -1) { if (tipCount === -1) {
do { do {
tipCount++; tipCount++;
@ -235,7 +268,7 @@ RED.sidebar.info = (function() {
clearTimeout(startTimeout); clearTimeout(startTimeout);
refreshTimeout = null; refreshTimeout = null;
startTimeout = null; startTimeout = null;
$(".node-info-tip").remove(); tipBox.hide();
} }
return { return {
start: startTips, start: startTips,
@ -244,12 +277,15 @@ RED.sidebar.info = (function() {
})(); })();
function clear() { function clear() {
console.log("clear');");
sections.hide();
tips.start(); tips.start();
} }
function set(html) { function set(html) {
tips.stop(); tips.stop();
$(content).html(html); sections.show();
$(infoSection.content).html(html);
} }
@ -265,9 +301,11 @@ RED.sidebar.info = (function() {
} }
} }
} else { } else {
var subflow = RED.nodes.subflow(RED.workspaces.active()); var activeWS = RED.workspaces.active();
if (subflow) {
refresh(subflow); var flow = RED.nodes.workspace(activeWS) || RED.nodes.subflow(activeWS);
if (flow) {
refresh(flow);
} else { } else {
clear(); clear();
} }

View File

@ -19,18 +19,29 @@
} }
table.node-info { table.node-info {
font-size: 14px; font-size: 14px;
margin: 0px; margin: 0 0 10px;
width: 97%; width: 100%;
} }
table.node-info tr:not(.blank) { table.node-info tr:not(.blank) {
border: 1px solid #ddd; border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
}
.node-info-property-expand {
font-size: 0.8em;
text-align: right;
line-height: 0.9em;
a {
padding-bottom: 5px;
}
} }
table.node-info tr.blank { table.node-info tr.blank {
border: none; border: none;
th { th {
text-align: left; text-align: left;
font-weight: bold; font-weight: 500;
color: #444; color: #444;
padding: 6px 3px 3px;
} }
>* { >* {
padding-top: 8px; padding-top: 8px;
@ -38,20 +49,38 @@ table.node-info tr.blank {
padding-left: 0px; padding-left: 0px;
} }
a { a {
display: block; display: block;
color: #444; color: #666;
&:hover,&:focus { &:hover,&:focus {
color: #444; color: #666;
text-decoration: none; text-decoration: none;
} }
&:not(.expanded) {
.node-info-property-show-more {
display: inline;
}
.node-info-property-show-less {
display: none;
}
}
i { i {
width: 10px; width: 10px;
text-align: center; text-align: center;
transition: transform 0.2s ease-in-out; transition: transform 0.2s ease-in-out;
} }
&.expanded i {
transform: rotate(90deg); &.expanded {
.node-info-property-show-more {
display: none;
}
.node-info-property-show-less {
display: inline;
}
i {
transform: rotate(180deg);
}
} }
} }
&.node-info-info-row > td { &.node-info-info-row > td {
@ -63,11 +92,11 @@ table.node-info tr:not(.blank) td:first-child{
color: #666; color: #666;
vertical-align: top; vertical-align: top;
width: 90px; width: 90px;
padding: 3px; padding: 3px 3px 3px 6px;
border-right: 1px solid #ddd; border-right: 1px solid #ddd;
} }
table.node-info tr:not(.blank) td:last-child{ table.node-info tr:not(.blank) td:last-child{
padding-left: 5px; padding: 3px 3px 3px 6px;
color: #666; color: #666;
} }
div.node-info { div.node-info {
@ -78,33 +107,33 @@ div.node-info {
line-height: 1.5em; line-height: 1.5em;
h1 { h1 {
font-weight: 500; font-weight: 500;
font-size: 23px; font-size: 1.296em;
line-height: 1.3em; line-height: 1.3em;
margin: 8px auto; margin: 8px auto;
} }
h2 { h2 {
font-weight: 500; font-weight: 500;
font-size: 18px; font-size: 1.215em;
margin: 8px auto; margin: 8px auto;
line-height: 1.3em; line-height: 1.3em;
} }
h3 { h3 {
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 1.138em;
margin: 7px auto 5px; margin: 7px auto 5px;
line-height: 1.3em; line-height: 1.3em;
} }
h4, h4,
h5 { h5 {
font-weight: 500; font-weight: 500;
font-size: 14px; font-size: 1.067em;
line-height: 1.3em; line-height: 1.3em;
margin: 8px auto 5px; margin: 8px auto 5px;
} }
& > span > p:first-child { & > span > p:first-child {
} }
dl.message-properties { dl.message-properties {
border: 1px solid #eee; border: 1px solid #ddd;
border-radius: 2px; border-radius: 2px;
margin: 5px auto 10px; margin: 5px auto 10px;
@ -115,9 +144,6 @@ div.node-info {
margin: 5px 3px 1px; margin: 5px 3px 1px;
color: #AD1625; color: #AD1625;
white-space: nowrap; white-space: nowrap;
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
border-radius: 2px;
&.optional { &.optional {
font-style: italic; font-style: italic;
@ -136,17 +162,21 @@ div.node-info {
} }
} }
&>dd { &>dd {
margin: 1px 8px 10px 10px; margin: 0px 8px 2px 13px;
vertical-align: top;
} }
} }
ol.node-ports { ol.node-ports {
margin: 0; margin: 0;
li { li {
border: 1px solid #eee; border: 1px solid #ddd;
border-radius: 2px; border-radius: 2px;
list-style-position: inside; list-style-position: inside;
padding: 3px; padding: 3px;
margin-bottom: 5px; margin-bottom: 5px;
dl.message-properties {
border: none;
}
} }
} }
@ -164,5 +194,13 @@ div.node-info {
background-color: #fff; background-color: #fff;
@include disable-selection; @include disable-selection;
cursor: default; cursor: default;
box-sizing: border-box;
&.collapsed {
top: auto;
bottom: 0;
height: 150px;
border-top: 1px solid $secondary-border-color;
}
} }

View File

@ -44,14 +44,19 @@
</script> </script>
<script type="text/x-red" data-help-name="exec"> <script type="text/x-red" data-help-name="exec">
<p>Calls out to a system command.</p> <p>Runs a system command and returns its output.</p>
<p>The node can be configured to either wait until the command completes, or to
send its output as the command generates it.</p>
<p>The command that is run can be configured in the node or provided by the received
message.</p>
<h3>Inputs</h3> <h3>Inputs</h3>
<dl class="message-properties"> <dl class="message-properties">
<dt class="optional">msg.payload <span class="property-type">string</span></dt> <dt class="optional">payload <span class="property-type">string</span></dt>
<dd>if configured to do so, will be appended to the executed command.</dd> <dd>if configured to do so, will be appended to the executed command.</dd>
<dt class="optional">msg.kill <span class="property-type">string</span></dt> <dt class="optional">kill <span class="property-type">string</span></dt>
<dd>the type of kill signal to send an existing exec node process.</dd> <dd>the type of kill signal to send an existing exec node process.</dd>
<dt class="optional">msg.pid <span class="property-type">number|string</span></dt> <dt class="optional">pid <span class="property-type">number|string</span></dt>
<dd>the process ID of an existing exec node process to kill.</dd> <dd>the process ID of an existing exec node process to kill.</dd>
</dl> </dl>
@ -59,20 +64,20 @@
<ol class="node-ports"> <ol class="node-ports">
<li>Standard output <li>Standard output
<dl class="message-properties"> <dl class="message-properties">
<dt>msg.payload <span class="property-type">string</span></dt> <dt>payload <span class="property-type">string</span></dt>
<dd>the standard output of the command.</dd> <dd>the standard output of the command.</dd>
</dl> </dl>
</li> </li>
<li>Standard error <li>Standard error
<dl class="message-properties"> <dl class="message-properties">
<dt>msg.payload <span class="property-type">string</span></dt> <dt>payload <span class="property-type">string</span></dt>
<dd>the standard error of the command.</dd> <dd>the standard error of the command.</dd>
</dl> </dl>
</li> </li>
<li>Return code <li>Return code
<dl class="message-properties"> <dl class="message-properties">
<dt>msg.payload <span class="property-type">number</span></dt> <dt>payload <span class="property-type">number</span></dt>
<dd>the return code of the command.</dd> <dd>the return code of the command.</dd>
</dl> </dl>
</li> </li>

View File

@ -38,13 +38,13 @@
<p>Connects to a MQTT broker and subscribes to messages from the specified topic.</p> <p>Connects to a MQTT broker and subscribes to messages from the specified topic.</p>
<h3>Outputs</h3> <h3>Outputs</h3>
<dl class="message-properties"> <dl class="message-properties">
<dt>msg.payload <span class="property-type">string | buffer</span></dt> <dt>payload <span class="property-type">string | buffer</span></dt>
<dd>a string unless detected as a binary buffer.</dd> <dd>a string unless detected as a binary buffer.</dd>
<dt>msg.topic <span class="property-type">string</span></dt> <dt>topic <span class="property-type">string</span></dt>
<dd>the MQTT topic, uses / as a heirarchy separator.</dd> <dd>the MQTT topic, uses / as a heirarchy separator.</dd>
<dt>msg.qos <span class="property-type">number</span> </dt> <dt>qos <span class="property-type">number</span> </dt>
<dd>0, fire and forget - 1, at least once - 2, once and once only.</dd> <dd>0, fire and forget - 1, at least once - 2, once and once only.</dd>
<dt>msg.retain <span class="property-type">boolean</span></dt> <dt>retain <span class="property-type">boolean</span></dt>
<dd>true indicates the message was retained and may be old.</dd> <dd>true indicates the message was retained and may be old.</dd>
</dl> </dl>
<h3>Details</h3> <h3>Details</h3>
@ -115,16 +115,16 @@
<p>Connects to a MQTT broker and publishes messages.</p> <p>Connects to a MQTT broker and publishes messages.</p>
<h3>Inputs</h3> <h3>Inputs</h3>
<dl class="message-properties"> <dl class="message-properties">
<dt>msg.payload <span class="property-type">string | buffer</span></dt> <dt>payload <span class="property-type">string | buffer</span></dt>
<dd> most users prefer simple text payloads, but binary buffers can also be published.</dd> <dd> most users prefer simple text payloads, but binary buffers can also be published.</dd>
<dt class="optional">msg.topic <span class="property-type">string</span></dt> <dt class="optional">topic <span class="property-type">string</span></dt>
<dd> the MQTT topic to publish to.</dd> <dd> the MQTT topic to publish to.</dd>
<dt class="optional">msg.qos <span class="property-type">number</span></dt> <dt class="optional">qos <span class="property-type">number</span></dt>
<dd>0, fire and forget - 1, at least once - 2, once and once only. Default 0.</dd> <dd>0, fire and forget - 1, at least once - 2, once and once only. Default 0.</dd>
<dt class="optional">msg.retain <span class="property-type">boolean</span></dt> <dt class="optional">retain <span class="property-type">boolean</span></dt>
<dd>set to true to retain the message on the broker. Default false.</dd> <dd>set to true to retain the message on the broker. Default false.</dd>
</dl> </dl>
<h3>Details</h3> <h3>Details</h3>