1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #1906 from node-red/Allow-button-to-be-invisible

If debug set not to go to sidebar hide the button
This commit is contained in:
Nick O'Leary 2018-10-02 14:58:41 +01:00 committed by GitHub
commit a4ddfd404f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 27 deletions

View File

@ -1961,11 +1961,8 @@ RED.view = (function() {
.on("mouseover",function(d){portMouseOver(d3.select(this),d,PORT_TYPE_OUTPUT,0);})
.on("mouseout",function(d) {portMouseOut(d3.select(this),d,PORT_TYPE_OUTPUT,0);});
inGroup.append("svg:text").attr("class","port_label").attr("x",18).attr("y",20).style("font-size","10px").text("input");
subflowOutputs.each(function(d,i) {
if (d.dirty) {
var output = d3.select(this);
@ -2306,7 +2303,6 @@ RED.view = (function() {
}
}
thisNode.selectAll(".node_tools").attr("x",function(d){return d.w-35;}).attr("y",function(d){return d.h-20;});
thisNode.selectAll(".node_changed")
@ -2346,6 +2342,15 @@ RED.view = (function() {
return 1;
});
if (d._def.button && (typeof d._def.button.visible === "function")) { // is defined and a function...
if (d._def.button.visible.call(d) === false) {
thisNode.selectAll(".node_button").style("display","none");
}
else {
thisNode.selectAll(".node_button").style("display","inherit");
}
}
//thisNode.selectAll(".node_right_button").attr("transform",function(d){return "translate("+(d.w - d._def.button.width.call(d))+","+0+")";}).attr("fill",function(d) {
// return typeof d._def.button.color === "function" ? d._def.button.color.call(d):(d._def.button.color != null ? d._def.button.color : d._def.color)
//});

View File

@ -73,6 +73,7 @@
align: "right",
button: {
toggle: "active",
visible: function() { return this.tosidebar; },
onclick: function() {
var label = this.name||"debug";
var node = this;
@ -84,7 +85,7 @@
t:'edit',
node:node,
changes:{
active: !node.active
active:!node.active
},
dirty:node.dirty,
changed:node.changed

View File

@ -19,10 +19,7 @@ module.exports = function(RED) {
if (this.tosidebar === undefined) { this.tosidebar = true; }
this.severity = n.severity || 40;
this.active = (n.active === null || typeof n.active === "undefined") || n.active;
if (this.tostatus) {
this.oldStatus = {fill:"grey", shape:"ring"};
this.status(this.oldStatus);
}
if (this.tostatus) { this.status({fill:"grey", shape:"ring"}); }
else { this.status({}); }
var node = this;
@ -78,16 +75,16 @@ module.exports = function(RED) {
node.log(util.inspect(output, {colors:useColors}));
}
}
if (this.tostatus === true) {
var st = util.inspect(output);
var severity = node.severity;
if (st.length > 32) { st = st.substr(0,32) + "..."; }
node.status({fill:colors[severity], shape:"dot", text:st});
}
if (this.active) {
if (this.tosidebar == true) {
sendDebug({id:node.id, z:node.z, name:node.name, topic:msg.topic, property:property, msg:output, _path:msg._path});
}
if (this.tostatus === true) {
var st = util.inspect(output);
if (st.length > 32) { st = st.substr(0,32) + "..."; }
node.oldStatus = {fill:colors[node.severity], shape:"dot", text:st};
node.status(node.oldStatus);
}
}
}
});