@@ -90,22 +90,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
9090 }
9191 } ,
9292
93- statics : {
94- sortFoldersList : function ( foldersList , propKey ) {
95- const sortByProperty = prop => {
96- return function ( a , b ) {
97- const upKey = qx . lang . String . firstUp ( prop ) ;
98- const getter = "get" + upKey ;
99- if ( getter in a && getter in b ) {
100- return b [ getter ] ( ) - a [ getter ] ( ) ;
101- }
102- return 0 ;
103- } ;
104- } ;
105- foldersList . sort ( sortByProperty ( propKey || "lastModified" ) ) ;
106- }
107- } ,
108-
10993 members : {
11094 __dontShowTutorial : null ,
11195 __header : null ,
@@ -421,11 +405,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
421405 } ,
422406
423407 __addNewFolderButton : function ( ) {
408+ if ( this . getCurrentContext ( ) !== "studiesAndFolders" ) {
409+ return ;
410+ }
424411 const currentWorkspaceId = this . getCurrentWorkspaceId ( ) ;
425412 if ( currentWorkspaceId ) {
426- if ( this . getCurrentContext ( ) !== "studiesAndFolders" ) {
427- return ;
428- }
429413 const currentWorkspace = osparc . store . Workspaces . getInstance ( ) . getWorkspace ( this . getCurrentWorkspaceId ( ) ) ;
430414 if ( currentWorkspace && ! currentWorkspace . getMyAccessRights ( ) [ "write" ] ) {
431415 // If user can't write in workspace, do not show plus button
@@ -1276,6 +1260,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
12761260 menu . add ( openButton ) ;
12771261 }
12781262
1263+ if ( this . getCurrentContext ( ) === "search" ) {
1264+ const renameStudyButton = this . __getOpenLocationMenuButton ( studyData ) ;
1265+ menu . add ( renameStudyButton ) ;
1266+ }
1267+
12791268 if ( writeAccess ) {
12801269 const renameStudyButton = this . __getRenameStudyMenuButton ( studyData ) ;
12811270 menu . add ( renameStudyButton ) ;
@@ -1339,6 +1328,14 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
13391328 card . evaluateMenuButtons ( ) ;
13401329 } ,
13411330
1331+ __getOpenLocationMenuButton : function ( studyData ) {
1332+ const openLocationButton = new qx . ui . menu . Button ( this . tr ( "Open location" ) , "@FontAwesome5Solid/external-link-alt/12" ) ;
1333+ openLocationButton . addListener ( "execute" , ( ) => {
1334+ this . __changeContext ( "studiesAndFolders" , studyData [ "workspaceId" ] , studyData [ "folderId" ] ) ;
1335+ } , this ) ;
1336+ return openLocationButton ;
1337+ } ,
1338+
13421339 __getRenameStudyMenuButton : function ( studyData ) {
13431340 const renameButton = new qx . ui . menu . Button ( this . tr ( "Rename..." ) , "@FontAwesome5Solid/pencil-alt/12" ) ;
13441341 renameButton . addListener ( "execute" , ( ) => {
0 commit comments