From b0d7cfa2abbb09348f60d696871a6d4d3c6aaceb Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Tue, 18 Jun 2024 16:35:26 +0300 Subject: [PATCH] refactor(editor): Migrate nodeBase mixin to composable (no-changelog) (#9742) --- packages/editor-ui/src/__tests__/defaults.ts | 10 +- packages/editor-ui/src/components/Node.vue | 75 +- packages/editor-ui/src/components/Sticky.vue | 77 +- .../src/composables/useNodeBase.spec.ts | 198 +++++ .../editor-ui/src/composables/useNodeBase.ts | 673 +++++++++++++++++ packages/editor-ui/src/mixins/nodeBase.ts | 684 ------------------ 6 files changed, 1015 insertions(+), 702 deletions(-) create mode 100644 packages/editor-ui/src/composables/useNodeBase.spec.ts create mode 100644 packages/editor-ui/src/composables/useNodeBase.ts delete mode 100644 packages/editor-ui/src/mixins/nodeBase.ts diff --git a/packages/editor-ui/src/__tests__/defaults.ts b/packages/editor-ui/src/__tests__/defaults.ts index ee5865e923..b3b18bdb5f 100644 --- a/packages/editor-ui/src/__tests__/defaults.ts +++ b/packages/editor-ui/src/__tests__/defaults.ts @@ -10,7 +10,7 @@ import aiNodeTypesJson from '../../../@n8n/nodes-langchain/dist/types/nodes.json const allNodeTypes = [...nodeTypesJson, ...aiNodeTypesJson]; -function findNodeWithName(name: string): INodeTypeDescription { +export function findNodeTypeDescriptionByName(name: string): INodeTypeDescription { return allNodeTypes.find((node) => node.name === name) as INodeTypeDescription; } @@ -18,25 +18,25 @@ export const testingNodeTypes: INodeTypeData = { [MANUAL_TRIGGER_NODE_TYPE]: { sourcePath: '', type: { - description: findNodeWithName(MANUAL_TRIGGER_NODE_TYPE), + description: findNodeTypeDescriptionByName(MANUAL_TRIGGER_NODE_TYPE), }, }, [SET_NODE_TYPE]: { sourcePath: '', type: { - description: findNodeWithName(SET_NODE_TYPE), + description: findNodeTypeDescriptionByName(SET_NODE_TYPE), }, }, [CHAT_TRIGGER_NODE_TYPE]: { sourcePath: '', type: { - description: findNodeWithName(CHAT_TRIGGER_NODE_TYPE), + description: findNodeTypeDescriptionByName(CHAT_TRIGGER_NODE_TYPE), }, }, [AGENT_NODE_TYPE]: { sourcePath: '', type: { - description: findNodeWithName(AGENT_NODE_TYPE), + description: findNodeTypeDescriptionByName(AGENT_NODE_TYPE), }, }, }; diff --git a/packages/editor-ui/src/components/Node.vue b/packages/editor-ui/src/components/Node.vue index 03f19d7b96..4904f8f00c 100644 --- a/packages/editor-ui/src/components/Node.vue +++ b/packages/editor-ui/src/components/Node.vue @@ -178,7 +178,8 @@