From 97280329b2dc92b929e50cdb7f09541a13320fe7 Mon Sep 17 00:00:00 2001 From: Mutasem Date: Wed, 13 Oct 2021 12:45:41 +0200 Subject: [PATCH] handle nodes moving --- packages/editor-ui/src/Interface.ts | 5 -- .../src/components/mixins/nodeBase.ts | 2 + packages/editor-ui/src/store.ts | 4 +- packages/editor-ui/src/views/NodeView.vue | 48 +++++++++++-------- packages/editor-ui/src/views/helpers.ts | 32 +++++++++++++ 5 files changed, 62 insertions(+), 29 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 8181647da4..d86a134acb 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -103,11 +103,6 @@ export interface INodeUi extends INode { color?: string; notes?: string; issues?: INodeIssues; - _jsPlumb?: { - endpoints?: { - [key: string]: IEndpointOptions[]; - }; - }; } export interface INodeTypesMaxCount { diff --git a/packages/editor-ui/src/components/mixins/nodeBase.ts b/packages/editor-ui/src/components/mixins/nodeBase.ts index d687a2fd09..f9716a55df 100644 --- a/packages/editor-ui/src/components/mixins/nodeBase.ts +++ b/packages/editor-ui/src/components/mixins/nodeBase.ts @@ -328,6 +328,8 @@ export const nodeBase = mixins( this.$store.commit('updateNodeProperties', updateInformation); }); + + this.$emit('moved', node); } }, filter: '.node-description, .node-description .node-name, .node-description .node-subtitle', diff --git a/packages/editor-ui/src/store.ts b/packages/editor-ui/src/store.ts index 93e67903ef..db31d9b2a0 100644 --- a/packages/editor-ui/src/store.ts +++ b/packages/editor-ui/src/store.ts @@ -728,9 +728,7 @@ export const store = new Vuex.Store({ allConnections: (state): IConnections => { return state.workflow.connections; }, - // connectionsByNodeName: (state) => (nodeName: string): {[key: string]: Connection[][]} | null => { - // connectionsByNodeName: (state) => (nodeName: string): { [key: string]: NodeConnections} | null => { - connectionsByNodeName: (state) => (nodeName: string): INodeConnections => { + outgoingConnectionsByNodeName: (state) => (nodeName: string): INodeConnections => { if (state.workflow.connections.hasOwnProperty(nodeName)) { return state.workflow.connections[nodeName]; } diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 63cf899873..9ec86c5055 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -21,6 +21,7 @@ @nodeSelected="nodeSelectedByName" @removeNode="removeNode" @runWorkflow="runWorkflow" + @moved="onNodeMoved" :id="'node-' + getNodeIndex(nodeData.name)" :key="getNodeIndex(nodeData.name)" :name="nodeData.name" @@ -105,6 +106,7 @@