fix(plugin-workflow): fix variable type check (#2492)
* fix(plugin-workflow): fix variable type check * fix(plugin-workflow): fix node job button style
This commit is contained in:
parent
95e1cd390b
commit
a59ed4ee17
@ -20,8 +20,9 @@ import { BaseTypeSets, defaultFieldNames, nodesOptions, triggerOptions } from '.
|
|||||||
function matchToManyField(field, appends): boolean {
|
function matchToManyField(field, appends): boolean {
|
||||||
const fieldPrefix = `${field.name}.`;
|
const fieldPrefix = `${field.name}.`;
|
||||||
return (
|
return (
|
||||||
['hasMany', 'belongsToMany'].includes(field.type) &&
|
(['hasOne', 'belongsTo'].includes(field.type) &&
|
||||||
(appends ? appends.includes(field.name) || appends.some((item) => item.startsWith(fieldPrefix)) : true)
|
(appends ? appends.includes(field.name) || appends.some((item) => item.startsWith(fieldPrefix)) : true)) ||
|
||||||
|
['hasMany', 'belongsToMany'].includes(field.type)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,6 +265,8 @@ export function JobButton() {
|
|||||||
border: 2px solid #d9d9d9;
|
border: 2px solid #d9d9d9;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
`,
|
`,
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
@ -165,28 +165,25 @@ function getNextAppends(field, appends: string[]) {
|
|||||||
|
|
||||||
function filterTypedFields({ fields, types, appends, compile, getCollectionFields }) {
|
function filterTypedFields({ fields, types, appends, compile, getCollectionFields }) {
|
||||||
return fields.filter((field) => {
|
return fields.filter((field) => {
|
||||||
const match = types?.length ? types.some((type) => matchFieldType(field, type, appends)) : true;
|
if (types?.length) {
|
||||||
|
return types.some((type) => matchFieldType(field, type, appends));
|
||||||
|
}
|
||||||
if (isAssociationField(field)) {
|
if (isAssociationField(field)) {
|
||||||
const nextAppends = getNextAppends(field, appends);
|
const nextAppends = getNextAppends(field, appends);
|
||||||
const included = appends.includes(field.name);
|
const included = appends.includes(field.name);
|
||||||
if (match) {
|
return (
|
||||||
return included;
|
(nextAppends.length || included) &&
|
||||||
} else {
|
filterTypedFields({
|
||||||
return (
|
fields: getNormalizedFields(field.target, { compile, getCollectionFields }),
|
||||||
(nextAppends.length || included) &&
|
types,
|
||||||
filterTypedFields({
|
// depth: depth - 1,
|
||||||
fields: getNormalizedFields(field.target, { compile, getCollectionFields }),
|
appends: nextAppends,
|
||||||
types,
|
compile,
|
||||||
// depth: depth - 1,
|
getCollectionFields,
|
||||||
appends: nextAppends,
|
}).length
|
||||||
compile,
|
);
|
||||||
getCollectionFields,
|
|
||||||
}).length
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return match;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user