@@ -53,16 +53,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
5353 check : "Number" ,
5454 nullable : true ,
5555 init : null ,
56- event : "changeCurrentWorkspaceId" ,
57- apply : "__applyCurrentWorkspaceId"
56+ event : "changeCurrentWorkspaceId"
5857 } ,
5958
6059 currentFolderId : {
6160 check : "Number" ,
6261 nullable : true ,
6362 init : null ,
64- event : "changeCurrentFolderId" ,
65- apply : "__resetAndReloadAll"
63+ event : "changeCurrentFolderId"
6664 } ,
6765
6866 multiSelection : {
@@ -105,7 +103,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
105103 __currentRequest : null ,
106104 __workspacesList : null ,
107105 __foldersList : null ,
108- __reloadFoldersAndStudiesTimeout : null ,
109106
110107 // overridden
111108 initResources : function ( ) {
@@ -121,6 +118,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
121118 const isStudyCreation = false ;
122119 this . _startStudyById ( loadStudyId , null , cancelCB , isStudyCreation ) ;
123120 } else {
121+ this . __reloadFolders ( ) ;
124122 this . reloadResources ( ) ;
125123 }
126124 // "Starting..." page
@@ -400,18 +398,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
400398 osparc . filter . UIFilterController . dispatch ( "searchBarFilter" ) ;
401399 } ,
402400
403- __applyCurrentWorkspaceId : function ( workspaceId ) {
404- if ( osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ) {
405- if ( workspaceId === - 1 ) {
406- this . _resourcesContainer . setResourcesToList ( [ ] ) ;
407- this . _resourcesList = [ ] ;
408- this . __reloadWorkspaces ( ) ;
409- } else {
410- this . __resetAndReloadAll ( ) ;
411- }
412- }
413- } ,
414-
415401 // WORKSPACES
416402 __reloadWorkspaceCards : function ( ) {
417403 this . _resourcesContainer . setWorkspacesToList ( this . __workspacesList ) ;
@@ -450,26 +436,21 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
450436 } ,
451437 // /WORKSPACES
452438
453- __resetAndReloadAll : function ( ) {
439+ _changeContext : function ( workspaceId , folderId ) {
454440 if ( osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ) {
455- const workspaceId = this . getCurrentWorkspaceId ( ) ;
456- if ( workspaceId === - 1 ) {
457- return ;
458- }
459-
441+ this . set ( {
442+ currentWorkspaceId : workspaceId ,
443+ currentFolderId : folderId ,
444+ } ) ;
460445 this . _resourcesContainer . setResourcesToList ( [ ] ) ;
461446 this . _resourcesList = [ ] ;
462- this . invalidateStudies ( ) ;
463447
464- // It can be triggered by a change of context: workspace and folder,
465- // delay it to make just one call
466- if ( this . __reloadFoldersAndStudiesTimeout ) {
467- clearTimeout ( this . __reloadFoldersAndStudiesTimeout ) ;
468- }
469- this . __reloadFoldersAndStudiesTimeout = setTimeout ( ( ) => {
470- this . __reloadFoldersAndStudiesTimeout = null ;
448+ if ( workspaceId === - 1 ) {
449+ this . __reloadWorkspaces ( ) ;
450+ } else {
451+ this . invalidateStudies ( ) ;
471452 this . __reloadFoldersAndStudies ( ) ;
472- } , 50 ) ;
453+ }
473454 }
474455 } ,
475456
@@ -502,6 +483,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
502483
503484 _folderSelected : function ( folderId ) {
504485 this . setCurrentFolderId ( folderId ) ;
486+ this . _changeContext ( this . getCurrentWorkspaceId ( ) , folderId ) ;
505487 } ,
506488
507489 _folderUpdated : function ( ) {
@@ -543,6 +525,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
543525 } ,
544526
545527 _moveFolderToWorkspaceRequested : function ( folderId ) {
528+ const folderToWorkspaceRequested = false ;
529+ if ( ! folderToWorkspaceRequested ) {
530+ const msg = this . tr ( "Coming soon" ) ;
531+ osparc . FlashMessenger . getInstance ( ) . logAs ( msg , "WARNING" ) ;
532+ return ;
533+ }
546534 const moveFolderToWorkspace = new osparc . dashboard . MoveResourceToWorkspace ( this . getCurrentWorkspaceId ( ) ) ;
547535 const title = "Move to Workspace" ;
548536 const win = osparc . ui . window . Window . popUpInWindow ( moveFolderToWorkspace , title , 350 , 280 ) ;
@@ -573,7 +561,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
573561 } ,
574562
575563 _deleteFolderRequested : function ( folderId ) {
576- osparc . store . Folders . getInstance ( ) . deleteFolder ( folderId )
564+ osparc . store . Folders . getInstance ( ) . deleteFolder ( folderId , this . getCurrentWorkspaceId ( ) )
577565 . then ( ( ) => this . __reloadFolders ( ) )
578566 . catch ( err => console . error ( err ) ) ;
579567 } ,
@@ -882,7 +870,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
882870 onUpdate : ( ) => containerHeader . setCurrentFolderId ( null )
883871 } ) ;
884872 this . bind ( "currentFolderId" , containerHeader , "currentFolderId" ) ;
885- containerHeader . bind ( "currentFolderId" , this , "currentFolderId" ) ;
873+ containerHeader . bind ( "currentFolderId" , this , "currentFolderId" , {
874+ onUpdate : ( ) => this . _changeContext ( this . getCurrentWorkspaceId ( ) , this . getCurrentFolderId ( ) )
875+ } ) ;
886876 }
887877 const list = this . _resourcesContainer . getFlatList ( ) ;
888878 if ( list ) {
0 commit comments