feat(core): Node hints improvements (no-changelog) (#9387)

Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
Michael Kret
2024-05-22 13:35:29 +03:00
committed by GitHub
parent 3761537880
commit 870412f093
5 changed files with 113 additions and 28 deletions

View File

@@ -43,6 +43,7 @@ import type {
GenericValue,
DisplayCondition,
NodeHint,
INodeExecutionData,
} from './Interfaces';
import {
isFilterValue,
@@ -1125,6 +1126,11 @@ export function getNodeHints(
workflow: Workflow,
node: INode,
nodeTypeData: INodeTypeDescription,
nodeInputData?: {
runExecutionData: IRunExecutionData | null;
runIndex: number;
connectionInputData: INodeExecutionData[];
},
): NodeHint[] {
const hints: NodeHint[] = [];
@@ -1132,12 +1138,32 @@ export function getNodeHints(
for (const hint of nodeTypeData.hints) {
if (hint.displayCondition) {
try {
const display = (workflow.expression.getSimpleParameterValue(
node,
hint.displayCondition,
'internal',
{},
) || false) as boolean;
let display;
if (nodeInputData === undefined) {
display = (workflow.expression.getSimpleParameterValue(
node,
hint.displayCondition,
'internal',
{},
) || false) as boolean;
} else {
const { runExecutionData, runIndex, connectionInputData } = nodeInputData;
display = workflow.expression.getParameterValue(
hint.displayCondition,
runExecutionData ?? null,
runIndex,
0,
node.name,
connectionInputData,
'manual',
{},
);
}
if (typeof display === 'string' && display.trim() === 'true') {
display = true;
}
if (typeof display !== 'boolean') {
console.warn(