diff --git a/packages/frontend/editor-ui/src/Interface.ts b/packages/frontend/editor-ui/src/Interface.ts index b4d759b419..6bf69ac35f 100644 --- a/packages/frontend/editor-ui/src/Interface.ts +++ b/packages/frontend/editor-ui/src/Interface.ts @@ -769,24 +769,6 @@ export interface IUsedCredential { sharedWithProjects?: ProjectSharingData[]; } -export interface WorkflowsState { - activeWorkflows: string[]; - activeWorkflowExecution: ExecutionSummary | null; - currentWorkflowExecutions: ExecutionSummary[]; - activeExecutionId: string | null; - executingNode: string[]; - executionWaitingForWebhook: boolean; - nodeMetadata: NodeMetadataMap; - subWorkflowExecutionError: Error | null; - usedCredentials: Record; - workflow: IWorkflowDb; - workflowExecutionData: IExecutionResponse | null; - workflowExecutionPairedItemMappings: { [itemId: string]: Set }; - workflowsById: IWorkflowsMap; - chatMessages: string[]; - isInDebugMode?: boolean; -} - export interface NodeMetadataMap { [nodeName: string]: INodeMetadata; } @@ -845,48 +827,6 @@ export interface TargetItem { outputIndex: number; } -export interface NDVState { - activeNodeName: string | null; - mainPanelDimensions: { [key: string]: { [key: string]: number } }; - pushRef: string; - input: { - displayMode: IRunDataDisplayMode; - nodeName?: string; - run?: number; - branch?: number; - data: { - isEmpty: boolean; - }; - }; - output: { - branch?: number; - displayMode: IRunDataDisplayMode; - data: { - isEmpty: boolean; - }; - editMode: { - enabled: boolean; - value: string; - }; - }; - focusedMappableInput: string; - focusedInputPath: string; - mappingTelemetry: { [key: string]: string | number | boolean }; - hoveringItem: null | TargetItem; - expressionOutputItemIndex: number; - draggable: { - isDragging: boolean; - type: string; - data: string; - dimensions: DOMRect | null; - activeTarget: { id: string; stickyPosition: null | XYPosition } | null; - }; - isMappingOnboarded: boolean; - isTableHoverOnboarded: boolean; - isAutocompleteOnboarded: boolean; - highlightDraggables: boolean; -} - export type TargetNodeParameterContext = { nodeName: string; parameterPath: string; diff --git a/packages/frontend/editor-ui/src/composables/useActiveNode.test.ts b/packages/frontend/editor-ui/src/composables/useActiveNode.test.ts deleted file mode 100644 index b43b6e782a..0000000000 --- a/packages/frontend/editor-ui/src/composables/useActiveNode.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { computed } from 'vue'; -import { describe, it, expect, vi } from 'vitest'; -import { mock } from 'vitest-mock-extended'; - -import { useActiveNode } from '@/composables/useActiveNode'; -import { useNodeType } from '@/composables/useNodeType'; - -const node = computed(() => mock()); -const nodeType = computed(() => mock()); - -vi.mock('@/stores/ndv.store', () => ({ - useNDVStore: vi.fn(() => ({ - activeNode: node, - })), -})); - -vi.mock('@/composables/useNodeType', () => ({ - useNodeType: vi.fn(() => ({ - nodeType, - })), -})); - -vi.mock('pinia', () => ({ - storeToRefs: vi.fn((store) => store), -})); - -describe('useActiveNode()', () => { - it('should call useNodeType()', () => { - useActiveNode(); - - expect(useNodeType).toHaveBeenCalledWith({ - node, - }); - }); - - it('should return activeNode and activeNodeType', () => { - const { activeNode, activeNodeType } = useActiveNode(); - - expect(activeNode).toBe(node); - expect(activeNodeType).toBe(nodeType); - }); -}); diff --git a/packages/frontend/editor-ui/src/composables/useActiveNode.ts b/packages/frontend/editor-ui/src/composables/useActiveNode.ts deleted file mode 100644 index 6faf76b93b..0000000000 --- a/packages/frontend/editor-ui/src/composables/useActiveNode.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { storeToRefs } from 'pinia'; -import { useNDVStore } from '@/stores/ndv.store'; -import { useNodeType } from '@/composables/useNodeType'; - -export function useActiveNode() { - const ndvStore = useNDVStore(); - - const { activeNode } = storeToRefs(ndvStore); - const { nodeType: activeNodeType } = useNodeType({ - node: activeNode, - }); - - return { - activeNode, - activeNodeType, - }; -} diff --git a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts index b815f92827..2e4c07ee2b 100644 --- a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts +++ b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts @@ -965,7 +965,6 @@ describe('useWorkflowHelpers', () => { workflowsStore.pinnedWorkflowData = { ParentNode: [{ json: { key: 'value' } }], }; - workflowsStore.shouldReplaceInputDataWithPinData = true; const result = executeData({}, parentNodes, currentNode, inputName, runIndex); @@ -982,7 +981,6 @@ describe('useWorkflowHelpers', () => { const runIndex = 0; workflowsStore.pinnedWorkflowData = undefined; - workflowsStore.shouldReplaceInputDataWithPinData = false; workflowsStore.getWorkflowRunData = { ParentNode: [ { @@ -1023,7 +1021,6 @@ describe('useWorkflowHelpers', () => { const parentRunIndex = 1; workflowsStore.pinnedWorkflowData = undefined; - workflowsStore.shouldReplaceInputDataWithPinData = false; workflowsStore.getWorkflowRunData = { ParentNode: [ { data: {} } as never, @@ -1066,7 +1063,6 @@ describe('useWorkflowHelpers', () => { const runIndex = 0; workflowsStore.pinnedWorkflowData = undefined; - workflowsStore.shouldReplaceInputDataWithPinData = false; workflowsStore.getWorkflowRunData = null; const result = executeData({}, parentNodes, currentNode, inputName, runIndex); diff --git a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts index 813b1abe8c..22114758a5 100644 --- a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts +++ b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts @@ -88,7 +88,6 @@ export function resolveParameter( opts.envVars, opts.workflow.getNode(opts.nodeName), opts.execution, - true, opts.workflow.pinData, { inputNodeName: opts.inputNode?.name, @@ -108,7 +107,6 @@ export function resolveParameter( useEnvironmentsStore().variablesAsObject, useNDVStore().activeNode, workflowsStore.workflowExecutionData, - workflowsStore.shouldReplaceInputDataWithPinData, workflowsStore.pinnedWorkflowData, opts, ); @@ -122,7 +120,6 @@ function resolveParameterImpl( envVars: Record, ndvActiveNode: INodeUi | null, executionData: IExecutionResponse | null, - shouldReplaceInputDataWithPinData: boolean, pinData: IPinData | undefined, opts: ResolveParameterOptions = {}, ): T | null { @@ -209,7 +206,6 @@ function resolveParameterImpl( contextNode!.name, inputName, runIndexParent, - shouldReplaceInputDataWithPinData, pinData, executionData?.data?.resultData.runData ?? null, nodeConnection, @@ -224,7 +220,6 @@ function resolveParameterImpl( contextNode.name, inputName, 0, - shouldReplaceInputDataWithPinData, pinData, executionData?.data?.resultData.runData ?? null, ); @@ -274,7 +269,6 @@ function resolveParameterImpl( contextNode!.name, inputName, runIndexCurrent, - shouldReplaceInputDataWithPinData, pinData, executionData?.data?.resultData.runData ?? null, runIndexParent, @@ -288,7 +282,6 @@ function resolveParameterImpl( contextNode!.name, inputName, runIndexParent, - shouldReplaceInputDataWithPinData, pinData, executionData?.data?.resultData.runData ?? null, ); @@ -383,7 +376,6 @@ function connectionInputData( currentNode: string, inputName: string, runIndex: number, - shouldReplaceInputDataWithPinData: boolean, pinData: IPinData | undefined, workflowRunData: IRunData | null, nodeConnection: INodeConnection = { sourceIndex: 0, destinationIndex: 0 }, @@ -395,7 +387,6 @@ function connectionInputData( currentNode, inputName, runIndex, - shouldReplaceInputDataWithPinData, pinData, workflowRunData, ); @@ -442,7 +433,6 @@ export function executeData( currentNode, inputName, runIndex, - workflowsStore.shouldReplaceInputDataWithPinData, workflowsStore.pinnedWorkflowData, workflowsStore.getWorkflowRunData, parentRunIndex, @@ -456,7 +446,6 @@ function executeDataImpl( currentNode: string, inputName: string, runIndex: number, - shouldReplaceInputDataWithPinData: boolean, pinData: IPinData | undefined, workflowRunData: IRunData | null, parentRunIndex?: number, @@ -473,17 +462,15 @@ function executeDataImpl( // Find the parent node which has data for (const parentNodeName of parentNodes) { - if (shouldReplaceInputDataWithPinData) { - const parentPinData = pinData?.[parentNodeName]; + const parentPinData = pinData?.[parentNodeName]; - // populate `executeData` from `pinData` + // populate `executeData` from `pinData` - if (parentPinData) { - executeData.data = { main: [parentPinData] }; - executeData.source = { main: [{ previousNode: parentNodeName }] }; + if (parentPinData) { + executeData.data = { main: [parentPinData] }; + executeData.source = { main: [{ previousNode: parentNodeName }] }; - return executeData; - } + return executeData; } // populate `executeData` from `runData` diff --git a/packages/frontend/editor-ui/src/stores/ndv.store.ts b/packages/frontend/editor-ui/src/stores/ndv.store.ts index c56e6c80f2..33d7da4f76 100644 --- a/packages/frontend/editor-ui/src/stores/ndv.store.ts +++ b/packages/frontend/editor-ui/src/stores/ndv.store.ts @@ -5,7 +5,6 @@ import type { IRunDataDisplayMode, MainPanelDimensions, MainPanelType, - NDVState, NodePanelType, OutputPanel, TargetItem, @@ -312,7 +311,7 @@ export const useNDVStore = defineStore(STORES.NDV, () => { }; }; - const setDraggableTarget = (target: NDVState['draggable']['activeTarget']): void => { + const setDraggableTarget = (target: Draggable['activeTarget']): void => { draggable.value.activeTarget = target; }; diff --git a/packages/frontend/editor-ui/src/stores/workflows.store.test.ts b/packages/frontend/editor-ui/src/stores/workflows.store.test.ts index 0679a68dce..92cd61a170 100644 --- a/packages/frontend/editor-ui/src/stores/workflows.store.test.ts +++ b/packages/frontend/editor-ui/src/stores/workflows.store.test.ts @@ -14,7 +14,6 @@ import type { IExecutionResponse, INodeUi, IWorkflowDb, IWorkflowSettings } from import { deepCopy, SEND_AND_WAIT_OPERATION } from 'n8n-workflow'; import type { IPinData, - ExecutionSummary, IConnection, INodeExecutionData, INode, @@ -317,26 +316,6 @@ describe('useWorkflowsStore', () => { }); }); - describe('shouldReplaceInputDataWithPinData', () => { - it('should return true when no active workflow execution', () => { - workflowsStore.activeWorkflowExecution = null; - - expect(workflowsStore.shouldReplaceInputDataWithPinData).toBe(true); - }); - - it('should return true when active workflow execution mode is manual', () => { - workflowsStore.activeWorkflowExecution = { mode: 'manual' } as unknown as ExecutionSummary; - - expect(workflowsStore.shouldReplaceInputDataWithPinData).toBe(true); - }); - - it('should return false when active workflow execution mode is not manual', () => { - workflowsStore.activeWorkflowExecution = { mode: 'automatic' } as unknown as ExecutionSummary; - - expect(workflowsStore.shouldReplaceInputDataWithPinData).toBe(false); - }); - }); - describe('getWorkflowResultDataByNodeName()', () => { it('should return null when no workflow run data is present', () => { workflowsStore.workflowExecutionData = null; diff --git a/packages/frontend/editor-ui/src/stores/workflows.store.ts b/packages/frontend/editor-ui/src/stores/workflows.store.ts index 05f11b1fc1..2c26b5ceae 100644 --- a/packages/frontend/editor-ui/src/stores/workflows.store.ts +++ b/packages/frontend/editor-ui/src/stores/workflows.store.ts @@ -149,7 +149,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { const usedCredentials = ref>({}); const activeWorkflows = ref([]); - const activeWorkflowExecution = ref(null); const currentWorkflowExecutions = ref([]); const workflowExecutionData = ref(null); const workflowExecutionStartedData = @@ -280,10 +279,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { const pinnedWorkflowData = computed(() => workflow.value.pinData); - const shouldReplaceInputDataWithPinData = computed(() => { - return !activeWorkflowExecution.value || activeWorkflowExecution.value.mode === 'manual'; - }); - const executedNode = computed(() => workflowExecutionData.value?.executedNode); const getAllLoadedFinishedExecutions = computed(() => { @@ -1905,7 +1900,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { workflow, usedCredentials, activeWorkflows, - activeWorkflowExecution, currentWorkflowExecutions, workflowExecutionData, workflowExecutionPairedItemMappings, @@ -1945,7 +1939,6 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => { nodesByName, nodesIssuesExist, pinnedWorkflowData, - shouldReplaceInputDataWithPinData, executedNode, getAllLoadedFinishedExecutions, getWorkflowExecution,