diff --git a/public/red/ui/tab-info.js b/public/red/ui/tab-info.js index 848b07c5f..e11fb655b 100644 --- a/public/red/ui/tab-info.js +++ b/public/red/ui/tab-info.js @@ -32,6 +32,8 @@ RED.sidebar.info = (function() { content.style.paddingLeft = "4px"; content.style.paddingRight = "4px"; + var propertiesExpanded = false; + function show() { if (!RED.sidebar.containsTab("info")) { RED.sidebar.addTab("info",content,false); @@ -59,6 +61,9 @@ RED.sidebar.info = (function() { function refresh(node) { var table = ''; table += ''; + if (node.type != "subflow" && node.name) { + table += ""; + } table += ""; table += ""; @@ -84,18 +89,22 @@ RED.sidebar.info = (function() { table += ""; } - if (node.type != "subflow" && node.type != "comment") { - table += ''; + if (!m && node.type != "subflow" && node.type != "comment") { + table += ''; if (node._def) { for (var n in node._def.defaults) { - if (node._def.defaults.hasOwnProperty(n)) { + if (n != "name" && node._def.defaults.hasOwnProperty(n)) { var val = node[n]||""; var type = typeof val; if (type === "string") { - if (val.length > 30) { - val = val.substring(0,30)+" ..."; + if (val.length == 0) { + val += 'blank'; + } else { + if (val.length > 30) { + val = val.substring(0,30)+" ..."; + } + val = val.replace(/&/g,"&").replace(//g,">"); } - val = val.replace(/&/g,"&").replace(//g,">"); } else if (type === "number") { val = val.toString(); } else if ($.isArray(val)) { @@ -113,12 +122,12 @@ RED.sidebar.info = (function() { val = val.replace(/&/g,"&").replace(//g,">"); } - table += ""; + table += '"; } } } } - table += "
Node
Name "+node.name+"
Type "+node.type+"
ID "+node.id+"
instances"+userCount+"
Properties
Properties
"+n+""+val+"
'+n+""+val+"

"; + table += "
"; if (node.type != "comment") { var helpText = $("script[data-help-name|='"+node.type+"']").html()||""; table += '
'+helpText+"
"; @@ -131,6 +140,23 @@ RED.sidebar.info = (function() { } $("#tab-info").html(table); + + $(".node-info-property-header").click(function(e) { + var icon = $(this).find("i"); + if (icon.hasClass("fa-caret-right")) { + icon.removeClass("fa-caret-right"); + icon.addClass("fa-caret-down"); + $(".node-info-property-row").show(); + propertiesExpanded = true; + } else { + icon.addClass("fa-caret-right"); + icon.removeClass("fa-caret-down"); + $(".node-info-property-row").hide(); + propertiesExpanded = false; + } + + e.preventDefault(); + }); } function clear() { diff --git a/public/style.css b/public/style.css index a36a08b05..5a8fb7673 100644 --- a/public/style.css +++ b/public/style.css @@ -827,6 +827,7 @@ button.input-append-right { } table.node-info { + font-size: 14px; margin: 5px; width: 97%; } @@ -857,6 +858,16 @@ table.node-info td:last-child{ div.node-info { margin: 5px; } +.node-info-property-header { + color: #666; +} + +.node-info-property-header:hover, +.node-info-property-header:focus { + color: #666; + text-decoration: none; +} + .input-error { border-color: rgb(214, 97, 95) !important;