If debug set not to go to sidebar hide the button

Add button.visible function to view.js
Make status independant of tosidebar setting
This commit is contained in:
Dave Conway-Jones
2018-10-01 12:59:06 +01:00
parent d887ab126b
commit 114420e8fd
3 changed files with 30 additions and 27 deletions

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);
}
}
}
});