From e2911078e300a4400e31cf343e260cb9785b04c2 Mon Sep 17 00:00:00 2001 From: dceejay Date: Tue, 10 Feb 2015 16:55:50 +0000 Subject: [PATCH] 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) --- nodes/core/parsers/70-HTML.html | 4 ++-- nodes/core/parsers/70-XML.html | 4 ++-- public/red/ui/tab-info.js | 31 ++++++++++++++++++------------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/nodes/core/parsers/70-HTML.html b/nodes/core/parsers/70-HTML.html index 83f1593a8..e423e8775 100644 --- a/nodes/core/parsers/70-HTML.html +++ b/nodes/core/parsers/70-HTML.html @@ -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, diff --git a/nodes/core/parsers/70-XML.html b/nodes/core/parsers/70-XML.html index dbb543872..df14505db 100644 --- a/nodes/core/parsers/70-XML.html +++ b/nodes/core/parsers/70-XML.html @@ -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, diff --git a/public/red/ui/tab-info.js b/public/red/ui/tab-info.js index 5de55bdbd..ad009d4e9 100644 --- a/public/red/ui/tab-info.js +++ b/public/red/ui/tab-info.js @@ -14,7 +14,7 @@ * limitations under the License. **/ RED.sidebar.info = (function() { - + marked.setOptions({ renderer: new marked.Renderer(), gfm: true, @@ -25,7 +25,7 @@ RED.sidebar.info = (function() { smartLists: true, smartypants: false }); - + var content = document.createElement("div"); content.id = "tab-info"; content.style.paddingTop = "4px"; @@ -38,7 +38,7 @@ RED.sidebar.info = (function() { } RED.sidebar.show("info"); } - + function jsonFilter(key,value) { if (key === "") { return value; @@ -58,25 +58,29 @@ RED.sidebar.info = (function() { function refresh(node) { var table = ''; + //table += ''; - table += ''; - table += ""; - table += ""; - table += ''; - if (node.type == "subflow") { + if (node.type.indexOf("subflow") === 0) { + table += ""; + table += ""; 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 += ""; - table += ""; - table += ""; + table += ""; + table += ""; table += ""; } - if (node._def) { + else if (node._def) { + if (node.type !== "comment") { + table += ""; + table += ""; + table += ''; for (var n in node._def.defaults) { if (node._def.defaults.hasOwnProperty(n)) { var val = node[n]||""; @@ -106,6 +110,7 @@ RED.sidebar.info = (function() { table += ""; } } + } } table += "
Node
Node
Type "+node.type+"
ID "+node.id+"
Properties
Type "+(RED.nodes.subflow(node.type.split(":")[1]).name||node.type)+"
ID "+node.id+"
name"+node.name+"
inputs"+node.in.length+"
outputs"+node.out.length+"
inputs"+node.inputs+"
outputs"+node.outputs+"
instances"+userCount+"
Type "+node.type+"
ID "+node.id+"
Properties
"+n+""+val+"

"; var helpText = $("script[data-help-name|='"+node.type+"']").html()||"";