diff --git a/public/red/ui/view.js b/public/red/ui/view.js index c8c564107..b4159af24 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -499,6 +499,23 @@ RED.view = function() { } } + function jsonFilter(key,value) { + if (key == "") { + return value; + } + var t = typeof value; + if ($.isArray(value)) { + return "[array:"+value.length+"]"; + } else if (t === "object") { + return "[object]" + } else if (t === "string") { + if (value.length > 30) { + return value.substring(0,30)+" ..."; + } + } + return value; + } + function buildInfo(node) { var table = ''; @@ -506,13 +523,30 @@ RED.view = function() { table += ""; table += ''; for (var n in node._def.defaults) { - if ((n != "func")&&(n != "template")) { - var safe = (node[n]||"").toString().replace(/&/g,"&").replace(//g,">"); - table += ""; - } - if ((n == "func")||(n == "template")) { - table += ""; + var val = node[n]||""; + var type = typeof val; + if (type === "string") { + if (val.length > 30) { + val = val.substring(0,30)+" ..."; + } + } else if (type === "number") { + val = val.toString(); + } else if ($.isArray(val)) { + val = "[
"; + for (var i=0;i/g,">"); + val += " "+i+": "+vv+"
"; + } + if (node[n].length > 10) { + val += " ... "+node[n].length+" items
"; + } + val += "]"; + } else { + val = JSON.stringify(val,jsonFilter," "); + val = val.replace(/&/g,"&").replace(//g,">"); } + + table += "
"; } table += "
ID "+node.id+"
 Properties
 "+n+""+safe+"
 "+n+"(...)
 "+n+""+val+"

"; table += '
'+($("script[data-help-name|='"+node.type+"']").html()||"")+"
"; diff --git a/public/style.css b/public/style.css index 5b8c4e814..70d2bbd74 100644 --- a/public/style.css +++ b/public/style.css @@ -546,8 +546,11 @@ table.node-info td:first-child{ color: #000; vertical-align: top; width: 90px; + padding: 0 3px; + border-right: 1px solid #ddd; } table.node-info td:last-child{ + padding-left: 5px; color: #666; }