mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add validation to subflow instance env properties
This commit is contained in:
parent
014691346a
commit
19213434f9
@ -1025,7 +1025,22 @@ RED.nodes = (function() {
|
|||||||
RED.nodes.registerType("subflow:"+sf.id, {
|
RED.nodes.registerType("subflow:"+sf.id, {
|
||||||
defaults:{
|
defaults:{
|
||||||
name:{value:""},
|
name:{value:""},
|
||||||
env:{value:[]}
|
env:{value:[], validate: function(value) {
|
||||||
|
const errors = []
|
||||||
|
if (value) {
|
||||||
|
value.forEach(env => {
|
||||||
|
const r = RED.utils.validateTypedProperty(env.value, env.type)
|
||||||
|
if (r !== true) {
|
||||||
|
errors.push(env.name+': '+r)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (errors.length === 0) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return errors
|
||||||
|
}
|
||||||
|
}}
|
||||||
},
|
},
|
||||||
icon: function() { return sf.icon||"subflow.svg" },
|
icon: function() { return sf.icon||"subflow.svg" },
|
||||||
category: sf.category || "subflows",
|
category: sf.category || "subflows",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user