@@ -121,29 +121,34 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
121
121
122
122
addNonResourceCard : function ( card ) {
123
123
if ( osparc . dashboard . CardContainer . isValidCard ( card ) ) {
124
+ let groupContainer = null ;
125
+ let contentContainer = null ;
124
126
if ( this . getGroupBy ( ) ) {
125
127
// it will always go to the no-group group
126
- const noGroupContainer = this . __getGroupContainer ( "no-group" ) ;
127
- this . __addCardToContainer ( card , noGroupContainer ) ;
128
- this . self ( ) . sortListByPriority ( noGroupContainer . getContentContainer ( ) ) ;
128
+ groupContainer = this . __getGroupContainer ( "no-group" ) ;
129
+ contentContainer = groupContainer . getContentContainer ( ) ;
129
130
} else {
130
- this . __addCardToContainer ( card , this . __nonGroupedContainer ) ;
131
- this . self ( ) . sortListByPriority ( this . __nonGroupedContainer ) ;
131
+ groupContainer = this . __nonGroupedContainer ;
132
+ contentContainer = this . __nonGroupedContainer ;
132
133
}
134
+ this . __addCardToContainer ( card , groupContainer ) ;
135
+ this . self ( ) . sortListByPriority ( contentContainer ) ;
133
136
} else {
134
137
console . error ( "CardContainer only allows CardBase as its children." ) ;
135
138
}
136
139
} ,
137
140
138
141
removeNonResourceCard : function ( card ) {
139
142
if ( osparc . dashboard . CardContainer . isValidCard ( card ) ) {
143
+ let contentContainer = null ;
140
144
if ( this . getGroupBy ( ) ) {
141
145
const noGroupContainer = this . __getGroupContainer ( "no-group" ) ;
142
- if ( noGroupContainer . getContentContainer ( ) . getChildren ( ) . indexOf ( card ) > - 1 ) {
143
- noGroupContainer . getContentContainer ( ) . remove ( card ) ;
144
- }
145
- } else if ( this . __nonGroupedContainer . getChildren ( ) . indexOf ( card ) > - 1 ) {
146
- this . __nonGroupedContainer . remove ( card ) ;
146
+ contentContainer = noGroupContainer . getContentContainer ( ) ;
147
+ } else {
148
+ contentContainer = this . __nonGroupedContainer ;
149
+ }
150
+ if ( contentContainer && contentContainer . getChildren ( ) . indexOf ( card ) > - 1 ) {
151
+ contentContainer . remove ( card ) ;
147
152
}
148
153
} else {
149
154
console . error ( "CardContainer only allows CardBase as its children." ) ;
0 commit comments