@@ -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