@@ -47,7 +47,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
47
47
} ) ;
48
48
this . _add ( nonGroupedContainer ) ;
49
49
50
- this . __groupedContainers = [ ] ;
50
+ const groupedContainersLayout = this . __groupedContainersLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 10 ) ) ;
51
+ this . _add ( groupedContainersLayout ) ;
52
+ this . __groupedContainersList = [ ] ;
51
53
} ,
52
54
53
55
properties : {
@@ -107,7 +109,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
107
109
__folderHeader : null ,
108
110
__foldersContainer : null ,
109
111
__nonGroupedContainer : null ,
110
- __groupedContainers : null ,
112
+ __groupedContainersList : null ,
113
+ __groupedContainersLayout : null ,
111
114
112
115
addNonResourceCard : function ( card ) {
113
116
if ( card instanceof qx . ui . form . ToggleButton ) {
@@ -142,7 +145,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
142
145
143
146
removeCard : function ( uuid ) {
144
147
if ( this . getGroupBy ( ) ) {
145
- this . __groupedContainers . forEach ( groupedContainer => groupedContainer . removeCard ( uuid ) ) ;
148
+ this . __groupedContainersList . forEach ( groupedContainer => groupedContainer . removeCard ( uuid ) ) ;
146
149
} else {
147
150
this . __nonGroupedContainer . removeCard ( uuid ) ;
148
151
}
@@ -164,7 +167,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
164
167
headerColor,
165
168
visibility : "excluded"
166
169
} ) ;
167
- this . __groupedContainers . push ( groupContainer ) ;
170
+ this . __groupedContainersList . push ( groupContainer ) ;
168
171
return groupContainer ;
169
172
} ,
170
173
@@ -181,7 +184,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
181
184
return this . __nonGroupedContainer . getChildren ( ) ;
182
185
}
183
186
const cards = [ ] ;
184
- this . __groupedContainers . forEach ( groupedContainer => cards . push ( ...groupedContainer . getCards ( ) ) ) ;
187
+ this . __groupedContainersList . forEach ( groupedContainer => cards . push ( ...groupedContainer . getCards ( ) ) ) ;
185
188
return cards ;
186
189
} ,
187
190
@@ -199,9 +202,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
199
202
} ,
200
203
201
204
__getGroupContainer : function ( gid ) {
202
- const idx = this . __groupedContainers . findIndex ( groupContainer => groupContainer . getGroupId ( ) === gid . toString ( ) ) ;
205
+ const idx = this . __groupedContainersList . findIndex ( groupContainer => groupContainer . getGroupId ( ) === gid . toString ( ) ) ;
203
206
if ( idx > - 1 ) {
204
- return this . __groupedContainers [ idx ] ;
207
+ return this . __groupedContainersList [ idx ] ;
205
208
}
206
209
return null ;
207
210
} ,
@@ -255,8 +258,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
255
258
this . __nonGroupedContainer . removeAll ( ) ;
256
259
this . __nonGroupedContainer = null ;
257
260
}
258
- this . __groupedContainers . forEach ( groupedContainer => groupedContainer . getContentContainer ( ) . removeAll ( ) ) ;
259
- this . __groupedContainers = [ ] ;
261
+ if ( this . __groupedContainersLayout ) {
262
+ this . __groupedContainersLayout . removeAll ( ) ;
263
+ }
264
+ this . __groupedContainersList . forEach ( groupedContainer => groupedContainer . getContentContainer ( ) . removeAll ( ) ) ;
265
+ this . __groupedContainersList = [ ] ;
260
266
this . _removeAll ( ) ;
261
267
} ,
262
268
@@ -265,7 +271,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
265
271
this . _add ( this . __foldersLayout ) ;
266
272
if ( this . getGroupBy ( ) ) {
267
273
const noGroupContainer = this . __createGroupContainer ( "no-group" , "No Group" , "transparent" ) ;
268
- this . _add ( noGroupContainer ) ;
274
+ this . __groupedContainersLayout . add ( noGroupContainer ) ;
275
+ this . _add ( this . __groupedContainersLayout ) ;
269
276
} else {
270
277
const flatList = this . __nonGroupedContainer = new osparc . dashboard . ToggleButtonContainer ( ) ;
271
278
osparc . utils . Utils . setIdToWidget ( flatList , listId ) ;
@@ -320,9 +327,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
320
327
} ,
321
328
322
329
__moveNoGroupToLast : function ( ) {
323
- const idx = this . _getChildren ( ) . findIndex ( grpContainer => grpContainer === this . __getGroupContainer ( "no-group" ) ) ;
330
+ const idx = this . __groupedContainersLayout . getChildren ( ) . findIndex ( grpContainer => grpContainer === this . __getGroupContainer ( "no-group" ) ) ;
324
331
if ( idx > - 1 ) {
325
- this . _getChildren ( ) . push ( this . _getChildren ( ) . splice ( idx , 1 ) [ 0 ] ) ;
332
+ this . __groupedContainersLayout . getChildren ( ) . push ( this . __groupedContainersLayout . getChildren ( ) . splice ( idx , 1 ) [ 0 ] ) ;
326
333
}
327
334
} ,
328
335
@@ -340,8 +347,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
340
347
if ( groupContainer === null ) {
341
348
groupContainer = this . __createGroupContainer ( tag . id , tag . name , tag . color ) ;
342
349
groupContainer . setHeaderIcon ( "@FontAwesome5Solid/tag/24" ) ;
343
- this . _add ( groupContainer ) ;
344
- this . _getChildren ( ) . sort ( ( a , b ) => a . getHeaderLabel ( ) . localeCompare ( b . getHeaderLabel ( ) ) ) ;
350
+ this . __groupedContainersLayout . add ( groupContainer ) ;
351
+ this . __groupedContainersLayout . getChildren ( ) . sort ( ( a , b ) => a . getHeaderLabel ( ) . localeCompare ( b . getHeaderLabel ( ) ) ) ;
345
352
this . __moveNoGroupToLast ( ) ;
346
353
}
347
354
const card = this . __createCard ( resourceData ) ;
0 commit comments