Remove type for typedInput in exec node

This commit is contained in:
Kazuhito Yokoi 2021-03-22 20:24:12 +09:00
parent f103533852
commit cb72d5100e
3 changed files with 2 additions and 6 deletions

View File

@ -24,7 +24,6 @@
<input type="checkbox" id="node-input-addpay" style="display:inline-block; width:auto;">
&nbsp;
<input type="text" id="node-input-addpayValue" style="width:160px;">
<input type="hidden" id="node-input-addpayValueType">
</div>
<div class="form-row">
<label for="node-input-append"> </label>
@ -56,7 +55,6 @@
command: {value:""},
addpay: {value:false},
addpayValue: {value:"payload"},
addpayValueType: {value:"msg"},
append: {value:""},
useSpawn: {value:"false"},
timer: {value:""},
@ -88,7 +86,6 @@
}
$("#node-input-addpayValue").typedInput({
default: "msg",
typeField: $("#node-input-addpayValueType"),
types: ["msg"]
});
}

View File

@ -27,7 +27,6 @@ module.exports = function(RED) {
if (n.addpay === undefined) { n.addpay = true; }
this.addpay = n.addpay;
this.addpayValue = n.addpayValue || "payload";
this.addpayValueType = n.addpayValueType || "msg";
this.append = (n.append || "").trim();
this.useSpawn = (n.useSpawn == "true");
this.timer = Number(n.timer || 0)*1000;
@ -67,7 +66,7 @@ module.exports = function(RED) {
// then prepend with the msg.payload
var arg = node.cmd;
if (node.addpay) {
if (node.addpayValueType === "msg" && msg.hasOwnProperty(node.addpayValue)) {
if (msg.hasOwnProperty(node.addpayValue)) {
arg += " " + RED.util.getMessageProperty(msg, node.addpayValue);
}
}

View File

@ -115,7 +115,7 @@ describe('exec node', function() {
});
it('should exec a simple command with appended value from message', function (done) {
var flow = [{id:"n1", type:"exec", wires:[["n2"]], command:"echo", addpay:true, addpayValue:"topic", addpayValueType:"msg", append:"more", oldrc:"false"},
var flow = [{id:"n1", type:"exec", wires:[["n2"]], command:"echo", addpay:true, addpayValue:"topic", append:"more", oldrc:"false"},
{id:"n2", type:"helper"}];
helper.load(execNode, flow, function () {
var n1 = helper.getNode("n1");