@@ -172,19 +172,19 @@ qx.Class.define("osparc.file.FilesTree", {
172172 populateStudyTree : function ( studyId ) {
173173 const treeName = osparc . product . Utils . getStudyAlias ( { firstUpperCase : true } ) + " Files" ;
174174 this . __resetTree ( treeName ) ;
175- let studyModel = this . getModel ( ) ;
175+ const studyModel = this . getModel ( ) ;
176176 this . self ( ) . addLoadingChild ( studyModel ) ;
177177
178178 const dataStore = osparc . store . Data . getInstance ( ) ;
179179 const locationId = 0 ;
180180 const path = studyId ;
181181 return dataStore . getItemsByLocationAndPath ( locationId , path )
182182 . then ( items => {
183- if ( items . length && "project_name" in items [ 0 ] ) {
184- this . __resetTree ( items [ 0 ] [ "project_name" ] ) ;
183+ if ( items . length ) {
184+ const studyName = items [ 0 ] [ "display_path" ] . split ( "/" ) [ 0 ]
185+ this . __resetTree ( studyName ) ;
185186 }
186- studyModel = this . getModel ( ) ;
187- this . __itemsToDataset ( "0" , studyId , items , studyModel ) ;
187+ this . __itemsToTree ( locationId , path , items , studyModel ) ;
188188
189189 // select study item
190190 this . setSelection ( new qx . data . Array ( [ studyModel ] ) ) ;
@@ -236,6 +236,7 @@ qx.Class.define("osparc.file.FilesTree", {
236236 }
237237 }
238238 this . __addToLoadFilePath ( locationId , datasetId , pathId ) ;
239+
239240 this . populateLocations ( ) ;
240241 } ,
241242
@@ -408,8 +409,10 @@ qx.Class.define("osparc.file.FilesTree", {
408409 return model ;
409410 } ,
410411
411- __itemsToTree : function ( locationId , path , items ) {
412- const parentModel = this . __getModelFromPath ( locationId , path ) ;
412+ __itemsToTree : function ( locationId , path , items , parentModel ) {
413+ if ( ! parentModel ) {
414+ parentModel = this . __getModelFromPath ( locationId , path ) ;
415+ }
413416 if ( parentModel ) {
414417 parentModel . getChildren ( ) . removeAll ( ) ;
415418 items . forEach ( item => {
@@ -430,12 +433,12 @@ qx.Class.define("osparc.file.FilesTree", {
430433 ) ;
431434 data . loaded = false ;
432435 const model = this . __createModel ( locationId , item [ "path" ] , data ) ;
436+ parentModel . getChildren ( ) . append ( model ) ;
433437 this . __pathModels . push ( {
434438 locationId,
435439 path : item [ "path" ] ,
436440 model,
437441 } ) ;
438- parentModel . getChildren ( ) . append ( model ) ;
439442 this . self ( ) . addLoadingChild ( model ) ;
440443 }
441444 } ) ;
0 commit comments