Skip to content

Commit 2dfbdb6

Browse files
committed
createEdge
1 parent 0ca3f0f commit 2dfbdb6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

services/static-webserver/client/source/class/osparc/data/model/Node.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ qx.Class.define("osparc.data.model.Node", {
199199
"retrieveInputs": "qx.event.type.Data",
200200
"keyChanged": "qx.event.type.Event",
201201
"changePosition": "qx.event.type.Data",
202+
"createEdge": "qx.event.type.Data",
202203
"fileRequested": "qx.event.type.Data",
203204
"parameterRequested": "qx.event.type.Data",
204205
"filePickerRequested": "qx.event.type.Data",
@@ -1458,8 +1459,12 @@ qx.Class.define("osparc.data.model.Node", {
14581459
case "inputNodes":
14591460
if (op === "add") {
14601461
const inputNodeId = value;
1461-
this.addInputNode(inputNodeId);
1462+
this.fireDataEvent("createEdge", {
1463+
nodeId1: inputNodeId,
1464+
nodeId2: this.getNodeId(),
1465+
});
14621466
} else if (op === "remove") {
1467+
// we don't have more information about the input node, so we just remove it by index
14631468
const index = path.split("/")[4];
14641469
this.__removeInputNodeByIndex(index);
14651470
}

services/static-webserver/client/source/class/osparc/workbench/WorkbenchUI.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,11 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
663663
const nodeUI = new osparc.workbench.NodeUI(node);
664664
this.bind("scale", nodeUI, "scale");
665665
node.addListener("keyChanged", () => this.__selectNode(nodeUI), this);
666+
node.addListener("createEdge", e => {
667+
const data = e.getData();
668+
const { nodeId1, nodeId2 } = data;
669+
this._createEdgeBetweenNodes(nodeId1, nodeId2, false);
670+
});
666671
nodeUI.populateNodeLayout(this.__svgLayer);
667672
nodeUI.addListener("renameNode", e => this.__openNodeRenamer(e.getData()), this);
668673
nodeUI.addListener("markerClicked", e => this.__openMarkerEditor(e.getData()), this);

0 commit comments

Comments
 (0)