Skip to content

Commit 25193a7

Browse files
committed
highlightEdge
1 parent 91e6cad commit 25193a7

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ qx.Class.define("osparc.form.renderer.PropForm", {
358358
const inputNodeIDs = thisNode.getInputNodes();
359359
inputNodeIDs.forEach(inputNodeId => {
360360
const inputNode = this.getStudy().getWorkbench().getNode(inputNodeId);
361-
if (inputNode) {
361+
if (inputNode && inputNode.getMetadata()) {
362362
for (const outputKey in inputNode.getOutputs()) {
363363
const paramButton = new qx.ui.menu.Button();
364364
inputNode.bind("label", paramButton, "label", {
@@ -400,7 +400,7 @@ qx.Class.define("osparc.form.renderer.PropForm", {
400400
menu.removeAll();
401401

402402
const inputNode = this.getStudy().getWorkbench().getNode(inputNodeId);
403-
if (inputNode) {
403+
if (inputNode && inputNode.getMetadata()) {
404404
for (const outputKey in inputNode.getOutputs()) {
405405
osparc.utils.Ports.arePortsCompatible(inputNode, outputKey, this.getNode(), targetPortId)
406406
.then(compatible => {

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ qx.Class.define("osparc.workbench.NodeUI", {
168168
"nodeMovingStop": "qx.event.type.Event",
169169
"updateNodeDecorator": "qx.event.type.Event",
170170
"requestOpenLogger": "qx.event.type.Event",
171+
"highlightEdge": "qx.event.type.Data",
171172
},
172173

173174
members: {
@@ -336,7 +337,7 @@ qx.Class.define("osparc.workbench.NodeUI", {
336337
}
337338
},
338339

339-
populateNodeLayout: function(svgWorkbenchCanvas) {
340+
__populateNodeLayout: function(svgWorkbenchCanvas) {
340341
const node = this.getNode();
341342
node.bind("label", this, "caption", {
342343
onUpdate: () => {
@@ -370,6 +371,18 @@ qx.Class.define("osparc.workbench.NodeUI", {
370371
this.addListener("resize", () => {
371372
setTimeout(() => this.fireEvent("updateNodeDecorator"), 50);
372373
});
374+
375+
if (node.getPropsForm()) {
376+
node.getPropsForm().addListener("highlightEdge", e => this.fireDataEvent("highlightEdge", e.getData()), this);
377+
}
378+
},
379+
380+
populateNodeLayout: function(svgWorkbenchCanvas) {
381+
if (this.getNode().getMetadata()) {
382+
this.__populateNodeLayout(svgWorkbenchCanvas);
383+
} else {
384+
this.getNode().addListenerOnce("changeMetadata", () => this.__populateNodeLayout(svgWorkbenchCanvas), this);
385+
}
373386
},
374387

375388
__applyNode: function(node) {

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

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -689,25 +689,22 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
689689
nodeUI.addListener("markerClicked", e => this.__openMarkerEditor(e.getData()), this);
690690
nodeUI.addListener("infoNode", e => this.__openNodeInfo(e.getData()), this);
691691
nodeUI.addListener("removeNode", e => this.fireDataEvent("removeNode", e.getData()), this);
692-
693-
if (nodeUI.getNode().getPropsForm()) {
694-
nodeUI.getNode().getPropsForm().addListener("highlightEdge", e => {
695-
const {
696-
highlight,
697-
fromNodeId,
698-
toNodeId,
699-
} = e.getData();
700-
const edgeFound = this.__edgesUI.find(edgeUI => {
701-
const edge = edgeUI.getEdge();
702-
const inputNode = edge.getInputNode();
703-
const outputNode = edge.getOutputNode();
704-
return (inputNode.getNodeId() === fromNodeId && outputNode.getNodeId() === toNodeId)
705-
});
706-
if (edgeFound) {
707-
edgeFound.setHighlighted(highlight);
708-
}
692+
nodeUI.addListener("highlightEdge", e => {
693+
const {
694+
highlight,
695+
fromNodeId,
696+
toNodeId,
697+
} = e.getData();
698+
const edgeFound = this.__edgesUI.find(edgeUI => {
699+
const edge = edgeUI.getEdge();
700+
const inputNode = edge.getInputNode();
701+
const outputNode = edge.getOutputNode();
702+
return (inputNode.getNodeId() === fromNodeId && outputNode.getNodeId() === toNodeId)
709703
});
710-
}
704+
if (edgeFound) {
705+
edgeFound.setHighlighted(highlight);
706+
}
707+
});
711708

712709
return nodeUI;
713710
},

0 commit comments

Comments
 (0)