Skip to content

Commit 20e3f3d

Browse files
committed
isValidWidget
1 parent 565681c commit 20e3f3d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
118118
__groupedContainers: null,
119119

120120
addNonResourceCard: function(card) {
121-
if (card instanceof qx.ui.form.ToggleButton) {
121+
if (osparc.dashboard.ToggleButtonContainer.isValidWidget(card)) {
122122
if (this.getGroupBy()) {
123123
// it will always go to the no-group group
124124
const noGroupContainer = this.__getGroupContainer("no-group");
@@ -134,7 +134,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
134134
},
135135

136136
removeNonResourceCard: function(card) {
137-
if (card instanceof qx.ui.form.ToggleButton) {
137+
if (osparc.dashboard.ToggleButtonContainer.isValidWidget(card)) {
138138
if (this.getGroupBy()) {
139139
const noGroupContainer = this.__getGroupContainer("no-group");
140140
if (noGroupContainer.getContentContainer().getChildren().indexOf(card) > -1) {

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,22 @@ qx.Class.define("osparc.dashboard.ToggleButtonContainer", {
2222
"changeVisibility": "qx.event.type.Data"
2323
},
2424

25+
static: {
26+
isValidWidget: function(widget) {
27+
// return (card instanceof qx.ui.form.ToggleButton);
28+
return (
29+
widget instanceof osparc.dashboard.CardBase ||
30+
widget instanceof osparc.dashboard.FolderButtonBase
31+
);
32+
},
33+
},
34+
2535
members: {
2636
__lastSelectedIdx: null,
2737

2838
// overridden
2939
add: function(child, options) {
30-
if (child instanceof qx.ui.form.ToggleButton) {
40+
if (this.self().isValidWidget(child)) {
3141
if (osparc.dashboard.ResourceContainerManager.cardExists(this, child)) {
3242
return;
3343
}

0 commit comments

Comments
 (0)