fix(editor): Fix schema view bugs (#14734)

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
Elias Meire
2025-04-24 08:53:02 +02:00
committed by GitHub
parent 1b1d6043d6
commit 022f4755c2
14 changed files with 1040 additions and 781 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, computed, watch } from 'vue';
import { createEventBus } from '@n8n/utils/event-bus';
import type { IRunData, Workflow, NodeConnectionType } from 'n8n-workflow';
import type { IRunData, Workflow, NodeConnectionType, IConnectedNode } from 'n8n-workflow';
import { jsonParse, NodeHelpers, NodeConnectionTypes } from 'n8n-workflow';
import type { IUpdateInformation, TargetItem } from '@/Interface';
@@ -130,24 +130,19 @@ const workflowRunData = computed(() => {
const parentNodes = computed(() => {
if (activeNode.value) {
return (
props.workflowObject
.getParentNodesByDepth(activeNode.value.name, 1)
.map(({ name }) => name) || []
);
} else {
return [];
return props.workflowObject.getParentNodesByDepth(activeNode.value.name, 1);
}
return [];
});
const parentNode = computed(() => {
for (const parentNodeName of parentNodes.value) {
if (workflowsStore?.pinnedWorkflowData?.[parentNodeName]) {
return parentNodeName;
const parentNode = computed<IConnectedNode | undefined>(() => {
for (const parent of parentNodes.value) {
if (workflowsStore?.pinnedWorkflowData?.[parent.name]) {
return parent;
}
if (workflowRunData.value?.[parentNodeName]) {
return parentNodeName;
if (workflowRunData.value?.[parent.name]) {
return parent;
}
}
return parentNodes.value[0];
@@ -177,7 +172,7 @@ const inputNodeName = computed<string | undefined>(() => {
)?.[0];
return connectedOutputNode;
}
return selectedInput.value || parentNode.value;
return selectedInput.value ?? parentNode.value?.name;
});
const inputNode = computed(() => {
@@ -290,12 +285,23 @@ const maxInputRun = computed(() => {
return 0;
});
const connectedCurrentNodeOutputs = computed(() => {
return parentNodes.value.find(({ name }) => name === inputNodeName.value)?.indicies;
});
const inputRun = computed(() => {
if (isLinkingEnabled.value && maxOutputRun.value === maxInputRun.value) {
return outputRun.value;
}
if (runInputIndex.value === -1) {
return maxInputRun.value;
const currentInputNodeName = inputNodeName.value;
if (runInputIndex.value === -1 && currentInputNodeName) {
return (
connectedCurrentNodeOutputs.value
?.map((outputIndex) =>
nodeHelpers.getLastRunIndexWithData(currentInputNodeName, outputIndex),
)
.find((runIndex) => runIndex !== -1) ?? maxInputRun.value
);
}
return Math.min(runInputIndex.value, maxInputRun.value);