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

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

View File

@ -27,7 +27,6 @@ module.exports = function(RED) {
if (n.addpay === undefined) { n.addpay = true; } if (n.addpay === undefined) { n.addpay = true; }
this.addpay = n.addpay; this.addpay = n.addpay;
this.addpayValue = n.addpayValue || "payload"; this.addpayValue = n.addpayValue || "payload";
this.addpayValueType = n.addpayValueType || "msg";
this.append = (n.append || "").trim(); this.append = (n.append || "").trim();
this.useSpawn = (n.useSpawn == "true"); this.useSpawn = (n.useSpawn == "true");
this.timer = Number(n.timer || 0)*1000; this.timer = Number(n.timer || 0)*1000;
@ -67,7 +66,7 @@ module.exports = function(RED) {
// then prepend with the msg.payload // then prepend with the msg.payload
var arg = node.cmd; var arg = node.cmd;
if (node.addpay) { if (node.addpay) {
if (node.addpayValueType === "msg" && msg.hasOwnProperty(node.addpayValue)) { if (msg.hasOwnProperty(node.addpayValue)) {
arg += " " + RED.util.getMessageProperty(msg, 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) { 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"}]; {id:"n2", type:"helper"}];
helper.load(execNode, flow, function () { helper.load(execNode, flow, function () {
var n1 = helper.getNode("n1"); var n1 = helper.getNode("n1");