@@ -144,12 +144,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
144144 } ,
145145
146146 __getActiveStudy : function ( ) {
147- const params = {
148- url : {
149- tabId : osparc . utils . Utils . getClientSessionID ( )
150- }
151- } ;
152- return osparc . data . Resources . fetch ( "studies" , "getActive" , params )
147+ return osparc . store . Study . getInstance ( ) . getActive ( osparc . utils . Utils . getClientSessionID ( ) )
153148 . then ( studyData => {
154149 if ( studyData ) {
155150 osparc . store . Store . getInstance ( ) . setCurrentStudyId ( studyData [ "uuid" ] ) ;
@@ -406,12 +401,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
406401 const delay = 2000 ;
407402 const studyId = study [ "uuid" ] ;
408403 setTimeout ( ( ) => {
409- const params = {
410- url : {
411- studyId
412- }
413- } ;
414- osparc . data . Resources . fetch ( "studies" , "getOne" , params )
404+ osparc . store . Study . getInstance ( ) . getOne ( studyId )
415405 . then ( studyData => {
416406 this . __studyStateReceived ( study [ "uuid" ] , studyData [ "state" ] ) ;
417407 } ) ;
@@ -911,18 +901,18 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
911901 let request = null ;
912902 switch ( this . getCurrentContext ( ) ) {
913903 case osparc . dashboard . StudyBrowser . CONTEXT . PROJECTS :
914- request = osparc . data . Resources . fetch ( "studies" , " getPage" , params , options ) ;
904+ request = osparc . store . Study . getInstance ( ) . getPage ( params , options ) ;
915905 break ;
916906 case osparc . dashboard . StudyBrowser . CONTEXT . TEMPLATES :
917907 case osparc . dashboard . StudyBrowser . CONTEXT . PUBLIC_TEMPLATES :
918908 // The distinction is done in the frontend
919909 request = osparc . store . Templates . fetchTemplatesPaginated ( params , options ) ;
920910 break ;
921911 case osparc . dashboard . StudyBrowser . CONTEXT . TRASH :
922- request = osparc . data . Resources . fetch ( "studies" , " getPageTrashed" , params , options ) ;
912+ request = osparc . store . Study . getInstance ( ) . getPageTrashed ( params , options ) ;
923913 break ;
924914 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_PROJECTS :
925- request = osparc . data . Resources . fetch ( "studies" , " getPageSearch" , params , options ) ;
915+ request = osparc . store . Study . getInstance ( ) . getPageSearch ( params , options ) ;
926916 break ;
927917 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_TEMPLATES :
928918 case osparc . dashboard . StudyBrowser . CONTEXT . SEARCH_PUBLIC_TEMPLATES :
@@ -1600,12 +1590,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
16001590 const openCB = ( ) => this . _hideLoadingPage ( ) ;
16011591 const cancelCB = ( ) => {
16021592 this . _hideLoadingPage ( ) ;
1603- const params = {
1604- url : {
1605- studyId
1606- }
1607- } ;
1608- osparc . data . Resources . fetch ( "studies" , "delete" , params ) ;
1593+ osparc . store . Study . getInstance ( ) . deleteStudy ( studyId ) ;
16091594 } ;
16101595 const isStudyCreation = true ;
16111596 this . _startStudyById ( studyId , openCB , cancelCB , isStudyCreation ) ;
@@ -1794,13 +1779,13 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
17941779 } ,
17951780
17961781 __updateName : function ( studyData , name ) {
1797- osparc . store . Study . patchStudyData ( studyData , "name" , name )
1782+ osparc . store . Study . getInstance ( ) . patchStudyData ( studyData , "name" , name )
17981783 . then ( ( ) => this . _updateStudyData ( studyData ) )
17991784 . catch ( err => osparc . FlashMessenger . logError ( err , this . tr ( "Something went wrong while renaming" ) ) ) ;
18001785 } ,
18011786
18021787 __updateThumbnail : function ( studyData , url ) {
1803- osparc . store . Study . patchStudyData ( studyData , "thumbnail" , url )
1788+ osparc . store . Study . getInstance ( ) . patchStudyData ( studyData , "thumbnail" , url )
18041789 . then ( ( ) => this . _updateStudyData ( studyData ) )
18051790 . catch ( err => osparc . FlashMessenger . logError ( err , this . tr ( "Something went wrong while updating the thumbnail" ) ) ) ;
18061791 } ,
@@ -1867,13 +1852,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
18671852 // resolve right away
18681853 return new Promise ( resolve => resolve ( ) ) ;
18691854 }
1870- const params = {
1871- url : {
1872- studyId : studyData [ "uuid" ] ,
1873- workspaceId : destWorkspaceId ,
1874- }
1875- } ;
1876- return osparc . data . Resources . fetch ( "studies" , "moveToWorkspace" , params )
1855+ return osparc . store . Study . getInstance ( ) . moveStudyToWorkspace ( studyData [ "uuid" ] , destWorkspaceId )
18771856 . then ( ( ) => studyData [ "workspaceId" ] = destWorkspaceId ) ;
18781857 } ,
18791858
@@ -1882,13 +1861,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
18821861 // resolve right away
18831862 return new Promise ( resolve => resolve ( ) ) ;
18841863 }
1885- const params = {
1886- url : {
1887- studyId : studyData [ "uuid" ] ,
1888- folderId : destFolderId ,
1889- }
1890- } ;
1891- return osparc . data . Resources . fetch ( "studies" , "moveToFolder" , params )
1864+ return osparc . store . Study . getInstance ( ) . moveStudyToFolder ( studyData [ "uuid" ] , destFolderId )
18921865 . then ( ( ) => studyData [ "folderId" ] = destFolderId ) ;
18931866 } ,
18941867
@@ -1949,7 +1922,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
19491922 __updateUIMode : function ( studyData , uiMode ) {
19501923 const studyUI = osparc . utils . Utils . deepCloneObject ( studyData [ "ui" ] ) ;
19511924 studyUI [ "mode" ] = uiMode ;
1952- return osparc . store . Study . patchStudyData ( studyData , "ui" , studyUI )
1925+ return osparc . store . Study . getInstance ( ) . patchStudyData ( studyData , "ui" , studyUI )
19531926 . then ( ( ) => this . _updateStudyData ( studyData ) )
19541927 } ,
19551928
@@ -2114,12 +2087,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21142087 importTaskUI . setSubtitle ( processingLabel ) ;
21152088 importingStudyCard . getChildControl ( "progress-bar" ) . exclude ( ) ;
21162089 const data = JSON . parse ( req . responseText ) ;
2117- const params = {
2118- url : {
2119- "studyId" : data [ "data" ] [ "uuid" ]
2120- }
2121- } ;
2122- osparc . data . Resources . fetch ( "studies" , "getOne" , params )
2090+ osparc . store . Study . getInstance ( ) . getOne ( data [ "data" ] [ "uuid" ] )
21232091 . then ( studyData => this . _updateStudyData ( studyData ) )
21242092 . catch ( err => osparc . FlashMessenger . logError ( err , this . tr ( "Something went wrong while fetching the study" ) ) )
21252093 . finally ( ( ) => {
@@ -2148,7 +2116,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21482116 } ,
21492117
21502118 __untrashStudy : function ( studyData ) {
2151- osparc . store . Store . getInstance ( ) . untrashStudy ( studyData . uuid )
2119+ osparc . store . Study . getInstance ( ) . untrashStudy ( studyData . uuid )
21522120 . then ( ( ) => {
21532121 this . __removeFromStudyList ( studyData . uuid ) ;
21542122 const msg = this . tr ( "Successfully restored" ) ;
@@ -2160,7 +2128,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21602128 } ,
21612129
21622130 __trashStudy : function ( studyData ) {
2163- osparc . store . Store . getInstance ( ) . trashStudy ( studyData . uuid )
2131+ osparc . store . Study . getInstance ( ) . trashStudy ( studyData . uuid )
21642132 . then ( ( ) => {
21652133 this . __removeFromStudyList ( studyData . uuid ) ;
21662134 const msg = this . tr ( "Successfully deleted" ) ;
@@ -2188,7 +2156,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21882156 // remove me from collaborators
21892157 const myGid = osparc . auth . Data . getInstance ( ) . getGroupId ( ) ;
21902158 delete arCopy [ myGid ] ;
2191- return osparc . store . Study . patchStudyData ( studyData , "accessRights" , arCopy ) ;
2159+ return osparc . store . Study . getInstance ( ) . patchStudyData ( studyData , "accessRights" , arCopy ) ;
21922160 } ,
21932161
21942162 __doDeleteStudy : function ( studyData ) {
@@ -2197,7 +2165,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
21972165 operationPromise = this . __removeMeFromCollaborators ( studyData ) ;
21982166 } else {
21992167 // delete study
2200- operationPromise = osparc . store . Store . getInstance ( ) . deleteStudy ( studyData . uuid ) ;
2168+ operationPromise = osparc . store . Study . getInstance ( ) . deleteStudy ( studyData . uuid ) ;
22012169 }
22022170 operationPromise
22032171 . then ( ( ) => this . __removeFromStudyList ( studyData . uuid ) )
0 commit comments