From 6c850f11f1811e4f3446baec9331fb487bb6c436 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 9 Sep 2022 12:50:44 +0200 Subject: [PATCH] Add somewhat working Minimap --- .../components/Workflow/Editor/Draggable.vue | 4 - .../src/components/Workflow/Editor/Index.vue | 1 + .../components/Workflow/Editor/Minimap.vue | 100 ++++++++++++++++++ .../Workflow/Editor/MinimapNode.vue | 18 ++++ .../src/components/Workflow/Editor/Node.vue | 11 +- .../components/Workflow/Editor/NodeInput.vue | 10 +- .../components/Workflow/Editor/NodeOutput.vue | 8 +- .../Workflow/Editor/WorkflowGraph.vue | 25 +++-- client/src/store/workflowEditorStateStore.js | 11 +- client/src/style/scss/workflow.scss | 3 + 10 files changed, 165 insertions(+), 26 deletions(-) create mode 100644 client/src/components/Workflow/Editor/Minimap.vue create mode 100644 client/src/components/Workflow/Editor/MinimapNode.vue diff --git a/client/src/components/Workflow/Editor/Draggable.vue b/client/src/components/Workflow/Editor/Draggable.vue index fe87aff9e0c..fff1b8df34d 100644 --- a/client/src/components/Workflow/Editor/Draggable.vue +++ b/client/src/components/Workflow/Editor/Draggable.vue @@ -19,10 +19,6 @@ export default { Draggable, }, props: { - position: { - type: Object, - required: false, - }, rootOffset: { type: Object, required: false, diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index 30d7149bcec..1c779431713 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -69,6 +69,7 @@ :steps="steps" :datatypes-mapper="datatypesMapper" :get-manager="getManager" + :nodes="nodes" @onUpdate="onUpdate" @onClone="onClone" @onCreate="onInsertTool" diff --git a/client/src/components/Workflow/Editor/Minimap.vue b/client/src/components/Workflow/Editor/Minimap.vue new file mode 100644 index 00000000000..87d3b7bf181 --- /dev/null +++ b/client/src/components/Workflow/Editor/Minimap.vue @@ -0,0 +1,100 @@ + + diff --git a/client/src/components/Workflow/Editor/MinimapNode.vue b/client/src/components/Workflow/Editor/MinimapNode.vue new file mode 100644 index 00000000000..6dc70dd1f33 --- /dev/null +++ b/client/src/components/Workflow/Editor/MinimapNode.vue @@ -0,0 +1,18 @@ + + + + + diff --git a/client/src/components/Workflow/Editor/Node.vue b/client/src/components/Workflow/Editor/Node.vue index 6e3d4662de7..b1ce6d3c52d 100644 --- a/client/src/components/Workflow/Editor/Node.vue +++ b/client/src/components/Workflow/Editor/Node.vue @@ -1,6 +1,6 @@ diff --git a/client/src/store/workflowEditorStateStore.js b/client/src/store/workflowEditorStateStore.js index 897a6d1ed37..bb761a14093 100644 --- a/client/src/store/workflowEditorStateStore.js +++ b/client/src/store/workflowEditorStateStore.js @@ -10,7 +10,6 @@ export const state = { import Vue from "vue"; const getters = { getInputTerminalPosition: (state) => (stepId, inputName) => { - console.log("getting input for", stepId, inputName); return state.inputTerminals[stepId]?.[inputName]; }, getOutputTerminalPosition: (state) => (stepId, outputName) => { @@ -47,6 +46,14 @@ const mutations = { Vue.set(state.outputTerminals[stepId], outputName, position); } }, + deleteInputTerminalPosition: (state, { stepId, inputName }) => { + console.log("deleting output"); + delete state.inputTerminals[stepId][inputName]; + }, + deleteOutputTerminalPosition: (state, { stepId, outputName }) => { + console.log("deleting output"); + delete state.outputTerminals[stepId][outputName]; + }, setConnection: (state, { source, target, connection }) => { if (!state.connections[source]) { state.connections[source] = { target: connection }; @@ -61,7 +68,7 @@ const mutations = { state.scale = scale; }, setNode: (state, node) => { - state.nodes[node.id] = node; + Vue.set(state.nodes, node.id, node); }, deleteNode: (state, nodeId) => { delete state.nodes[nodeId]; diff --git a/client/src/style/scss/workflow.scss b/client/src/style/scss/workflow.scss index 63381ddd4e1..6953929bca6 100644 --- a/client/src/style/scss/workflow.scss +++ b/client/src/style/scss/workflow.scss @@ -200,6 +200,9 @@ width: 100%; height: 100%; } + .mini-node { + color: $brand-primary + } } #input-choices-menu { color: black;