mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add node module into to sidebar and palette popover
This commit is contained in:
parent
d40aa7260f
commit
dc3128fb3e
@ -440,6 +440,7 @@
|
|||||||
"label": "info",
|
"label": "info",
|
||||||
"node": "Node",
|
"node": "Node",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
|
"module": "Module",
|
||||||
"id": "ID",
|
"id": "ID",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"enabled": "Enabled",
|
"enabled": "Enabled",
|
||||||
|
@ -110,13 +110,26 @@ RED.palette = (function() {
|
|||||||
var popOverContent;
|
var popOverContent;
|
||||||
try {
|
try {
|
||||||
var l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b></p>";
|
var l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b></p>";
|
||||||
if (label != type) {
|
popOverContent = $('<div></div>').append($(l+(info?info:$("script[data-help-name='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
|
||||||
l = "<p><b>"+RED.text.bidi.enforceTextDirectionWithUCC(label)+"</b><br/><i>"+type+"</i></p>";
|
|
||||||
}
|
|
||||||
popOverContent = $(l+(info?info:$("script[data-help-name='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
|
|
||||||
.filter(function(n) {
|
.filter(function(n) {
|
||||||
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
|
return (this.nodeType == 1 && this.nodeName == "P") || (this.nodeType == 3 && this.textContent.trim().length > 0)
|
||||||
}).slice(0,2);
|
}).slice(0,2));
|
||||||
|
popOverContent.find("a").each(function(){
|
||||||
|
var linkText = $(this).text();
|
||||||
|
$(this).before(linkText);
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
var typeInfo = RED.nodes.getType(type);
|
||||||
|
|
||||||
|
if (typeInfo) {
|
||||||
|
var metaData = "";
|
||||||
|
if (typeInfo && !/^subflow:/.test(type)) {
|
||||||
|
metaData = typeInfo.set.module+" : ";
|
||||||
|
}
|
||||||
|
metaData += type;
|
||||||
|
$('<p>',{style:"font-size: 0.8em"}).text(metaData).appendTo(popOverContent);
|
||||||
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
// Malformed HTML may cause errors. TODO: need to understand what can break
|
// Malformed HTML may cause errors. TODO: need to understand what can break
|
||||||
// NON-NLS: internal debug
|
// NON-NLS: internal debug
|
||||||
|
@ -207,6 +207,7 @@ RED.sidebar.info = (function() {
|
|||||||
$('<span style="float: right; font-size: 0.8em"><i class="fa fa-warning"></i></span>').prependTo($(propRow.children()[1]))
|
$('<span style="float: right; font-size: 0.8em"><i class="fa fa-warning"></i></span>').prependTo($(propRow.children()[1]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var count = 0;
|
||||||
if (!m && node.type != "subflow") {
|
if (!m && node.type != "subflow") {
|
||||||
var defaults;
|
var defaults;
|
||||||
if (node.type === 'unknown') {
|
if (node.type === 'unknown') {
|
||||||
@ -218,9 +219,13 @@ RED.sidebar.info = (function() {
|
|||||||
})
|
})
|
||||||
} else if (node._def) {
|
} else if (node._def) {
|
||||||
defaults = node._def.defaults;
|
defaults = node._def.defaults;
|
||||||
|
propRow = $('<tr class="node-info-property-row'+(expandedSections.property?"":" hide")+'"><td>'+RED._("sidebar.info.module")+"</td><td></td></tr>").appendTo(tableBody);
|
||||||
|
$(propRow.children()[1]).text(RED.nodes.getType(node.type).set.module);
|
||||||
|
count++;
|
||||||
}
|
}
|
||||||
|
$('<tr class="node-info-property-expand node-info-property-row blank'+(expandedSections.property?"":" hide")+'"><td colspan="2"></td></tr>').appendTo(tableBody);
|
||||||
|
|
||||||
if (defaults) {
|
if (defaults) {
|
||||||
var count = 0;
|
|
||||||
for (var n in defaults) {
|
for (var n in defaults) {
|
||||||
if (n != "name" && n != "info" && defaults.hasOwnProperty(n)) {
|
if (n != "name" && n != "info" && defaults.hasOwnProperty(n)) {
|
||||||
var val = node[n];
|
var val = node[n];
|
||||||
@ -254,9 +259,9 @@ RED.sidebar.info = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count > 0) {
|
}
|
||||||
$('<tr class="node-info-property-expand blank"><td colspan="2"><a href="#" class=" node-info-property-header'+(expandedSections.property?" expanded":"")+'"><span class="node-info-property-show-more">'+RED._("sidebar.info.showMore")+'</span><span class="node-info-property-show-less">'+RED._("sidebar.info.showLess")+'</span> <i class="fa fa-caret-down"></i></a></td></tr>').appendTo(tableBody);
|
if (count > 0) {
|
||||||
}
|
$('<tr class="node-info-property-expand blank"><td colspan="2"><a href="#" class=" node-info-property-header'+(expandedSections.property?" expanded":"")+'"><span class="node-info-property-show-more">'+RED._("sidebar.info.showMore")+'</span><span class="node-info-property-show-less">'+RED._("sidebar.info.showLess")+'</span> <i class="fa fa-caret-down"></i></a></td></tr>').appendTo(tableBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.type !== 'tab') {
|
if (node.type !== 'tab') {
|
||||||
|
Loading…
Reference in New Issue
Block a user