mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Check required
prop for each case instead of top level
This commit is contained in:
parent
19a8fa09a8
commit
2464d9ad95
@ -148,26 +148,21 @@ RED.editor = (function() {
|
||||
((typeof definition[property].label) == "string")) {
|
||||
label = definition[property].label;
|
||||
}
|
||||
if ("required" in definition[property]) {
|
||||
if (definition[property].required) {
|
||||
valid = value !== "";
|
||||
if (!valid && label) {
|
||||
return RED._("validator.errors.missing-required-prop", {
|
||||
prop: label
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if ("required" in definition[property] && definition[property].required) {
|
||||
valid = value !== "";
|
||||
if (!valid && label) {
|
||||
return RED._("validator.errors.missing-required-prop", {
|
||||
prop: label
|
||||
});
|
||||
}
|
||||
}
|
||||
if (valid && "validate" in definition[property]) {
|
||||
if (definition[property].hasOwnProperty("required") &&
|
||||
definition[property].required === false) {
|
||||
if (value === "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (value === "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (valid && "validate" in definition[property]) {
|
||||
try {
|
||||
var opt = {};
|
||||
if (label) {
|
||||
@ -194,6 +189,11 @@ RED.editor = (function() {
|
||||
});
|
||||
}
|
||||
} else if (valid) {
|
||||
if (definition[property].hasOwnProperty("required") && definition[property].required === false) {
|
||||
if (value === "") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// If the validator is not provided in node property => Check if the input has a validator
|
||||
if ("category" in node._def) {
|
||||
const isConfig = node._def.category === "config";
|
||||
|
Loading…
x
Reference in New Issue
Block a user