File tree 6 files changed +47
-15
lines changed
services/static-webserver/client/source/class/osparc
6 files changed +47
-15
lines changed Original file line number Diff line number Diff line change @@ -209,17 +209,10 @@ qx.Class.define("osparc.Application", {
209
209
} ,
210
210
211
211
__updateTabName : function ( ) {
212
- const platformName = osparc . store . StaticInfo . getInstance ( ) . getPlatformName ( ) ;
213
- if ( osparc . utils . Utils . isInZ43 ( ) ) {
214
- document . title += " Z43" ;
215
- }
216
- if ( platformName ) {
217
- document . title += ` (${ platformName } )` ;
218
- }
212
+ const newName = osparc . utils . Utils . composeTabName ( ) ;
213
+ osparc . utils . Utils . updateTabName ( newName ) ;
219
214
} ,
220
215
221
-
222
-
223
216
__setDeviceSpecificIcons : function ( ) {
224
217
const isIOS = / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! window . MSStream ;
225
218
const isAndroid = / a n d r o i d / i. test ( navigator . userAgent ) ;
Original file line number Diff line number Diff line change @@ -167,7 +167,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
167
167
if (
168
168
! osparc . auth . Manager . getInstance ( ) . isLoggedIn ( ) ||
169
169
this . getCurrentContext ( ) === "studiesAndFolders" ||
170
- this . getCurrentContext ( ) === "search" || // not yet implemented for workspaces
171
170
this . __loadingWorkspaces
172
171
) {
173
172
return ;
@@ -178,7 +177,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
178
177
case "search" : {
179
178
const filterData = this . _searchBarFilter . getFilterData ( ) ;
180
179
const text = filterData . text ? encodeURIComponent ( filterData . text ) : "" ;
181
- request = osparc . store . Workspaces . getInstance ( ) . searchWorkspaces ( text ) ;
180
+ request = osparc . store . Workspaces . getInstance ( ) . searchWorkspaces ( text , this . getOrderBy ( ) ) ;
182
181
break ;
183
182
}
184
183
case "workspaces" : {
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ qx.Class.define("osparc.data.Resources", {
368
368
getPageSearch : {
369
369
useCache : false ,
370
370
method : "GET" ,
371
- url : statics . API + "/workspaces:search ?offset={offset}&limit={limit}&text={text }&order_by={orderBy}"
371
+ url : statics . API + "/workspaces?offset={offset}&limit={limit}&filters={filters }&order_by={orderBy}"
372
372
} ,
373
373
getPageTrashed : {
374
374
useCache : false ,
Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ qx.Class.define("osparc.store.Store", {
59
59
check : "osparc.data.model.Study" ,
60
60
init : null ,
61
61
nullable : true ,
62
- event : "changeCurrentStudy"
62
+ event : "changeCurrentStudy" ,
63
+ apply : "__applyCurrentStudy" ,
63
64
} ,
64
65
currentStudyId : {
65
66
check : "String" ,
@@ -334,6 +335,21 @@ qx.Class.define("osparc.store.Store", {
334
335
}
335
336
} ,
336
337
338
+ __applyCurrentStudy : function ( study ) {
339
+ if ( study ) {
340
+ study . addListener ( "changeName" , ( ) => {
341
+ if ( this . getCurrentStudy ( ) === study ) {
342
+ // the study might have been closed
343
+ osparc . utils . Utils . updateTabName ( study . getName ( ) ) ;
344
+ }
345
+ } ) ;
346
+ osparc . utils . Utils . updateTabName ( study . getName ( ) ) ;
347
+ } else {
348
+ const newName = osparc . utils . Utils . composeTabName ( ) ;
349
+ osparc . utils . Utils . updateTabName ( newName ) ;
350
+ }
351
+ } ,
352
+
337
353
__applyWallets : function ( wallets ) {
338
354
const preferenceSettings = osparc . Preferences . getInstance ( ) ;
339
355
const preferenceWalletId = preferenceSettings . getPreferredWalletId ( ) ;
Original file line number Diff line number Diff line change @@ -103,16 +103,24 @@ qx.Class.define("osparc.store.Workspaces", {
103
103
} ) ;
104
104
} ,
105
105
106
- searchWorkspaces : function ( text ) {
106
+ searchWorkspaces : function (
107
+ text ,
108
+ orderBy = {
109
+ field : "modified_at" ,
110
+ direction : "desc"
111
+ } ,
112
+ ) {
107
113
if ( osparc . auth . Data . getInstance ( ) . isGuest ( ) ) {
108
114
return new Promise ( resolve => {
109
115
resolve ( [ ] ) ;
110
116
} ) ;
111
117
}
112
118
119
+ const curatedOrderBy = this . self ( ) . curateOrderBy ( orderBy ) ;
113
120
const params = {
114
121
url : {
115
- text,
122
+ filters : JSON . stringify ( { text : text } ) ,
123
+ orderBy : JSON . stringify ( curatedOrderBy ) ,
116
124
}
117
125
} ;
118
126
return osparc . data . Resources . getInstance ( ) . getAllPages ( "workspaces" , params , "getPageSearch" )
Original file line number Diff line number Diff line change @@ -91,6 +91,22 @@ qx.Class.define("osparc.utils.Utils", {
91
91
92
92
FLOATING_Z_INDEX : 110000 ,
93
93
94
+ updateTabName : function ( name ) {
95
+ document . title = name ;
96
+ } ,
97
+
98
+ composeTabName : function ( ) {
99
+ let newName = osparc . store . StaticInfo . getInstance ( ) . getDisplayName ( ) ;
100
+ const platformName = osparc . store . StaticInfo . getInstance ( ) . getPlatformName ( ) ;
101
+ if ( osparc . utils . Utils . isInZ43 ( ) ) {
102
+ newName += " Z43" ;
103
+ }
104
+ if ( platformName ) {
105
+ newName += ` (${ platformName } )` ;
106
+ }
107
+ return newName ;
108
+ } ,
109
+
94
110
replaceTokens : function ( str , key , value ) {
95
111
// `str` might be a a localized string, get the string first
96
112
str = str . toString ? str . toString ( ) : str ;
You can’t perform that action at this time.
0 commit comments