Skip to content

Commit db2f4d6

Browse files
committed
minor
1 parent 46ee777 commit db2f4d6

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

services/static-webserver/client/source/class/osparc/dashboard/ResourceContainerManager.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,29 +121,34 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
121121

122122
addNonResourceCard: function(card) {
123123
if (osparc.dashboard.CardContainer.isValidCard(card)) {
124+
let groupContainer = null;
125+
let contentContainer = null;
124126
if (this.getGroupBy()) {
125127
// 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();
129130
} else {
130-
this.__addCardToContainer(card, this.__nonGroupedContainer);
131-
this.self().sortListByPriority(this.__nonGroupedContainer);
131+
groupContainer = this.__nonGroupedContainer;
132+
contentContainer = this.__nonGroupedContainer;
132133
}
134+
this.__addCardToContainer(card, groupContainer);
135+
this.self().sortListByPriority(contentContainer);
133136
} else {
134137
console.error("CardContainer only allows CardBase as its children.");
135138
}
136139
},
137140

138141
removeNonResourceCard: function(card) {
139142
if (osparc.dashboard.CardContainer.isValidCard(card)) {
143+
let contentContainer = null;
140144
if (this.getGroupBy()) {
141145
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);
147152
}
148153
} else {
149154
console.error("CardContainer only allows CardBase as its children.");

0 commit comments

Comments
 (0)