@@ -166,9 +166,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
166166 __reloadWorkspaces : function ( ) {
167167 if (
168168 ! osparc . auth . Manager . getInstance ( ) . isLoggedIn ( ) ||
169- ! osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ||
170169 this . getCurrentContext ( ) === "studiesAndFolders" ||
171- this . getCurrentContext ( ) === "search" || // not yet implemented for workspaces
172170 this . __loadingWorkspaces
173171 ) {
174172 return ;
@@ -179,7 +177,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
179177 case "search" : {
180178 const filterData = this . _searchBarFilter . getFilterData ( ) ;
181179 const text = filterData . text ? encodeURIComponent ( filterData . text ) : "" ;
182- request = osparc . store . Workspaces . getInstance ( ) . searchWorkspaces ( text ) ;
180+ request = osparc . store . Workspaces . getInstance ( ) . searchWorkspaces ( text , this . getOrderBy ( ) ) ;
183181 break ;
184182 }
185183 case "workspaces" : {
@@ -212,7 +210,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
212210 __reloadFolders : function ( ) {
213211 if (
214212 ! osparc . auth . Manager . getInstance ( ) . isLoggedIn ( ) ||
215- ! osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ||
216213 this . getCurrentContext ( ) === "workspaces" ||
217214 this . __loadingFolders
218215 ) {
@@ -991,11 +988,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
991988 _createLayout : function ( ) {
992989 this . _createSearchBar ( ) ;
993990
994- if ( osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ) {
995- const header = this . __header = new osparc . dashboard . StudyBrowserHeader ( ) ;
996- this . __header . addListener ( "emptyTrashRequested" , ( ) => this . __emptyTrash ( ) , this ) ;
997- this . _addToLayout ( header ) ;
998- }
991+ const header = this . __header = new osparc . dashboard . StudyBrowserHeader ( ) ;
992+ this . __header . addListener ( "emptyTrashRequested" , ( ) => this . __emptyTrash ( ) , this ) ;
993+ this . _addToLayout ( header ) ;
999994
1000995 this . _createResourcesLayout ( "studiesList" ) ;
1001996
@@ -1069,112 +1064,108 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
10691064 } ,
10701065
10711066 __connectContexts : function ( ) {
1072- if ( osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ) {
1073- const header = this . __header ;
1074- header . addListener ( "locationChanged" , ( ) => {
1075- const workspaceId = header . getCurrentWorkspaceId ( ) ;
1076- const folderId = header . getCurrentFolderId ( ) ;
1077- this . _changeContext ( "studiesAndFolders" , workspaceId , folderId ) ;
1078- } , this ) ;
1067+ const header = this . __header ;
1068+ header . addListener ( "locationChanged" , ( ) => {
1069+ const workspaceId = header . getCurrentWorkspaceId ( ) ;
1070+ const folderId = header . getCurrentFolderId ( ) ;
1071+ this . _changeContext ( "studiesAndFolders" , workspaceId , folderId ) ;
1072+ } , this ) ;
10791073
1080- const workspacesAndFoldersTree = this . _resourceFilter . getWorkspacesAndFoldersTree ( ) ;
1081- workspacesAndFoldersTree . addListener ( "locationChanged" , e => {
1082- const context = e . getData ( ) ;
1083- const workspaceId = context [ "workspaceId" ] ;
1084- if ( workspaceId === - 1 ) {
1085- this . _changeContext ( "workspaces" ) ;
1086- } else {
1087- const folderId = context [ "folderId" ] ;
1088- this . _changeContext ( "studiesAndFolders" , workspaceId , folderId ) ;
1089- }
1090- } , this ) ;
1074+ const workspacesAndFoldersTree = this . _resourceFilter . getWorkspacesAndFoldersTree ( ) ;
1075+ workspacesAndFoldersTree . addListener ( "locationChanged" , e => {
1076+ const context = e . getData ( ) ;
1077+ const workspaceId = context [ "workspaceId" ] ;
1078+ if ( workspaceId === - 1 ) {
1079+ this . _changeContext ( "workspaces" ) ;
1080+ } else {
1081+ const folderId = context [ "folderId" ] ;
1082+ this . _changeContext ( "studiesAndFolders" , workspaceId , folderId ) ;
1083+ }
1084+ } , this ) ;
10911085
1092- this . _resourceFilter . addListener ( "trashContext" , ( ) => {
1093- this . _changeContext ( "trash" ) ;
1094- } ) ;
1086+ this . _resourceFilter . addListener ( "trashContext" , ( ) => {
1087+ this . _changeContext ( "trash" ) ;
1088+ } ) ;
10951089
1096- this . _searchBarFilter . addListener ( "filterChanged" , e => {
1097- const filterData = e . getData ( ) ;
1098- if ( filterData . text ) {
1099- this . _changeContext ( "search" ) ;
1100- } else {
1101- const workspaceId = this . getCurrentWorkspaceId ( ) ;
1102- const folderId = this . getCurrentFolderId ( ) ;
1103- this . _changeContext ( "studiesAndFolders" , workspaceId , folderId ) ;
1104- }
1105- } ) ;
1106- }
1090+ this . _searchBarFilter . addListener ( "filterChanged" , e => {
1091+ const filterData = e . getData ( ) ;
1092+ if ( filterData . text ) {
1093+ this . _changeContext ( "search" ) ;
1094+ } else {
1095+ const workspaceId = this . getCurrentWorkspaceId ( ) ;
1096+ const folderId = this . getCurrentFolderId ( ) ;
1097+ this . _changeContext ( "studiesAndFolders" , workspaceId , folderId ) ;
1098+ }
1099+ } ) ;
11071100 } ,
11081101
11091102 _changeContext : function ( context , workspaceId = null , folderId = null ) {
1110- if ( osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ) {
1111- if (
1112- context !== "search" && // reload studies for a new search
1113- context === this . getCurrentContext ( ) &&
1114- workspaceId === this . getCurrentWorkspaceId ( ) &&
1115- folderId === this . getCurrentFolderId ( )
1116- ) {
1117- // didn't really change
1118- return ;
1119- }
1120-
1121- osparc . store . Store . getInstance ( ) . setStudyBrowserContext ( context ) ;
1122- this . set ( {
1123- currentContext : context ,
1124- currentWorkspaceId : workspaceId ,
1125- currentFolderId : folderId ,
1126- } ) ;
1127- this . resetSelection ( ) ;
1128- this . setMultiSelection ( false ) ;
1103+ if (
1104+ context !== "search" && // reload studies for a new search
1105+ context === this . getCurrentContext ( ) &&
1106+ workspaceId === this . getCurrentWorkspaceId ( ) &&
1107+ folderId === this . getCurrentFolderId ( )
1108+ ) {
1109+ // didn't really change
1110+ return ;
1111+ }
11291112
1130- // reset lists
1131- this . __setWorkspacesToList ( [ ] ) ;
1132- this . __setFoldersToList ( [ ] ) ;
1133- this . _resourcesList = [ ] ;
1134- this . _resourcesContainer . setResourcesToList ( this . _resourcesList ) ;
1135- this . _resourcesContainer . reloadCards ( "studies" ) ;
1136-
1137- this . _toolbar . show ( ) ;
1138- switch ( this . getCurrentContext ( ) ) {
1139- case "studiesAndFolders" :
1140- this . _searchBarFilter . resetFilters ( ) ;
1141- this . __reloadFolders ( ) ;
1142- this . _loadingResourcesBtn . setFetching ( false ) ;
1143- this . invalidateStudies ( ) ;
1144- this . __reloadStudies ( ) ;
1145- break ;
1146- case "workspaces" :
1147- this . _toolbar . exclude ( ) ;
1148- this . _searchBarFilter . resetFilters ( ) ;
1149- this . __reloadWorkspaces ( ) ;
1150- break ;
1151- case "search" :
1152- this . __reloadWorkspaces ( ) ;
1153- this . __reloadFolders ( ) ;
1154- this . _loadingResourcesBtn . setFetching ( false ) ;
1155- this . invalidateStudies ( ) ;
1156- this . __reloadStudies ( ) ;
1157- break ;
1158- case "trash" :
1159- this . _searchBarFilter . resetFilters ( ) ;
1160- this . __reloadWorkspaces ( ) ;
1161- this . __reloadFolders ( ) ;
1162- this . _loadingResourcesBtn . setFetching ( false ) ;
1163- this . invalidateStudies ( ) ;
1164- this . __reloadStudies ( ) ;
1165- break ;
1166- }
1113+ osparc . store . Store . getInstance ( ) . setStudyBrowserContext ( context ) ;
1114+ this . set ( {
1115+ currentContext : context ,
1116+ currentWorkspaceId : workspaceId ,
1117+ currentFolderId : folderId ,
1118+ } ) ;
1119+ this . resetSelection ( ) ;
1120+ this . setMultiSelection ( false ) ;
11671121
1168- // notify header
1169- const header = this . __header ;
1170- header . set ( {
1171- currentWorkspaceId : workspaceId ,
1172- currentFolderId : folderId ,
1173- } ) ;
1122+ // reset lists
1123+ this . __setWorkspacesToList ( [ ] ) ;
1124+ this . __setFoldersToList ( [ ] ) ;
1125+ this . _resourcesList = [ ] ;
1126+ this . _resourcesContainer . setResourcesToList ( this . _resourcesList ) ;
1127+ this . _resourcesContainer . reloadCards ( "studies" ) ;
11741128
1175- // notify Filters on the left
1176- this . _resourceFilter . contextChanged ( context , workspaceId , folderId ) ;
1129+ this . _toolbar . show ( ) ;
1130+ switch ( this . getCurrentContext ( ) ) {
1131+ case "studiesAndFolders" :
1132+ this . _searchBarFilter . resetFilters ( ) ;
1133+ this . __reloadFolders ( ) ;
1134+ this . _loadingResourcesBtn . setFetching ( false ) ;
1135+ this . invalidateStudies ( ) ;
1136+ this . __reloadStudies ( ) ;
1137+ break ;
1138+ case "workspaces" :
1139+ this . _toolbar . exclude ( ) ;
1140+ this . _searchBarFilter . resetFilters ( ) ;
1141+ this . __reloadWorkspaces ( ) ;
1142+ break ;
1143+ case "search" :
1144+ this . __reloadWorkspaces ( ) ;
1145+ this . __reloadFolders ( ) ;
1146+ this . _loadingResourcesBtn . setFetching ( false ) ;
1147+ this . invalidateStudies ( ) ;
1148+ this . __reloadStudies ( ) ;
1149+ break ;
1150+ case "trash" :
1151+ this . _searchBarFilter . resetFilters ( ) ;
1152+ this . __reloadWorkspaces ( ) ;
1153+ this . __reloadFolders ( ) ;
1154+ this . _loadingResourcesBtn . setFetching ( false ) ;
1155+ this . invalidateStudies ( ) ;
1156+ this . __reloadStudies ( ) ;
1157+ break ;
11771158 }
1159+
1160+ // notify header
1161+ const header = this . __header ;
1162+ header . set ( {
1163+ currentWorkspaceId : workspaceId ,
1164+ currentFolderId : folderId ,
1165+ } ) ;
1166+
1167+ // notify Filters on the left
1168+ this . _resourceFilter . contextChanged ( context , workspaceId , folderId ) ;
11781169 } ,
11791170
11801171 __addSortByButton : function ( ) {
@@ -1560,13 +1551,11 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
15601551 menu . add ( billingsSettingsButton ) ;
15611552 }
15621553
1563- if ( writeAccess && osparc . utils . DisabledPlugins . isFoldersEnabled ( ) ) {
1564- menu . addSeparator ( ) ;
1554+ menu . addSeparator ( ) ;
15651555
1566- const moveToButton = this . __getMoveStudyToMenuButton ( studyData ) ;
1567- if ( moveToButton ) {
1568- menu . add ( moveToButton ) ;
1569- }
1556+ const moveToButton = this . __getMoveStudyToMenuButton ( studyData ) ;
1557+ if ( moveToButton ) {
1558+ menu . add ( moveToButton ) ;
15701559 }
15711560
15721561 if ( deleteAccess ) {
0 commit comments