File tree Expand file tree Collapse file tree 3 files changed +17
-22
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 3 files changed +17
-22
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
177177 return ;
178178 }
179179 this . __setFoldersToList ( [ ] ) ;
180- osparc . store . Folders . getInstance ( ) . fetchFolders ( folderId , workspaceId )
180+ osparc . store . Folders . getInstance ( ) . fetchFolders ( folderId , workspaceId , this . getOrderBy ( ) )
181181 . then ( folders => {
182182 this . __setFoldersToList ( folders ) ;
183183 } )
@@ -317,24 +317,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
317317 __setFoldersToList : function ( folders ) {
318318 this . __foldersList = folders ;
319319 folders . forEach ( folder => folder [ "resourceType" ] = "folder" ) ;
320-
321- const sortByValueBE = this . getOrderBy ( ) . field ;
322- let sortByValue = null ;
323- switch ( sortByValueBE ) {
324- case "name" :
325- sortByValue = "name" ;
326- break ;
327- case "prj_owner" :
328- sortByValue = "owner" ;
329- break ;
330- case "creation_date" :
331- sortByValue = "createdAt" ;
332- break ;
333- case "last_change_date" :
334- sortByValue = "lastModified" ;
335- break ;
336- }
337- this . self ( ) . sortFoldersList ( this . __foldersList , sortByValue ) ;
338320 this . __reloadFolderCards ( ) ;
339321 } ,
340322
Original file line number Diff line number Diff line change @@ -299,7 +299,7 @@ qx.Class.define("osparc.data.Resources", {
299299 endpoints : {
300300 getPage : {
301301 method : "GET" ,
302- url : statics . API + "/folders?workspace_id={workspaceId}&folder_id={folderId}&offset={offset}&limit={limit}"
302+ url : statics . API + "/folders?workspace_id={workspaceId}&folder_id={folderId}&offset={offset}&limit={limit}&order_by={orderBy} "
303303 } ,
304304 getOne : {
305305 method : "GET" ,
Original file line number Diff line number Diff line change @@ -34,17 +34,30 @@ qx.Class.define("osparc.store.Folders", {
3434 members : {
3535 foldersCached : null ,
3636
37- fetchFolders : function ( folderId = null , workspaceId = null ) {
37+ fetchFolders : function (
38+ folderId = null ,
39+ workspaceId = null ,
40+ orderBy = {
41+ field : "modified_at" ,
42+ direction : "desc"
43+ }
44+ ) {
3845 if ( osparc . auth . Data . getInstance ( ) . isGuest ( ) ) {
3946 return new Promise ( resolve => {
4047 resolve ( [ ] ) ;
4148 } ) ;
4249 }
4350
51+ const curatedOrderBy = osparc . utils . Utils . deepCloneObject ( orderBy ) ;
52+ if ( curatedOrderBy . field !== "name" ) {
53+ curatedOrderBy . field = "modified_at" ;
54+ }
55+
4456 const params = {
45- " url" : {
57+ url : {
4658 workspaceId,
4759 folderId,
60+ orderBy : JSON . stringify ( curatedOrderBy ) ,
4861 }
4962 } ;
5063 return osparc . data . Resources . getInstance ( ) . getAllPages ( "folders" , params )
You can’t perform that action at this time.
0 commit comments