mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'master' into dev
This commit is contained in:
@@ -131,8 +131,32 @@
|
||||
RED.view.redraw();
|
||||
}
|
||||
},
|
||||
messageSourceClick: function(sourceId) {
|
||||
RED.view.reveal(sourceId);
|
||||
messageSourceClick: function(sourceId, aliasId, path) {
|
||||
// Get all of the nodes that could have logged this message
|
||||
var candidateNodes = [RED.nodes.node(sourceId)]
|
||||
if (path) {
|
||||
for (var i=2;i<path.length;i++) {
|
||||
candidateNodes.push(RED.nodes.node(path[i]))
|
||||
}
|
||||
}
|
||||
if (aliasId) {
|
||||
candidateNodes.push(RED.nodes.node(aliasId));
|
||||
}
|
||||
if (candidateNodes.length > 1) {
|
||||
// The node is in a subflow. Check to see if the active
|
||||
// workspace is a subflow in the node's parentage. If
|
||||
// so, reveal the relevant subflow instance node.
|
||||
var ws = RED.workspaces.active();
|
||||
for (var i=0;i<candidateNodes.length;i++) {
|
||||
if (candidateNodes[i].z === ws) {
|
||||
RED.view.reveal(candidateNodes[i].id);
|
||||
return
|
||||
}
|
||||
}
|
||||
// The active workspace is unrelated to the node. So
|
||||
// fall back to revealing the top most node
|
||||
}
|
||||
RED.view.reveal(candidateNodes[0].id);
|
||||
},
|
||||
clear: function() {
|
||||
RED.nodes.eachNode(function(node) {
|
||||
@@ -179,9 +203,44 @@
|
||||
RED.events.on("workspace:change", this.refreshMessageList);
|
||||
|
||||
this.handleDebugMessage = function(t,o) {
|
||||
var sourceNode = RED.nodes.node(o.id) || RED.nodes.node(o.z);
|
||||
// console.log("->",o.id,o.z,o._alias);
|
||||
//
|
||||
// sourceNode should be the top-level node - one that is on a flow.
|
||||
var sourceNode;
|
||||
var pathParts;
|
||||
if (o.path) {
|
||||
// Path is a `/`-separated list of ids that identifies the
|
||||
// complete parentage of the node that generated this message.
|
||||
// flow-id/subflow-A-instance/subflow-A-type/subflow-B-instance/subflow-B-type/node-id
|
||||
|
||||
// If it has one id, that is a top level flow
|
||||
// each subsequent id is the instance id of a subflow node
|
||||
//
|
||||
pathParts = o.path.split("/");
|
||||
if (pathParts.length === 1) {
|
||||
// The source node is on a flow - so can use its id to find
|
||||
sourceNode = RED.nodes.node(o.id);
|
||||
} else if (pathParts.length > 1) {
|
||||
// Highlight the subflow instance node.
|
||||
sourceNode = RED.nodes.node(pathParts[1]);
|
||||
}
|
||||
} else {
|
||||
// This is probably redundant...
|
||||
sourceNode = RED.nodes.node(o.id) || RED.nodes.node(o.z);
|
||||
}
|
||||
if (sourceNode) {
|
||||
o._source = {id:sourceNode.id,z:sourceNode.z,name:sourceNode.name,type:sourceNode.type,_alias:o._alias};
|
||||
o._source = {
|
||||
id:sourceNode.id,
|
||||
z:sourceNode.z,
|
||||
name:sourceNode.name,
|
||||
type:sourceNode.type,
|
||||
// _alias identifies the actual logging node. This is
|
||||
// not necessarily the same as sourceNode, which will be
|
||||
// the top-level subflow instance node.
|
||||
// This means the node's name is displayed in the sidebar.
|
||||
_alias:o._alias,
|
||||
path: pathParts
|
||||
};
|
||||
}
|
||||
RED.debug.handleDebugMessage(o);
|
||||
if (subWindow) {
|
||||
@@ -235,7 +294,7 @@
|
||||
} else if (msg.event === "mouseLeave") {
|
||||
options.messageMouseLeave(msg.id);
|
||||
} else if (msg.event === "mouseClick") {
|
||||
options.messageSourceClick(msg.id);
|
||||
options.messageSourceClick(msg.id,msg._alias,msg.path);
|
||||
} else if (msg.event === "clear") {
|
||||
options.clear();
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ module.exports = function(RED) {
|
||||
if (err) {
|
||||
done(RED._("debug.invalid-exp", {error: editExpression}));
|
||||
} else {
|
||||
done(null,{id:node.id, z:node.z, name:node.name, topic:msg.topic, msg:value, _path:msg._path});
|
||||
done(null,{id:node.id, z:node.z, _alias: node._alias, path:node._flow.path, name:node.name, topic:msg.topic, msg:value});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -77,7 +77,7 @@ module.exports = function(RED) {
|
||||
output = undefined;
|
||||
}
|
||||
}
|
||||
done(null,{id:node.id, z:node.z, name:node.name, topic:msg.topic, property:property, msg:output, _path:msg._path});
|
||||
done(null,{id:node.id, z:node.z, _alias: node._alias, path:node._flow.path, name:node.name, topic:msg.topic, property:property, msg:output});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, z:node.z, name:node.name, topic:msg.topic, msg:msg, _path:msg._path});
|
||||
sendDebug({id:node.id, z:node.z, _alias: node._alias, path:node._flow.path, name:node.name, topic:msg.topic, msg:msg});
|
||||
}
|
||||
done();
|
||||
} else {
|
||||
|
@@ -406,10 +406,16 @@ RED.debug = (function() {
|
||||
msg.on("mouseenter", function() {
|
||||
msg.addClass('red-ui-debug-msg-hover');
|
||||
if (o._source) {
|
||||
// highlight the top-level node (could be subflow instance)
|
||||
config.messageMouseEnter(o._source.id);
|
||||
if (o._source._alias) {
|
||||
// this is inside a subflow - highlight the node itself
|
||||
config.messageMouseEnter(o._source._alias);
|
||||
}
|
||||
// if path.length > 2, we are nested - highlight subflow instances
|
||||
for (var i=2;i<o._source.path.length;i++) {
|
||||
config.messageMouseEnter(o._source.path[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
msg.on("mouseleave", function() {
|
||||
@@ -419,6 +425,9 @@ RED.debug = (function() {
|
||||
if (o._source._alias) {
|
||||
config.messageMouseLeave(o._source._alias);
|
||||
}
|
||||
for (var i=2;i<o._source.path.length;i++) {
|
||||
config.messageMouseLeave(o._source.path[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
var name = sanitize(((o.name?o.name:o.id)||"").toString());
|
||||
@@ -452,7 +461,7 @@ RED.debug = (function() {
|
||||
.appendTo(metaRow)
|
||||
.on("click", function(evt) {
|
||||
evt.preventDefault();
|
||||
config.messageSourceClick(sourceNode.id);
|
||||
config.messageSourceClick(sourceNode.id, sourceNode._alias, sourceNode.path);
|
||||
});
|
||||
} else if (name) {
|
||||
$('<span class="red-ui-debug-msg-name">'+name+'</span>').appendTo(metaRow);
|
||||
|
@@ -7,8 +7,8 @@ $(function() {
|
||||
messageMouseLeave: function(sourceId) {
|
||||
window.opener.postMessage({event:"mouseLeave",id:sourceId},'*');
|
||||
},
|
||||
messageSourceClick: function(sourceId) {
|
||||
window.opener.postMessage({event:"mouseClick",id:sourceId},'*');
|
||||
messageSourceClick: function(sourceId, aliasId, path) {
|
||||
window.opener.postMessage({event:"mouseClick",id:sourceId, _alias: aliasId, path: path},'*');
|
||||
},
|
||||
clear: function() {
|
||||
window.opener.postMessage({event:"clear"},'*');
|
||||
|
@@ -173,7 +173,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$("#node-input-rule-container").css('min-height','250px').css('min-width','450px').editableList({
|
||||
$("#node-input-rule-container").css('min-height','150px').css('min-width','450px').editableList({
|
||||
addItem: function(container,i,opt) {
|
||||
if (!opt.hasOwnProperty('r')) {
|
||||
opt.r = {};
|
||||
@@ -453,6 +453,7 @@
|
||||
}
|
||||
var editorRow = $("#dialog-form>div.node-input-rule-container-row");
|
||||
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||
height += 16;
|
||||
$("#node-input-rule-container").editableList('height',height);
|
||||
}
|
||||
});
|
||||
|
@@ -81,7 +81,7 @@
|
||||
rule.find('.red-ui-typedInput').typedInput("width",newWidth-130);
|
||||
|
||||
}
|
||||
$('#node-input-rule-container').css('min-height','300px').css('min-width','450px').editableList({
|
||||
$('#node-input-rule-container').css('min-height','150px').css('min-width','450px').editableList({
|
||||
addItem: function(container,i,opt) {
|
||||
var rule = opt;
|
||||
if (!rule.hasOwnProperty('t')) {
|
||||
@@ -259,7 +259,7 @@
|
||||
}
|
||||
var editorRow = $("#dialog-form>div.node-input-rule-container-row");
|
||||
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
|
||||
|
||||
height += 16;
|
||||
$("#node-input-rule-container").editableList('height',height);
|
||||
}
|
||||
});
|
||||
|
@@ -137,7 +137,7 @@
|
||||
<div class="form-row">
|
||||
<ul style="min-width: 600px; margin-bottom: 20px;" id="node-config-mqtt-broker-tabs"></ul>
|
||||
</div>
|
||||
<div id="node-config-mqtt-broker-tabs-content" style="min-height: 170px;">
|
||||
<div id="node-config-mqtt-broker-tabs-content" style="min-height:150px;">
|
||||
<div id="mqtt-broker-tab-connection" style="display:none">
|
||||
<div class="form-row node-input-broker">
|
||||
<label for="node-config-input-broker"><i class="fa fa-globe"></i> <span data-i18n="mqtt.label.broker"></span></label>
|
||||
|
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
$("#node-input-topics-container")
|
||||
.css('min-height','200px').css('min-width','430px')
|
||||
.css('min-height','150px').css('min-width','430px')
|
||||
.editableList({
|
||||
addItem: function(container, i, opt) {
|
||||
if (!opt.hasOwnProperty('topic')) {
|
||||
|
@@ -38,13 +38,13 @@
|
||||
<h3>入力</h3>
|
||||
<dl class="message-properties">
|
||||
<dt>payload <span class="property-type">文字列 | バッファ</span></dt>
|
||||
<dd>多くの場合単純なテキスト形式のペイロードが使われますが、バイナリバッファを発行することも可能です。</dd>
|
||||
<dd>発行するペイロード。プロパティが設定されていない場合には、メッセージは送信されません。空のメッセージを送信するには、プロパティに空文字列を設定します。</dd>
|
||||
|
||||
<dt class="optional">topic <span class="property-type">文字列</span></dt>
|
||||
<dd>発行対象のMQTTトピック</dd>
|
||||
|
||||
<dt class="optional">qos <span class="property-type">数値</span></dt>
|
||||
<dd>0: 最大1度到着, 1: 一度以上到着, 2: 1度のみ到着。デフォルトは0です。</dd>
|
||||
<dd>0: 最大一度到着, 1: 一度以上到着, 2: 一度のみ到着。デフォルトは0です。</dd>
|
||||
|
||||
<dt class="optional">retain <span class="property-type">真偽値</span></dt>
|
||||
<dd>真の場合、メッセージをブローカに保持します。デフォルトは偽です。</dd>
|
||||
|
Reference in New Issue
Block a user