mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(editor): Fix schema view bugs (#14734)
Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user