@@ -106,11 +106,16 @@ qx.Class.define("osparc.data.model.Workbench", {
106106 buildWorkbench : function ( ) {
107107 this . __nodes = { } ;
108108 this . __edges = { } ;
109- this . __deserialize ( this . __workbenchInitData , this . __workbenchUIInitData ) ;
110- // this.__deserializeAll(this.__workbenchInitData, this.__workbenchUIInitData);
111- // OM: isn't this handled later?
112- this . __workbenchInitData = null ;
113- this . __workbenchUIInitData = null ;
109+ const newWay = true ;
110+ if ( newWay ) {
111+ this . __deserializeAll ( this . __workbenchInitData , this . __workbenchUIInitData ) ;
112+ this . __workbenchInitData = null ;
113+ this . __workbenchUIInitData = null ;
114+ } else {
115+ this . __deserialize ( this . __workbenchInitData , this . __workbenchUIInitData ) ;
116+ this . __workbenchInitData = null ;
117+ this . __workbenchUIInitData = null ;
118+ }
114119 } ,
115120
116121 // starts the dynamic services
@@ -286,7 +291,7 @@ qx.Class.define("osparc.data.model.Workbench", {
286291 node . addListener ( "changeInputNodes" , ( ) => this . fireDataEvent ( "pipelineChanged" ) , this ) ;
287292 node . addListener ( "reloadModel" , ( ) => this . fireEvent ( "reloadModel" ) , this ) ;
288293 node . addListener ( "updateStudyDocument" , ( ) => this . fireEvent ( "updateStudyDocument" ) , this ) ;
289- osparc . utils . Utils . localCache . serviceToFavs ( metadata . key ) ;
294+ osparc . utils . Utils . localCache . serviceToFavs ( metadata [ " key" ] ) ;
290295
291296 this . __initNodeSignals ( node ) ;
292297 this . __addNode ( node ) ;
@@ -295,7 +300,7 @@ qx.Class.define("osparc.data.model.Workbench", {
295300 } ,
296301
297302 __deserializeNode : function ( key , version , nodeId , nodeData , nodeUiData ) {
298- const node = osparc . data . model . Node ( this . getStudy ( ) , key , version , nodeId ) ;
303+ const node = new osparc . data . model . Node ( this . getStudy ( ) , key , version , nodeId ) ;
299304 node . fetchMetadataAndPopulate ( nodeData , nodeUiData ) ;
300305 if ( osparc . utils . Utils . eventDrivenPatch ( ) ) {
301306 node . listenToChanges ( ) ;
@@ -305,7 +310,7 @@ qx.Class.define("osparc.data.model.Workbench", {
305310 node . addListener ( "changeInputNodes" , ( ) => this . fireDataEvent ( "pipelineChanged" ) , this ) ;
306311 node . addListener ( "reloadModel" , ( ) => this . fireEvent ( "reloadModel" ) , this ) ;
307312 node . addListener ( "updateStudyDocument" , ( ) => this . fireEvent ( "updateStudyDocument" ) , this ) ;
308- osparc . utils . Utils . localCache . serviceToFavs ( metadata . key ) ;
313+ osparc . utils . Utils . localCache . serviceToFavs ( key ) ;
309314
310315 this . __initNodeSignals ( node ) ;
311316 this . __addNode ( node ) ;
@@ -732,20 +737,25 @@ qx.Class.define("osparc.data.model.Workbench", {
732737 } ) ;
733738 } ,
734739
735- __deserializeAll : function ( workbenchData , uiData = { } ) {
740+ __deserializeAll : function ( workbenchInitData , uiData = { } ) {
736741 const nodeDatas = { } ;
737742 const nodeUiDatas = { } ;
738- for ( const nodeId in workbenchData ) {
739- const nodeData = workbenchData [ nodeId ] ;
743+ for ( const nodeId in workbenchInitData ) {
744+ const nodeData = workbenchInitData [ nodeId ] ;
740745 nodeDatas [ nodeId ] = nodeData ;
741746 if ( uiData [ "workbench" ] && nodeId in uiData [ "workbench" ] ) {
742747 nodeUiDatas [ nodeId ] = uiData [ "workbench" ] [ nodeId ] ;
743748 }
744749 }
745750 for ( const nodeId in nodeDatas ) {
746- console . log ( "node" , nodeId , nodeDatas [ nodeId ] , nodeUiDatas [ nodeId ] ) ;
747- this . __deserializeNode ( nodeId , nodeDatas [ nodeId ] , nodeUiDatas [ nodeId ] ) ;
748- }
751+ const nodeData = nodeDatas [ nodeId ] ;
752+ const nodeUiData = nodeUiDatas [ nodeId ] ;
753+ this . __deserializeNode ( nodeData [ "key" ] , nodeData [ "version" ] , nodeId , nodeData , nodeUiData ) ;
754+ }
755+ setTimeout ( ( ) => {
756+ this . __deserializeEdges ( workbenchInitData ) ;
757+ this . setDeserialized ( true ) ;
758+ } , 2000 ) ;
749759 } ,
750760
751761 __deserializeNodes : function ( workbenchData , workbenchUIData = { } ) {
0 commit comments