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

tidy up tab-info so subflows show more useful information

(was broken before but no-one noticed ;-)
(and reorder fields in HTTP and XML nodes so name comes out first - ocd)
This commit is contained in:
dceejay 2015-02-10 16:55:50 +00:00
parent c6157687c9
commit e2911078e3
3 changed files with 22 additions and 17 deletions

View File

@ -56,10 +56,10 @@
category: 'function',
color:"#DEBD5C",
defaults: {
name: {value:""},
tag: {value:""},
ret: {value:"html"},
as: {value:"single"},
name: {value:""}
as: {value:"single"}
},
inputs:1,
outputs:1,

View File

@ -61,9 +61,9 @@
category: 'function',
color:"#DEBD5C",
defaults: {
name: {value:""},
attr: {value:'$',required:true},
chr: {value:'_',required:true},
name: {value:""}
chr: {value:'_',required:true}
},
inputs:1,
outputs:1,

View File

@ -58,25 +58,29 @@ RED.sidebar.info = (function() {
function refresh(node) {
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>&nbsp;"+node.type+"</td></tr>";
if (node.type.indexOf("subflow") === 0) {
table += "<tr><td>Type</td><td>&nbsp;"+(RED.nodes.subflow(node.type.split(":")[1]).name||node.type)+"</td></tr>";
table += "<tr><td>ID</td><td>&nbsp;"+node.id+"</td></tr>";
table += '<tr class="blank"><td colspan="2">Properties</td></tr>';
if (node.type == "subflow") {
var userCount = 0;
var subflowType = "subflow:"+node.id;
RED.nodes.eachNode(function(n) {
if (n.type === subflowType) {
console.log(n);
if (n.type === node.type) {
userCount++;
}
});
node.name = node.name || "";
table += "<tr><td>name</td><td>"+node.name+"</td></tr>";
table += "<tr><td>inputs</td><td>"+node.in.length+"</td></tr>";
table += "<tr><td>outputs</td><td>"+node.out.length+"</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>";
}
if (node._def) {
else if (node._def) {
if (node.type !== "comment") {
table += "<tr><td>Type</td><td>&nbsp;"+node.type+"</td></tr>";
table += "<tr><td>ID</td><td>&nbsp;"+node.id+"</td></tr>";
table += '<tr class="blank"><td colspan="2">Properties</td></tr>';
for (var n in node._def.defaults) {
if (node._def.defaults.hasOwnProperty(n)) {
var val = node[n]||"";
@ -107,6 +111,7 @@ RED.sidebar.info = (function() {
}
}
}
}
table += "</tbody></table><br/>";
var helpText = $("script[data-help-name|='"+node.type+"']").html()||"";
table += '<div class="node-help">'+helpText+"</div>";