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

Handle debug boolean complete properties

This commit is contained in:
Nick O'Leary 2014-10-23 15:28:47 +01:00
parent 5fd1ff5137
commit 4cd78692e2
2 changed files with 15 additions and 13 deletions

View File

@ -52,13 +52,13 @@
<script type="text/javascript"> <script type="text/javascript">
function oneditprepare() { function oneditprepare() {
if (this.complete === "true") { if (this.complete === "true" || this.complete === true) {
// show complete message object // show complete message object
$("#node-input-select-complete").val(this.complete); $("#node-input-select-complete").val("true");
$("#node-prop-row").hide(); $("#node-prop-row").hide();
} else { } else {
// show msg.[ ] // show msg.[ ]
var property = (this.complete === "false") ? "payload" : this.complete; var property = (!this.complete||(this.complete === "false")) ? "payload" : this.complete+"";
$("#node-input-select-complete").val("false"); $("#node-input-select-complete").val("false");
$("#node-input-complete").val(property); $("#node-input-complete").val(property);
$("#node-prop-row").show(); $("#node-prop-row").show();
@ -85,10 +85,10 @@
complete: {value:"false", required:true} complete: {value:"false", required:true}
}, },
label: function() { label: function() {
if (this.complete === "true") { if (this.complete === true || this.complete === "true") {
return this.name||"msg"; return this.name||"msg";
} else { } else {
return this.name || "msg." + (this.complete === "false" ? "payload" : this.complete); return this.name || "msg." + ((!this.complete || this.complete === "false") ? "payload" : this.complete);
} }
}, },
labelStyle: function() { labelStyle: function() {

View File

@ -24,7 +24,15 @@ module.exports = function(RED) {
function DebugNode(n) { function DebugNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
this.name = n.name; this.name = n.name;
this.complete = n.complete; this.complete = n.complete||"payload";
if (this.complete === "false") {
this.complete = "payload";
}
if (this.complete === true) {
this.complete = "true";
}
this.console = n.console; this.console = n.console;
this.active = (n.active === null || typeof n.active === "undefined") || n.active; this.active = (n.active === null || typeof n.active === "undefined") || n.active;
var node = this; var node = this;
@ -50,13 +58,7 @@ module.exports = function(RED) {
return obj[i]; return obj[i];
}, msg); }, msg);
} catch (err) { } catch (err) {
node.warn(err); output = undefined;
return;
}
if (!output) {
node.warn("msg." + this.complete + " does not exist");
return;
} }
} }
if (this.console === "true") { if (this.console === "true") {