Skip to content

Commit bfb4aa3

Browse files
committed
fix: validate visibility rules against global workflow variables
1 parent 2c7c8c9 commit bfb4aa3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎ui/src/workflow/nodes/base-node/index.vue‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,21 @@ const validate = () => {
338338
}
339339
340340
const fieldList = props.nodeModel.properties?.user_input_field_list || []
341+
const globalFields =
342+
props.nodeModel.get_up_node_field_list(true, true).find((node: any) => node.value === 'global')
343+
?.children || []
341344
for (const field of fieldList) {
342345
for (const cond of field.visibility_rules?.conditions || []) {
343346
if (!cond.field || cond.field.length < 2 || !cond.field[0] || !cond.field[1]) continue
344347
const isCurrentNode =
345348
cond.field[0] === props.nodeModel.id ||
346349
(props.nodeModel.id === 'base-node' && cond.field[0] === 'global')
347350
if (isCurrentNode) {
348-
if (!fieldList.some((f: any) => f.field === cond.field[1])) {
351+
const exists =
352+
cond.field[0] === 'global'
353+
? globalFields.some((f: any) => f.value === cond.field[1])
354+
: fieldList.some((f: any) => f.field === cond.field[1])
355+
if (!exists) {
349356
return Promise.reject({
350357
node: props.nodeModel,
351358
errMessage: t('workflow.variable.NoReferencing'),

0 commit comments

Comments
 (0)