mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow node to provide dynamic content to Info tab
Closes #492 The node definition can now include an `info` property. This property can be either a string or a Function. Whenever the info tab is refreshed, such as the node is selected, the value of this property, or the result of the Function, will be appended to the Info tab.
This commit is contained in:
parent
f6f4b0784b
commit
462c259f3a
@ -94,6 +94,12 @@ RED.sidebar.info = (function() {
|
|||||||
table += "</tbody></table><br/>";
|
table += "</tbody></table><br/>";
|
||||||
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.info) {
|
||||||
|
var info = node._def.info;
|
||||||
|
table += '<div class="node-help">'+(typeof info === "function" ? info.call(node) : info)+'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
$("#tab-info").html(table);
|
$("#tab-info").html(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user