File tree Expand file tree Collapse file tree 4 files changed +38
-15
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 4 files changed +38
-15
lines changed Original file line number Diff line number Diff line change @@ -635,6 +635,17 @@ qx.Class.define("osparc.data.model.Study", {
635635 return ! this . getUi ( ) . getSlideshow ( ) . isEmpty ( ) ;
636636 } ,
637637
638+ sendMessageToIframe : function ( nodeId , msg ) {
639+ if ( nodeId ) {
640+ const node = this . getWorkbench ( ) . getNode ( nodeId ) ;
641+ if ( node && node . getIFrame ( ) ) {
642+ node . getIFrame ( ) . sendMessageToIframe ( msg ) ;
643+ return true ;
644+ }
645+ }
646+ return false ;
647+ } ,
648+
638649 patchStudy : function ( studyChanges ) {
639650 const matches = this . self ( ) . OwnPatch . filter ( el => Object . keys ( studyChanges ) . indexOf ( el ) !== - 1 ) ;
640651 if ( matches . length ) {
Original file line number Diff line number Diff line change @@ -92,5 +92,17 @@ qx.Class.define("osparc.vipMarket.Market", {
9292 }
9393 return false ;
9494 } ,
95+
96+ sendCloseMessage : function ( ) {
97+ const store = osparc . store . Store . getInstance ( ) ;
98+ const currentStudy = store . getCurrentStudy ( ) ;
99+ const nodeId = this . getOpenBy ( ) ;
100+ if ( currentStudy && nodeId ) {
101+ const msg = {
102+ "type" : "closeMarket" ,
103+ } ;
104+ currentStudy . sendMessageToIframe ( nodeId , msg ) ;
105+ }
106+ } ,
95107 }
96108} ) ;
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ qx.Class.define("osparc.vipMarket.MarketWindow", {
4141 if ( osparc . product . Utils . showS4LStore ( ) ) {
4242 const storeWindow = new osparc . vipMarket . MarketWindow ( nodeId , category ) ;
4343 storeWindow . getVipMarket ( ) . addListener ( "importMessageSent" , ( ) => storeWindow . close ( ) ) ;
44+ storeWindow . addListenerOnce ( "close" , ( ) => {
45+ if ( storeWindow . getVipMarket ( ) ) {
46+ storeWindow . getVipMarket ( ) . sendCloseMessage ( ) ;
47+ }
48+ } ) ;
4449 storeWindow . center ( ) ;
4550 storeWindow . open ( ) ;
4651 return storeWindow ;
Original file line number Diff line number Diff line change @@ -361,22 +361,17 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
361361 } ,
362362
363363 __sendImportModelMessage : function ( modelId ) {
364+ const store = osparc . store . Store . getInstance ( ) ;
365+ const currentStudy = store . getCurrentStudy ( ) ;
364366 const nodeId = this . getOpenBy ( ) ;
365- if ( nodeId ) {
366- const store = osparc . store . Store . getInstance ( ) ;
367- const currentStudy = store . getCurrentStudy ( ) ;
368- if ( ! currentStudy ) {
369- return ;
370- }
371- const node = currentStudy . getWorkbench ( ) . getNode ( nodeId ) ;
372- if ( node && node . getIFrame ( ) ) {
373- const msg = {
374- "type" : "importModel" ,
375- "message" : {
376- "modelId" : modelId ,
377- } ,
378- } ;
379- node . getIFrame ( ) . sendMessageToIframe ( msg ) ;
367+ if ( currentStudy && nodeId ) {
368+ const msg = {
369+ "type" : "importModel" ,
370+ "message" : {
371+ "modelId" : modelId ,
372+ } ,
373+ } ;
374+ if ( currentStudy . sendMessageToIframe ( nodeId , msg ) ) {
380375 this . fireEvent ( "importMessageSent" ) ;
381376 }
382377 }
You can’t perform that action at this time.
0 commit comments