@@ -47,7 +47,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
4747 } ) ;
4848 this . _add ( nonGroupedContainer ) ;
4949
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 = [ ] ;
5153 } ,
5254
5355 properties : {
@@ -107,7 +109,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
107109 __folderHeader : null ,
108110 __foldersContainer : null ,
109111 __nonGroupedContainer : null ,
110- __groupedContainers : null ,
112+ __groupedContainersList : null ,
113+ __groupedContainersLayout : null ,
111114
112115 addNonResourceCard : function ( card ) {
113116 if ( card instanceof qx . ui . form . ToggleButton ) {
@@ -142,7 +145,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
142145
143146 removeCard : function ( uuid ) {
144147 if ( this . getGroupBy ( ) ) {
145- this . __groupedContainers . forEach ( groupedContainer => groupedContainer . removeCard ( uuid ) ) ;
148+ this . __groupedContainersList . forEach ( groupedContainer => groupedContainer . removeCard ( uuid ) ) ;
146149 } else {
147150 this . __nonGroupedContainer . removeCard ( uuid ) ;
148151 }
@@ -164,7 +167,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
164167 headerColor,
165168 visibility : "excluded"
166169 } ) ;
167- this . __groupedContainers . push ( groupContainer ) ;
170+ this . __groupedContainersList . push ( groupContainer ) ;
168171 return groupContainer ;
169172 } ,
170173
@@ -181,7 +184,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
181184 return this . __nonGroupedContainer . getChildren ( ) ;
182185 }
183186 const cards = [ ] ;
184- this . __groupedContainers . forEach ( groupedContainer => cards . push ( ...groupedContainer . getCards ( ) ) ) ;
187+ this . __groupedContainersList . forEach ( groupedContainer => cards . push ( ...groupedContainer . getCards ( ) ) ) ;
185188 return cards ;
186189 } ,
187190
@@ -199,9 +202,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
199202 } ,
200203
201204 __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 ( ) ) ;
203206 if ( idx > - 1 ) {
204- return this . __groupedContainers [ idx ] ;
207+ return this . __groupedContainersList [ idx ] ;
205208 }
206209 return null ;
207210 } ,
@@ -255,8 +258,11 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
255258 this . __nonGroupedContainer . removeAll ( ) ;
256259 this . __nonGroupedContainer = null ;
257260 }
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 = [ ] ;
260266 this . _removeAll ( ) ;
261267 } ,
262268
@@ -265,7 +271,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
265271 this . _add ( this . __foldersLayout ) ;
266272 if ( this . getGroupBy ( ) ) {
267273 const noGroupContainer = this . __createGroupContainer ( "no-group" , "No Group" , "transparent" ) ;
268- this . _add ( noGroupContainer ) ;
274+ this . __groupedContainersLayout . add ( noGroupContainer ) ;
275+ this . _add ( this . __groupedContainersLayout ) ;
269276 } else {
270277 const flatList = this . __nonGroupedContainer = new osparc . dashboard . ToggleButtonContainer ( ) ;
271278 osparc . utils . Utils . setIdToWidget ( flatList , listId ) ;
@@ -320,9 +327,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
320327 } ,
321328
322329 __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" ) ) ;
324331 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 ] ) ;
326333 }
327334 } ,
328335
@@ -340,8 +347,8 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
340347 if ( groupContainer === null ) {
341348 groupContainer = this . __createGroupContainer ( tag . id , tag . name , tag . color ) ;
342349 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 ( ) ) ) ;
345352 this . __moveNoGroupToLast ( ) ;
346353 }
347354 const card = this . __createCard ( resourceData ) ;
0 commit comments