File tree Expand file tree Collapse file tree 6 files changed +47
-15
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 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", {
209209 } ,
210210
211211 __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 ) ;
219214 } ,
220215
221-
222-
223216 __setDeviceSpecificIcons : function ( ) {
224217 const isIOS = / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! window . MSStream ;
225218 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", {
167167 if (
168168 ! osparc . auth . Manager . getInstance ( ) . isLoggedIn ( ) ||
169169 this . getCurrentContext ( ) === "studiesAndFolders" ||
170- this . getCurrentContext ( ) === "search" || // not yet implemented for workspaces
171170 this . __loadingWorkspaces
172171 ) {
173172 return ;
@@ -178,7 +177,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
178177 case "search" : {
179178 const filterData = this . _searchBarFilter . getFilterData ( ) ;
180179 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 ( ) ) ;
182181 break ;
183182 }
184183 case "workspaces" : {
Original file line number Diff line number Diff line change @@ -368,7 +368,7 @@ qx.Class.define("osparc.data.Resources", {
368368 getPageSearch : {
369369 useCache : false ,
370370 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}"
372372 } ,
373373 getPageTrashed : {
374374 useCache : false ,
Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ qx.Class.define("osparc.store.Store", {
5959 check : "osparc.data.model.Study" ,
6060 init : null ,
6161 nullable : true ,
62- event : "changeCurrentStudy"
62+ event : "changeCurrentStudy" ,
63+ apply : "__applyCurrentStudy" ,
6364 } ,
6465 currentStudyId : {
6566 check : "String" ,
@@ -334,6 +335,21 @@ qx.Class.define("osparc.store.Store", {
334335 }
335336 } ,
336337
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+
337353 __applyWallets : function ( wallets ) {
338354 const preferenceSettings = osparc . Preferences . getInstance ( ) ;
339355 const preferenceWalletId = preferenceSettings . getPreferredWalletId ( ) ;
Original file line number Diff line number Diff line change @@ -103,16 +103,24 @@ qx.Class.define("osparc.store.Workspaces", {
103103 } ) ;
104104 } ,
105105
106- searchWorkspaces : function ( text ) {
106+ searchWorkspaces : function (
107+ text ,
108+ orderBy = {
109+ field : "modified_at" ,
110+ direction : "desc"
111+ } ,
112+ ) {
107113 if ( osparc . auth . Data . getInstance ( ) . isGuest ( ) ) {
108114 return new Promise ( resolve => {
109115 resolve ( [ ] ) ;
110116 } ) ;
111117 }
112118
119+ const curatedOrderBy = this . self ( ) . curateOrderBy ( orderBy ) ;
113120 const params = {
114121 url : {
115- text,
122+ filters : JSON . stringify ( { text : text } ) ,
123+ orderBy : JSON . stringify ( curatedOrderBy ) ,
116124 }
117125 } ;
118126 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", {
9191
9292 FLOATING_Z_INDEX : 110000 ,
9393
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+
94110 replaceTokens : function ( str , key , value ) {
95111 // `str` might be a a localized string, get the string first
96112 str = str . toString ? str . toString ( ) : str ;
You can’t perform that action at this time.
0 commit comments