mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tidy up info tab handling of subflows and comments
This commit is contained in:
parent
0accfade02
commit
e357352240
@ -30,7 +30,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="comment">
|
<script type="text/x-red" data-help-name="comment">
|
||||||
<p>Comment</p>
|
<p>A node you can use to add comments to your flows.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -58,34 +58,35 @@ RED.sidebar.info = (function() {
|
|||||||
|
|
||||||
function refresh(node) {
|
function refresh(node) {
|
||||||
var table = '<table class="node-info"><tbody>';
|
var table = '<table class="node-info"><tbody>';
|
||||||
//table += '<tr class="blank"><td colspan="2">Node</td></tr>';
|
table += '<tr class="blank"><td colspan="2">Node</td></tr>';
|
||||||
|
table += "<tr><td>Type</td><td> "+node.type+"</td></tr>";
|
||||||
|
table += "<tr><td>ID</td><td> "+node.id+"</td></tr>";
|
||||||
|
|
||||||
|
var m = /^subflow(:(.+))?$/.exec(node.type);
|
||||||
|
if (m) {
|
||||||
|
var subflowNode;
|
||||||
|
if (m[2]) {
|
||||||
|
subflowNode = RED.nodes.subflow(m[2]);
|
||||||
|
} else {
|
||||||
|
subflowNode = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
table += '<tr class="blank"><td colspan="2">Subflow</td></tr>';
|
||||||
|
|
||||||
if (node.type.indexOf("subflow") === 0) {
|
|
||||||
var userCount = 0;
|
var userCount = 0;
|
||||||
|
var subflowType = "subflow:"+subflowNode.id;
|
||||||
RED.nodes.eachNode(function(n) {
|
RED.nodes.eachNode(function(n) {
|
||||||
if (n.type === node.type) {
|
if (n.type === subflowType) {
|
||||||
userCount++;
|
userCount++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
node.name = node.name || "";
|
table += "<tr><td>name</td><td>"+subflowNode.name+"</td></tr>";
|
||||||
if (node.type !== "subflow") {
|
|
||||||
table += "<tr><td>Type</td><td> "+(RED.nodes.subflow(node.type.split(":")[1]).name||node.type)+"</td></tr>";
|
|
||||||
table += "<tr><td>ID</td><td> "+node.id+"</td></tr>";
|
|
||||||
table += "<tr><td>name</td><td>"+node.name+"</td></tr>";
|
|
||||||
table += "<tr><td>inputs</td><td>"+node.inputs+"</td></tr>";
|
|
||||||
table += "<tr><td>outputs</td><td>"+node.outputs+"</td></tr>";
|
|
||||||
table += "<tr><td>instances</td><td>"+userCount+"</td></tr>";
|
table += "<tr><td>instances</td><td>"+userCount+"</td></tr>";
|
||||||
} else {
|
|
||||||
table += "<tr><td>Type</td><td> "+node.type+"</td></tr>";
|
|
||||||
table += "<tr><td>ID</td><td> "+node.id+"</td></tr>";
|
|
||||||
table += "<tr><td>name</td><td>"+node.name+"</td></tr>";
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (node._def) {
|
if (node.type != "subflow" && node.type != "comment") {
|
||||||
if (node.type !== "comment") {
|
|
||||||
table += "<tr><td>Type</td><td> "+node.type+"</td></tr>";
|
|
||||||
table += "<tr><td>ID</td><td> "+node.id+"</td></tr>";
|
|
||||||
table += '<tr class="blank"><td colspan="2">Properties</td></tr>';
|
table += '<tr class="blank"><td colspan="2">Properties</td></tr>';
|
||||||
|
if (node._def) {
|
||||||
for (var n in node._def.defaults) {
|
for (var n in node._def.defaults) {
|
||||||
if (node._def.defaults.hasOwnProperty(n)) {
|
if (node._def.defaults.hasOwnProperty(n)) {
|
||||||
var val = node[n]||"";
|
var val = node[n]||"";
|
||||||
@ -118,8 +119,10 @@ RED.sidebar.info = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
table += "</tbody></table><br/>";
|
table += "</tbody></table><br/>";
|
||||||
|
if (node.type != "comment") {
|
||||||
var helpText = $("script[data-help-name|='"+node.type+"']").html()||"";
|
var helpText = $("script[data-help-name|='"+node.type+"']").html()||"";
|
||||||
table += '<div class="node-help">'+helpText+"</div>";
|
table += '<div class="node-help">'+helpText+"</div>";
|
||||||
|
}
|
||||||
|
|
||||||
if (node._def && node._def.info) {
|
if (node._def && node._def.info) {
|
||||||
var info = node._def.info;
|
var info = node._def.info;
|
||||||
|
Loading…
Reference in New Issue
Block a user