File tree Expand file tree Collapse file tree 2 files changed +34
-23
lines changed
services/static-webserver/client/source/class/osparc/workbench Expand file tree Collapse file tree 2 files changed +34
-23
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,22 @@ qx.Class.define("osparc.workbench.ServiceCatalog", {
8282 statics : {
8383 LATEST : "latest" ,
8484 Width : 580 ,
85- Height : 500
85+ Height : 500 ,
86+
87+ canItBeOpened : function ( study ) {
88+ if ( study ) {
89+ if ( study . isReadOnly ( ) ) {
90+ osparc . FlashMessenger . logError ( "Nodes can't be added to a read-only project" ) ;
91+ return false ;
92+ }
93+ if ( study . isPipelineRunning ( ) ) {
94+ osparc . FlashMessenger . logError ( osparc . data . model . Workbench . CANT_ADD_NODE ) ;
95+ return false ;
96+ }
97+ return true ;
98+ }
99+ return false ;
100+ } ,
86101 } ,
87102
88103 members : {
Original file line number Diff line number Diff line change @@ -293,29 +293,25 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
293293 } ,
294294
295295 openServiceCatalog : function ( nodePos ) {
296- if ( this . getStudy ( ) . isReadOnly ( ) ) {
297- return null ;
298- }
299- if ( this . getStudy ( ) . isPipelineRunning ( ) ) {
300- osparc . FlashMessenger . logError ( osparc . data . model . Workbench . CANT_ADD_NODE ) ;
301- return null ;
296+ if ( osparc . workbench . ServiceCatalog . canItBeOpened ( this . getStudy ( ) ) ) {
297+ const srvCat = new osparc . workbench . ServiceCatalog ( ) ;
298+ srvCat . addListener ( "addService" , async e => {
299+ const {
300+ service,
301+ nodeLeftId,
302+ nodeRightId
303+ } = e . getData ( ) ;
304+ const nodeUI = await this . __addNode ( service , nodePos ) ;
305+ if ( nodeUI && nodeLeftId !== null || nodeRightId !== null ) {
306+ const newNodeId = nodeUI . getNodeId ( ) ;
307+ this . _createEdgeBetweenNodes ( nodeLeftId ? nodeLeftId : newNodeId , nodeRightId ? nodeRightId : newNodeId , true ) ;
308+ }
309+ } , this ) ;
310+ srvCat . center ( ) ;
311+ srvCat . open ( ) ;
312+ return srvCat ;
302313 }
303- const srvCat = new osparc . workbench . ServiceCatalog ( ) ;
304- srvCat . addListener ( "addService" , async e => {
305- const {
306- service,
307- nodeLeftId,
308- nodeRightId
309- } = e . getData ( ) ;
310- const nodeUI = await this . __addNode ( service , nodePos ) ;
311- if ( nodeUI && nodeLeftId !== null || nodeRightId !== null ) {
312- const newNodeId = nodeUI . getNodeId ( ) ;
313- this . _createEdgeBetweenNodes ( nodeLeftId ? nodeLeftId : newNodeId , nodeRightId ? nodeRightId : newNodeId , true ) ;
314- }
315- } , this ) ;
316- srvCat . center ( ) ;
317- srvCat . open ( ) ;
318- return srvCat ;
314+ return null ;
319315 } ,
320316
321317 __createTemporaryNodeUI : function ( pos ) {
You can’t perform that action at this time.
0 commit comments