@@ -38,19 +38,39 @@ qx.Class.define("osparc.study.StudyPreview", {
3838 osparc . FlashMessenger . logError ( "Function Data not available" ) ;
3939 return ;
4040 }
41+
4142 const study = new osparc . data . model . Study ( studyData ) ;
42- const preview = new osparc . study . StudyPreview ( study ) ;
43- const title = this . tr ( "Function Preview" ) ;
44- const width = osparc . dashboard . ResourceDetails . WIDTH ;
45- const height = osparc . dashboard . ResourceDetails . HEIGHT ;
46- osparc . ui . window . Window . popUpInWindow ( preview , title , width , height ) ;
43+ // make sure it will be shown
44+ study . getUi ( ) . setMode ( "pipeline" ) ;
45+
46+ const studyReady = ( ) => {
47+ const preview = new osparc . study . StudyPreview ( study ) ;
48+ const title = qx . locale . Manager . tr ( "Function Preview" ) ;
49+ const width = osparc . dashboard . ResourceDetails . WIDTH ;
50+ const height = osparc . dashboard . ResourceDetails . HEIGHT ;
51+ osparc . ui . window . Window . popUpInWindow ( preview , title , width , height ) . set ( {
52+ clickAwayClose : false ,
53+ resizable : true ,
54+ showClose : true ,
55+ } ) ;
56+ }
57+
58+ if ( study . getWorkbench ( ) . isDeserialized ( ) ) {
59+ studyReady ( ) ;
60+ } else {
61+ study . getWorkbench ( ) . addListener ( "changeDeserialized" , e => {
62+ if ( e . getData ( ) ) {
63+ studyReady ( ) ;
64+ }
65+ } , this ) ;
66+ }
4767 } ,
4868
4969 popUpPreview : function ( studyData ) {
5070 if ( "services" in studyData ) {
5171 this . __popUpPreview ( studyData ) ;
5272 } else {
53- osparc . store . Services . getStudyServices ( studyData )
73+ osparc . store . Services . getStudyServices ( studyData [ "uuid" ] )
5474 . then ( resp => {
5575 const services = resp [ "services" ] ;
5676 studyData [ "services" ] = services ;
0 commit comments