@@ -276,8 +276,15 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
276276 return ;
277277 }
278278
279- const studies = resp [ "data" ] ;
280- this . __addStudiesToList ( studies ) ;
279+ if ( [ "templates" , "public" ] . includes ( this . getCurrentContext ( ) ) ) {
280+ const templates = resp [ "data" ] ;
281+ templates . forEach ( template => template [ "resourceType" ] = "template" ) ;
282+ this . __addResourcesToList ( templates ) ;
283+ } else {
284+ const studies = resp [ "data" ] ;
285+ studies . forEach ( study => study [ "resourceType" ] = "study" ) ;
286+ this . __addResourcesToList ( studies ) ;
287+ }
281288 if ( this . _resourcesContainer . getFlatList ( ) ) {
282289 this . _resourcesContainer . getFlatList ( ) . nextRequest = resp [ "_links" ] [ "next" ] ;
283290 }
@@ -333,17 +340,16 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
333340 this . _reloadCards ( ) ;
334341 } ,
335342
336- __addStudiesToList : function ( studiesList ) {
337- studiesList . forEach ( study => study [ "resourceType" ] = "study" ) ;
338- studiesList . forEach ( study => {
343+ __addResourcesToList : function ( resourcesList ) {
344+ resourcesList . forEach ( study => {
339345 const idx = this . _resourcesList . findIndex ( std => std [ "uuid" ] === study [ "uuid" ] ) ;
340346 if ( idx === - 1 ) {
341347 this . _resourcesList . push ( study ) ;
342348 }
343349 } ) ;
344350 this . __reloadNewCards ( ) ;
345351
346- studiesList . forEach ( study => {
352+ resourcesList . forEach ( study => {
347353 const state = study [ "state" ] ;
348354 if ( state && "locked" in state && state [ "locked" ] [ "value" ] && state [ "locked" ] [ "status" ] === "CLOSING" ) {
349355 // websocket might have already notified that the state was closed.
0 commit comments