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

@@ -1021,6 +1021,24 @@ export default defineComponent({
showIoSearchNoMatchContent(): boolean {
return this.hasNodeRun && !this.inputData.length && !!this.search;
},
parentNodeOutputData(): INodeExecutionData[] {
const workflow = this.workflowsStore.getCurrentWorkflow();
const parentNode = workflow.getParentNodesByDepth(this.node.name)[0];
let parentNodeData: INodeExecutionData[] = [];
if (parentNode?.name) {
parentNodeData = this.nodeHelpers.getNodeInputData(
workflow.getNode(parentNode?.name),
this.runIndex,
this.outputIndex,
'input',
this.connectionType,
);
}
return parentNodeData;
},
},
watch: {
node(newNode: INodeUi, prevNode: INodeUi) {
@@ -1118,19 +1136,18 @@ export default defineComponent({
},
shouldHintBeDisplayed(hint: NodeHint): boolean {
const { location, whenToDisplay } = hint;
if (location) {
if (location === 'ndv') {
return true;
if (location === 'ndv' && !['input', 'output'].includes(this.paneType)) {
return false;
}
if (location === 'inputPane' && this.paneType === 'input') {
return true;
if (location === 'inputPane' && this.paneType !== 'input') {
return false;
}
if (location === 'outputPane' && this.paneType === 'output') {
return true;
if (location === 'outputPane' && this.paneType !== 'output') {
return false;
}
return false;
}
if (whenToDisplay === 'afterExecution' && !this.hasNodeRun) {
@@ -1150,7 +1167,12 @@ export default defineComponent({
if (workflowNode) {
const executionHints = this.executionHints;
const nodeHints = NodeHelpers.getNodeHints(workflow, workflowNode, this.nodeType);
const nodeHints = NodeHelpers.getNodeHints(workflow, workflowNode, this.nodeType, {
runExecutionData: this.workflowExecution?.data ?? null,
runIndex: this.runIndex,
connectionInputData: this.parentNodeOutputData,
});
return executionHints.concat(nodeHints).filter(this.shouldHintBeDisplayed);
}
}