mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
74b547b93c
commit
ca5e45a46d
@ -163,12 +163,27 @@
|
|||||||
$("#node-input-property-container").editableList('height',height);
|
$("#node-input-property-container").editableList('height',height);
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.nodes.registerType('inject',{
|
RED.nodes.registerType('inject',{
|
||||||
category: 'common',
|
category: 'common',
|
||||||
color:"#a6bbcf",
|
color:"#a6bbcf",
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
props:{value:[{p:"payload"},{p:"topic",vt:"str"}]},
|
props:{value:[{p:"payload"},{p:"topic",vt:"str"}], validate:function(v) {
|
||||||
|
if (!v || v.length === 0) { return true }
|
||||||
|
for (var i=0;i<v.length;i++) {
|
||||||
|
if (/msg|flow|global/.test(v[i].vt)) {
|
||||||
|
if (!RED.utils.validatePropertyExpression(v[i].v)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (v[i].vt === "jsonata") {
|
||||||
|
try{jsonata(v[i].v);}catch(e){return false;}
|
||||||
|
} else if ([i].vt === "json") {
|
||||||
|
try{JSON.parse(v[i].v);}catch(e){return false;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
repeat: {value:"", validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 2147483))) }},
|
repeat: {value:"", validate:function(v) { return ((v === "") || (RED.validators.number(v) && (v >= 0) && (v <= 2147483))) }},
|
||||||
crontab: {value:""},
|
crontab: {value:""},
|
||||||
once: {value:false},
|
once: {value:false},
|
||||||
|
Loading…
Reference in New Issue
Block a user