refactor(editor): Fix remaining FE type check errors (no-changelog) (#9607)
Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
@@ -69,7 +69,7 @@ describe('useCanvasPanning()', () => {
|
||||
const { onMouseDown, onMouseMove, onMouseUp } = useCanvasPanning(elementRef);
|
||||
|
||||
onMouseDown(new MouseEvent('mousedown', { button: 1 }), true);
|
||||
onMouseUp(new MouseEvent('mouseup'));
|
||||
onMouseUp();
|
||||
|
||||
expect(removeEventListenerSpy).toHaveBeenCalledWith('mousemove', onMouseMove);
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import { createPinia, setActivePinia } from 'pinia';
|
||||
import { createTestNode } from '@/__tests__/mocks';
|
||||
import type { Connection } from '@vue-flow/core';
|
||||
import type { IConnection } from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
describe('useCanvasOperations', () => {
|
||||
let workflowsStore: ReturnType<typeof useWorkflowsStore>;
|
||||
@@ -200,9 +201,9 @@ describe('useCanvasOperations', () => {
|
||||
|
||||
const connection: Connection = {
|
||||
source: nodeA.id,
|
||||
sourceHandle: 'outputs/main/0',
|
||||
sourceHandle: `outputs/${NodeConnectionType.Main}/0`,
|
||||
target: nodeB.id,
|
||||
targetHandle: 'inputs/main/0',
|
||||
targetHandle: `inputs/${NodeConnectionType.Main}/0`,
|
||||
};
|
||||
|
||||
vi.spyOn(workflowsStore, 'getNodeById').mockReturnValueOnce(nodeA).mockReturnValueOnce(nodeB);
|
||||
@@ -211,8 +212,8 @@ describe('useCanvasOperations', () => {
|
||||
|
||||
expect(addConnectionSpy).toHaveBeenCalledWith({
|
||||
connection: [
|
||||
{ index: 0, node: nodeA.name, type: 'main' },
|
||||
{ index: 0, node: nodeB.name, type: 'main' },
|
||||
{ index: 0, node: nodeA.name, type: NodeConnectionType.Main },
|
||||
{ index: 0, node: nodeB.name, type: NodeConnectionType.Main },
|
||||
],
|
||||
});
|
||||
expect(uiStore.stateIsDirty).toBe(true);
|
||||
@@ -269,9 +270,9 @@ describe('useCanvasOperations', () => {
|
||||
|
||||
const connection: Connection = {
|
||||
source: nodeA.id,
|
||||
sourceHandle: 'outputs/main/0',
|
||||
sourceHandle: `outputs/${NodeConnectionType.Main}/0`,
|
||||
target: nodeB.id,
|
||||
targetHandle: 'inputs/main/0',
|
||||
targetHandle: `inputs/${NodeConnectionType.Main}/0`,
|
||||
};
|
||||
|
||||
vi.spyOn(workflowsStore, 'getNodeById').mockReturnValueOnce(nodeA).mockReturnValueOnce(nodeB);
|
||||
@@ -280,8 +281,8 @@ describe('useCanvasOperations', () => {
|
||||
|
||||
expect(removeConnectionSpy).toHaveBeenCalledWith({
|
||||
connection: [
|
||||
{ index: 0, node: nodeA.name, type: 'main' },
|
||||
{ index: 0, node: nodeB.name, type: 'main' },
|
||||
{ index: 0, node: nodeA.name, type: NodeConnectionType.Main },
|
||||
{ index: 0, node: nodeB.name, type: NodeConnectionType.Main },
|
||||
],
|
||||
});
|
||||
});
|
||||
@@ -294,8 +295,8 @@ describe('useCanvasOperations', () => {
|
||||
.mockImplementation(() => {});
|
||||
|
||||
const connection: [IConnection, IConnection] = [
|
||||
{ node: 'sourceNode', type: 'type', index: 1 },
|
||||
{ node: 'targetNode', type: 'type', index: 2 },
|
||||
{ node: 'sourceNode', type: NodeConnectionType.Main, index: 1 },
|
||||
{ node: 'targetNode', type: NodeConnectionType.Main, index: 2 },
|
||||
];
|
||||
|
||||
canvasOperations.revertDeleteConnection(connection);
|
||||
|
||||
@@ -24,7 +24,7 @@ export function useCanvasPanning(
|
||||
/**
|
||||
* Updates the canvas offset position based on the mouse movement
|
||||
*/
|
||||
function panCanvas(e: MouseEvent) {
|
||||
function panCanvas(e: MouseEvent | TouchEvent) {
|
||||
const offsetPosition = uiStore.nodeViewOffsetPosition;
|
||||
|
||||
const [x, y] = getMousePosition(e);
|
||||
|
||||
@@ -15,6 +15,7 @@ import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useTelemetry } from './useTelemetry';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { isFullExecutionResponse } from '@/utils/typeGuards';
|
||||
|
||||
export const useExecutionDebugging = () => {
|
||||
const telemetry = useTelemetry();
|
||||
@@ -131,7 +132,7 @@ export const useExecutionDebugging = () => {
|
||||
|
||||
telemetry.track('User clicked debug execution button', {
|
||||
instance_id: useRootStore().instanceId,
|
||||
exec_status: execution.status,
|
||||
exec_status: isFullExecutionResponse(execution) ? execution.status : '',
|
||||
override_pinned_data: pinnableNodes.length === pinnings,
|
||||
all_exec_data_imported: missingNodeNames.length === 0,
|
||||
});
|
||||
|
||||
@@ -271,7 +271,7 @@ export function useNodeHelpers() {
|
||||
}
|
||||
}
|
||||
|
||||
function updateNodeParameterIssues(node: INodeUi, nodeType?: INodeTypeDescription): void {
|
||||
function updateNodeParameterIssues(node: INodeUi, nodeType?: INodeTypeDescription | null): void {
|
||||
const localNodeType = nodeType ?? nodeTypesStore.getNodeType(node.type, node.typeVersion);
|
||||
|
||||
if (localNodeType === null) {
|
||||
|
||||
@@ -530,6 +530,7 @@ export function usePushConnection({ router }: { router: ReturnType<typeof useRou
|
||||
const executionData: IExecutionsCurrentSummaryExtended = {
|
||||
id: pushData.executionId,
|
||||
finished: false,
|
||||
status: 'running',
|
||||
mode: pushData.mode,
|
||||
startedAt: pushData.startedAt,
|
||||
retryOf: pushData.retryOf,
|
||||
|
||||
@@ -39,7 +39,6 @@ import type {
|
||||
IWorkflowData,
|
||||
IWorkflowDataUpdate,
|
||||
IWorkflowDb,
|
||||
IWorkflowTemplateNode,
|
||||
TargetItem,
|
||||
XYPosition,
|
||||
} from '@/Interface';
|
||||
@@ -308,11 +307,7 @@ function getNodes(): INodeUi[] {
|
||||
}
|
||||
|
||||
// Returns a workflow instance.
|
||||
function getWorkflow(
|
||||
nodes: Array<INodeUi | IWorkflowTemplateNode>,
|
||||
connections: IConnections,
|
||||
copyData?: boolean,
|
||||
): Workflow {
|
||||
function getWorkflow(nodes: INodeUi[], connections: IConnections, copyData?: boolean): Workflow {
|
||||
return useWorkflowsStore().getWorkflow(nodes, connections, copyData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user