Skip to content

Commit 021c4be

Browse files
committed
openServiceCatalogWithContext
1 parent d1d6417 commit 021c4be

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ qx.Class.define("osparc.workbench.NodeUI", {
165165
"nodeMovingStop": "qx.event.type.Event",
166166
"updateNodeDecorator": "qx.event.type.Event",
167167
"requestOpenLogger": "qx.event.type.Event",
168+
"requestOpenServiceCatalog": "qx.event.type.Data",
168169
"highlightEdge": "qx.event.type.Data",
169170
},
170171

@@ -773,6 +774,9 @@ qx.Class.define("osparc.workbench.NodeUI", {
773774
return;
774775
}
775776
const port = this.__createPort(isInput);
777+
port.addListener("tap", () => {
778+
this.fireDataEvent("requestOpenServiceCatalog", isInput);
779+
}, this);
776780
port.addListener("mouseover", () => {
777781
port.setSource(this.self().PORT_CONNECTED);
778782
}, this);

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
292292
this.openServiceCatalog(nodePos);
293293
},
294294

295+
__openServiceCatalogWithContext: function(nodeUI, isNodeInput) {
296+
const freePos = this.getStudy().getWorkbench().getFreePosition(nodeUI.getNode(), isNodeInput);
297+
const srvCat = this.openServiceCatalog(freePos);
298+
if (srvCat) {
299+
if (isNodeInput) {
300+
srvCat.setContext(null, nodeUI.getNodeId());
301+
} else {
302+
srvCat.setContext(nodeUI.getNodeId(), null);
303+
}
304+
}
305+
},
306+
295307
openServiceCatalog: function(nodePos) {
296308
if (osparc.workbench.ServiceCatalog.canItBeOpened(this.getStudy())) {
297309
const srvCat = new osparc.workbench.ServiceCatalog();
@@ -701,6 +713,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
701713
edgeFound.setHighlighted(highlight);
702714
}
703715
});
716+
nodeUI.addListener("requestOpenServiceCatalog", e => this.__openServiceCatalogWithContext(nodeUI, e.getData()), this);
704717

705718
return nodeUI;
706719
},
@@ -1393,23 +1406,11 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
13931406
},
13941407
addServiceInput: {
13951408
"text": "\uf090", // in
1396-
"action": () => {
1397-
const freePos = this.getStudy().getWorkbench().getFreePosition(nodeUI.getNode(), true);
1398-
const srvCat = this.openServiceCatalog(freePos);
1399-
if (srvCat) {
1400-
srvCat.setContext(null, nodeUI.getNodeId());
1401-
}
1402-
}
1409+
"action": () => this.__openServiceCatalogWithContext(nodeUI, true)
14031410
},
14041411
addServiceOutput: {
14051412
"text": "\uf08b", // out
1406-
"action": () => {
1407-
const freePos = this.getStudy().getWorkbench().getFreePosition(nodeUI.getNode(), false);
1408-
const srvCat = this.openServiceCatalog(freePos);
1409-
if (srvCat) {
1410-
srvCat.setContext(nodeUI.getNodeId(), null);
1411-
}
1412-
}
1413+
"action": () => this.__openServiceCatalogWithContext(nodeUI, false)
14131414
},
14141415
noAction: {
14151416
"text": "\uf05e", // verboten

0 commit comments

Comments
 (0)