diff --git a/packages/node_modules/@node-red/nodes/core/common/20-inject.html b/packages/node_modules/@node-red/nodes/core/common/20-inject.html index 8e40b8cd8..7bcb3111f 100644 --- a/packages/node_modules/@node-red/nodes/core/common/20-inject.html +++ b/packages/node_modules/@node-red/nodes/core/common/20-inject.html @@ -193,7 +193,7 @@ } /** Perform inject, optionally sending a custom msg (refactored for re-use in the form inject button)*/ function doInject(node, customMsg) { - var label = node._def.label.call(node); + var label = node._def.label.call(node,customMsg?customMsg.__user_inject_props__:undefined); if (label.length > 30) { label = label.substring(0, 50) + "..."; } @@ -201,7 +201,8 @@ $.ajax({ url: "inject/" + node.id, type: "POST", - data: customMsg, + data: JSON.stringify(customMsg||{}), + contentType: "application/json; charset=utf-8", success: function (resp) { RED.notify(node._("inject.success", { label: label }), { type: "success", id: "inject", timeout: 2000 }); }, @@ -291,7 +292,7 @@ } return lab; }, - label: function() { + label: function(customProps) { var suffix = ""; // if fire once then add small indication if (this.once) { @@ -304,11 +305,23 @@ if (this.name) { return this.name+suffix; } - - var payload = this.payload || ""; - var payloadType = this.payloadType || "str"; - var topic = this.topic || ""; - + var payload = ""; + var payloadType = "str"; + var topic = ""; + if (customProps) { + for (var i=0;i